Iwo-K / genespector

MIT License
2 stars 2 forks source link
anndata rna-seq scanpy scrna-seq transcriptomics

.. role:: pyth(code) :language: python

Genespector

Genespector is a Dash/Plotly app for interactive visualisation of large scRNA-Seq datasets analysed using the scanpy/AnnData packages. Genespector allows responsive plotting of datasets up to 100,000 cells. It remains stable at least up to 250,000 cells but there is a visible delay in plotting.

Genespector is based on the Dash/Plotly framework: https://dash.plot.ly/

Installation

Python > 3.4 and pip are required. To install the package:

  1. Clone the repository:

.. code-block:: text

git clone https://github.com/Iwo-K/genespector
  1. Install the dependencies

.. code-block:: text

pip install -r ./genespector/requirements.txt
  1. Install the package

.. code-block:: text

pip install ./genespector/

Examples

A simple example of scRNA-Seq dataset displayed with Genespector can be found here: http://128.232.224.252/example/

For anyone interested in haematopoiesis, the Gottgens lab is hosting several Genespector apps displaying following scRNA-Seq datasets:

  1. Mouse haematopoietic stem and progenitor cells: a. http://128.232.224.252/sfdata/ - from the paper: Nestorowa et al. Blood 2016, PMID: 27365425 b. http://128.232.224.252/LKdata/ - from the paper: Dahlin et al. Blood 2018, PMID: 29588278
  2. Human Bone Marrow cells (from Human Cell Atlas): http://128.232.224.252/HCABM/

AnnData objects pre-processing

Genespector simply requires an AnnData object to run. Most adata object should work straight away, but you may want to select features to be shown in the app by removing unnecessary information from the AnnData object. An example jupyter notebook with data preprocessing can be found here: https://nbviewer.jupyter.org/github/Iwo-K/genespector/blob/master/example_genespector.ipynb

The adata objects are imported as follows:

When dealing with large datasets, to save memory try using sparse matrices with normalised/log-transformed data and avoid using full matrices containing scaled data.

App initialisation

In python, where adata is the AnnData object of choice:

.. code-block:: text

import genespector as gp
gp.make_app(adata)

Example output:

.. code-block:: text

.........
.........
* Serving Flask app "app" (lazy loading)
.........
* Running on http://127.0.0.1:8050/ (Press CTRL+C to quit)

Copy the address to your browser or click the link.

make_app() accepts the following arguments:

Usage

Interface is quite simple. The plot area allows zooming, selection of points and exporting to png files (in this cases removing axes may be useful).

Specific subsets (plotted as layers) of the data can be selected by clicking the legend (double-click to isolate a specific subset)

Subsets are specified from the dropdown menu. To colour-code by subsets select 'categorical data' from the 'Colour points' menu.

Gene expression values can be chosen from the Colour points menu.

The app can also be embedded within an existing website using