Skip to content

MozesBlom/tutorials

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Tutorials in evolutionary genomics

Introduction to Jupyter Notebooks.

Much of the tutorials in this repository have been written up in Jupyter Notebook format and have been created with Google colab compatibility in mind. The following is a brief description on Jupyter Notebooks, Google Colab and how to optimally utilise these resources.

Jupyter Notebooks are notebooks for computational projects, which can include snippets of code, annotation/comments and the output of code. It is an excellent way to keep track of the code that you built, the rationale behind it and is an excellent format to share code/ideas with colleagues (or your future self!).

A Jupyter notebook can contain several different sections.

Section 1 is regular text in Markdown format. Markdown is a simple to use formatting language that automatically takes care of the formatting of plain text in documents. It's basically a code version of similar actions that you do in Microsoft Word using point and click. Here are a few examples. If you don't use any of the markdown formatting, text filled out in Jupyter notebook cells will simply appear as regular text in standard font. However, by using the markdown formatting you can create rich annotations that include links, images, etc. The present README document that you are reading is for example completely written in Markdown!

Section 2 of the notebook are code cells. These cells/blocks generally include Python (hence the 'Py' in 'juPYter') code and can be used for computational purposes. The major benefit of Jupyter notebooks is that not only the result, but the code itself can be shared as well. In combination with the code annotation, it enables us to share our work and keep track of what/why we created a certain block of code.

Section 3 of the notebook is the output of the code above (if output is to be expected from the code above). To make things a bit confusing: When we refer to a Jupyter notebook, we can either refer to an actual notebook created in accordance with the Jupyter notebook format (as outlined above) or the notebook application developed under the Project Jupyter umbrella. By opening a notebook and going through the notebook in the editor, we can actually run the Python code in the cell blocks and evaluate the output (as done here in Section 3).

Jupyter Notebook is the lightweight application to run notebooks, but it requires a bit of background understanding to run this from commandline. Moreover it now has been generally superseded by JupyterLab for which there is also a Desktop application: JupyterLab Desktop

SUMMARY: Computational notebooks in Jupyter format ('Jupyter notebooks') are a great way to share code and explore datasets. They are widely used in data science and are increasingly used for computational biology as well. To open and run a Jupyter notebook, we can use applications such as JupyterLab or the desktop version Jupyterlab Desktop.

Jupyterlab vs. Google Colab

JupyterLab or JupyterLab Desktop are both excellent choices to run on your own laptop. However, for the sake of tutorials, they are not optimal due to the background knowledge required to handle with dependencies. Dependencies are modules (software packages effectively) that can be required for a specific activity. For example, we may want to do an exercises that involves coalescent simulations and we therefore require a python package, msprime, that is not standard packed with every Python installation. Handling python dependencies and modules is relatively straightforward using a package manager such as (mini)conda, but it does require some command line know-how. To avoid this, all Jupyter Notebook tutorials have been designed to run in the Cloud on a Google Colab instance, HOWEVER I would also strongly suggest to install JupyterLab Desktop on your personal machine in case you take part in an in-person computer practical! If the internet connection is spotty OR there are not sufficient Colab instances available, we will switch to Jupyterlab Desktop during the in-person computer practicals.

Google Colab

The major benefit of Google Colab is that nothing needs to be installed on your personal machine, everything is executed on a Google computing instance. Here is a link with a short introduction video and overview. The only thing what you need to do is to sign up for a Google Account and login. Then navigate to the Google Colab webpage and click on Open Colab. If you are signed in with your Google Account, this should look like:

Here you can create a new notebook, continue a previous notebook which you stored locally or on Google Drive, etc. Here we benefit from the Github integration and directly point Colab to the present Github page:

Select the notebook of the tutorial that you'd like to work on and it should automatically kickstart the notebook!

About

Resources for classes, seminars, etc.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published