{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "\n", "\n", "# Computational skills for Biocuration\n", "\n", "\n", "# Webinar 1\n", "\n", "- Date: January 22, 2019\n", "- Time: 16:00 GMT\n", "- Connection Information: https://attendee.gototraining.com/r/2734438535500774913\n", "(Training ID: 461-010-428)\n", "- Notepad: https://piratenpad.de/p/2019-Biocuration-Module-2\n", "\n", "## Introduction to the course and platform" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Who we are?\n", "\n", "(listed in an order of the webinar content they will cover today)\n", "\n", "- Malvika Sharan (email: malvika.sharan@embl.de)\n", "- Toby Hodges (email: toby.hodges@embl.de)\n", "- Marc Gouw (email: marc.gouw@embl.de)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Aim of the course\n", "\n", "- To provide participants with a foundation in Python programming language for working with bioinformatics tools\n", "- To provide a working knowledge of database structure\n", "- To apply these skills to increase the efficiency of a set of curation tasks\n", "\n", "#### This course will comprise of the following events\n", "\n", "- Webinars and in-person training\n", "\n", "| Date | Event Type \n", "|:------| ------------\n", "| Jan 22 | Introduction (session will be recorded)\n", "|Jan 28 | Troubleshooting/Q&A (session will be recorded)\n", "| 4 & 5 Feb | **In-Person Training @EMBL-EBI**\n", "| 11 Feb | Post-training session 1\n", "| 18 Feb | Post-training session 2\n", "|25 Feb | Post-training session 3\n", "| 4 Mar | Post-training session 4\n", "| 11 Mar | Post-training session 5\n", "\n", "- Course materials will be available at GitHub:https://github.com/zencore/2019-Biocuration-Module-2" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Learning outcomes\n", "\n", "- Discuss basic programming concepts in Python\n", "- Create basic scripts \n", "- Application of programming skills in the process of curation\n", " - Communicate with and query a data repository\n", " - Analyse and visualise biological data\n", "\n", "#### Additional learning outcomes\n", "\n", "- Understand and describe the structure of an appropriate data repository\n", "- Describe key issues in producing both external and internal interfaces\n", "- Explain the importance of discussion with interested parties eg software developers and database managers\n", "\n", "### Final assignment\n", "\n", "Students will be assessed summatively by the completion of a computational based task, which will include the writing of code to undertake a specific curation task (**more about it at the in-person training**)." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Python Programming\n", "\n", "Python programming language is comparatively simpler to understand for newer learners. Though easy to read (due to it's simpler syntax), Python is powerful, making it an ideal language for the beginners to learn.\n", "\n", "You can do really cool things in Python, starting from basic computing to high-throughput data analysis (visualization, statistics), machine learning, and creating reproducible workflows.\n", "\n", "It is common to write Python codes using editors (gedit, spyder, notebook++ etc.) and save them in a plain text file with an extension _.py_. However, for this course we will use the Jupyter Notebook." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "#### Jupyter Notebook\n", "\n", "In a Jupyter _Notebook_, we can do interactive programming (e.g. Python), by writing new codes or testing prewritten programs while storing them with text/notes for documentation. \n", "\n", "- Jupyter is a set of tools that allows us to use Python and data while displaying the outputs and figures on the same browser. \n", "- Like other specialized editors, Notebook provides code completion and other helpful features to write Python (and a few other programming) language efficiently. \n", "- Notebook files have the extension .ipynb (stands for IPython notebook - previous name for Jupyter Notebook) to distinguish them from plain-text Python programs.\n", "- You can type, edit, and copy and paste blocks of code in the \"code cell\".\n", "- You can write notes and documentation in the \"text cell\".\n", "- .ipynb files can be shared with others who can open them in their browsers, and see your work while reproducing results for your analysis.\n", "- You can also generate/export a .pdf files with the output/images produced by your codes along with the notes (think about publications) and share with your collaborators.\n", "\n", "#### Using Jupyter Notebook in your computer\n", "\n", "To use Jupyter notebook, you must install anaconda for your opertaing system along with the latest Python packages. The [Anaconda package manager](https://docs.continuum.io/anaconda/install) is an automated way to install the Jupyter notebook.\n", "- See the setup instructions for [Anaconda installation instructions](https://swcarpentry.github.io/python-novice-gapminder/setup/).\n", "\n", "Once you have installed Python and the Jupyter Notebook requirements, launch the Jupyter Notebook:\n", "\n", "* **On a Mac or Linux computer:** Open a shell and type: `jupyter notebook` followed by \"Enter\"\n", "* **On a Windows computer:** Launch \"Jupyter Notebook\" from the \"Start\" prompt, or from the \"Anaconda Navigator\"\n", "\n", "This will start a Jupyter Notebook server in your computer (without internet) and open your default web browser. (The server does the work and the web browser renders the notebook)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "#### Creating and storing Jupyter Notebook\n", "\n", "You can start a new page by clicking the button 'new'-> 'Python 3'.\n", "\n", "You can test run a `print` command, to print something:\n", "\n", "- Type the code written in the \"code cell\" below. \n", "- Run by Shift+Enter or the play symbol (right arrow) in the toolbar on the top of your page." ] }, { "cell_type": "code", "execution_count": 11, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "testing Python in Jupyter Notebook\n" ] } ], "source": [ "print(\"testing Python in Jupyter Notebook\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "#### A few more useful Jupyter Notebook tips\n", "\n", "To create new cells in Jupyter Notebook, you can use the following keyboard shortcuts: \n", "- New cell below: Esc+b\n", "- New cell above: Esc+a\n", "- Delete your current cell: Esc + X\n", "- Execute the contents of your current cell: Shift+Enter\n", "- Undo your last cell deletion: Esc + Z\n", "- See list of all the shortcut keys: Esc + H\n", "- Define type your current cell as \"text cell\": Esc + M\n", "- Define type your current cell as \"code cell\": Esc + Y" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "#### Markdown for documentation/notes\n", "\n", "> Markdown is a lightweight markup language with plain text formatting syntax. - [Wikipedia](https://en.wikipedia.org/wiki/Markdown)\n", "\n", "Markdown is used for creating rich text using plain text. Markdown does most of what HTML does.\n", "\n", "Text\n", "\n", "Line breaks\n", "don't matter.\n", "\n", "But blank lines\n", "create new paragraphs.\n", "\n", "Headings\n", "\n", "# Level-1 Heading: Starts with '# ' (hash symbol and a space)\n", "## Level-2 Heading: Starts with '## '\n", "### and so on...\n", "\n", "**Exercise:**\n", "\n", "Upto which level of heading can you go?\n", "\n", "Unordered List\n", "\n", "- not numbered: using \"-\" or \"*\" or \"+\"\n", " - indented: using indentation and then \"-\" or \"*\" or \"+\"\n", " \n", "Numbered list\n", "\n", "1. First point: Starts with \"1.\"\n", "1. Second point: Also starts with \"1.\"\n", "1. Number don't matter: Also starts with \"1.\"\n", " 1. Sub-point: indented and then starts with \"1.\"\n", " \n", "Highlighting\n", "\n", "- _italics_: Starts and ends with an underscore\"_\"\n", "- __bold__: Starts and ends with two underscores \"__\"\n", "\n", "**Exercise**\n", "\n", "How will you generate text that are both ___bold and italics___?\n", "\n", "Creating link\n", "\n", "[Markdown Cheatsheet](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet)\n", "- Text to be displayed in a square brackets **[Markdown Cheatsheet]** followed by a link in a round brackets (https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet)\n", "- The closing of square bracket and opening of round brackets don't have any space in between, i.e. \"](\"\n", "\n", "That's all for now! Let's move on to Python programming." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Beginning with Python\n", "\n", "Here we will introduce you to the basic Python commands and syntax." ] }, { "cell_type": "code", "execution_count": 12, "metadata": { "collapsed": true }, "outputs": [], "source": [ "## Let's try a few Python commands" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "#### Homework\n", "\n", "1. Download the file to the Desktop (or somewhere else if you prefer):\n", " - Right-click [this link](https://raw.githubusercontent.com/zencore/2019-Biocuration-Module-2/master/webinars/webinar_1-introducing_python.ipynb\n", ") and click \"Save Link As\"\n", "2. Launch the Jupyter Notebook (from the shell on Mac and Linux, or the \"Start\" menu on Windows)\n", "3. This will start a Jupyter Notebook server and open your default web browser from where you can access the dowloaded file and open the rendered version on your browser\n", "4. Read through the material while writing, running and/or testing Python codes\n", "5. Do the exercises and reach out to us with any particular questions about the given homework\n", "\n", "We will see you on at our second webinar.\n", "\n", "- Date: January 28\n", "- Time: 16:00 GMT\n", "- Notepad: https://piratenpad.de/p/2019-Biocuration-Module-2\n", "\n", "***More information will follow in an email!***" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "#### References and Recommendations\n", "\n", "1. For more on Jupyter and markdown: [Running and Quitting, Software Carpentry](https://swcarpentry.github.io/python-novice-gapminder/01-run-quit/index.html)\n", "1. [Markdown Cheatsheet](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet)\n", "1. [Jupyter Tips & Tricks](https://www.dataquest.io/blog/jupyter-notebook-tips-tricks-shortcuts/)\n", "1. [Python wiki for non-programmers](https://wiki.python.org/moin/BeginnersGuide/NonProgrammers)\n", "1. [Beginners guide for people with basic programming experiences](https://wiki.python.org/moin/BeginnersGuide/Programmers)" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.6.0" } }, "nbformat": 4, "nbformat_minor": 2 }