MGnify Notebooks Server

A Jupyter Lab environment for the MGnify API

Short video tutorial

View on YouTube.

About the notebooks.mgnify.org resource

The MGnify Notebooks Server is a Jupyter Lab environment for doing data analysis online.

You don’t need to install anything – it is hosted by EMBL’s Cell Biology & Biophysics Unit and you use it in your web browser.

_images/notebooks-home.png

Figure 18 The default “Home” notebook of the MGnify Notebooks Server.

Hint

The Notebooks Server homepage contains a quick starts guide and list of the available Notebooks.

Use cases for the Notebooks Server

Programmatic access to MGnify data resources is done via the the API.

The Notebooks are useful if you’re just starting to explore the API and are looking for code examples to get started.

They are also useful if you only need to access a few pieces of data and so don’t want to install anything to get what you need.

There are examples in Python and in the R language.

MGnifyR: an R package for accessing MGnify

The Notebooks include code examples written using MGnifyR, an R package with convenience wrappers around the MGnify API, as well as recipes for cross-study analysis.

MGnifyR is already installed on the Notebook Server, so you can try it out straight away.

Take a look at this cross-study analysis example.

Using a Jupyter Notebook

A Jupyter Notebook is an interactive coding document. It is based on cells (as in blocks of content). Some cells are just text, and some contain code.

In our examples, there are text cells to explain what we’re doing, and code cells with example code that you can run.

Hint

To run a code cell, select it (with your keyboard/mouse/input device) and press shift + enter or click the ▶ icon in the top menubar.

Any output from the code will be printed directly below the code cell.

Only one cells runs at a time, so you can step through a notebook to step through a workflow.

Each example notebook we provide should run without any changes needed. You are free to change these as you wish – you’re working on a copy of the examples.

Warning

When you leave your computer for a while or close the website, your instance of the Jupyter Lab will end. Your work might be saved if you come back later and refresh, but usually it won’t be: so make sure you download anything you need to keep before finishing.

Jumping to a Notebook from the MGnify website

_images/website-programmatic-access-box.png

Figure 19 There are deep-links to some Notebooks from the the MGnify website.

Some resource views on the MGnify website show a “Programmatic access” banner. This lists the API URL for the resource, as well as links to any Notebooks that help you consume that API endpoint.

For example, opening a Study in R or Python means opening a Notebook on our server with example code to read in that study.

These are deep links, in that following them means the Notebook will already know the Study Accession (ID) you are interested in.

Using the notebooks on your own computer instead

The code for our notebooks is open source and available on GitHub.

The notebook server is containerised with Docker, making installation fairly simple.

You can also simply copy the notebooks themselves from GitHub, but you will have to install the dependencies using e.g. Conda.