Visualizing the Planarian cell map using PAGA

This notebook reproduces the main cell map with its lineage relations, starting from the results of Plass et al., Science (2018).

For the preprocessing and the original data, see

In [1]:
import numpy as np
import pandas as pd
import matplotlib.pyplot as pl
import scanpy.api as sc

sc.set_figure_params(dpi=100)  # low dpi (dots per inch) yields small inline figures
sc.settings.verbosity = 3  # verbosity: errors (0), warnings (1), info (2), hints (3)
results_file = './write/planaria_extended.h5ad'
scanpy==1.2.0 anndata==0.6.4+6.gd9727ca numpy==1.13.1 scipy==1.0.0 pandas==0.22.0 scikit-learn==0.19.1 statsmodels==0.9.0 python-igraph==0.7.1 louvain==0.6.1 

Clusterings at different resolutions

In [5]:
adata ='../../mireya/planarian_lineages/paga/write/planaria.h5ad')
In [6]:
map_neoblasts = {c: c if not c.startswith('neoblast') else 'neoblast' for c in adata.obs['clusters'].cat.categories}
sc.utils.merge_groups(adata, 'clusters', key_added='clusters_neoblasts', map_groups=map_neoblasts)

Merge each organ to create a coarse-grained clustering.

In [7]:
map_coarse = {}
for c in adata.obs['clusters'].cat.categories:
    if c.startswith('neoblast'):
        map_coarse[c] = 'stem cells'
    elif 'neur' in c:
        map_coarse[c] = 'neurons'
    elif 'epider' in c:
        map_coarse[c] = 'epidermis'
    elif 'muscle' in c:
        map_coarse[c] = 'muscle'
    elif 'parenchy' in c:
        map_coarse[c] = 'parenchyma'
    elif 'secretory' in c:
        map_coarse[c] = 'secretory'
    elif 'pharynx' in c:
        map_coarse[c] = 'pharynx'
    elif 'gut' in c or 'phagocyt' in c or 'goblet' in c:
        map_coarse[c] = 'gut'
        map_coarse[c] = c
In [8]:
sc.utils.merge_groups(adata, 'clusters', key_added='clusters_coarse', map_groups=map_coarse)

Do the actual plotting.

In [9]:, color=['clusters', 'clusters_neoblasts', 'clusters_coarse'],
           legend_loc='on data', legend_fontsize=5)
In [10]:, color='clusters_coarse', title='tSNE',
           legend_loc='on data', legend_fontsize=5, save='_coarse')
saving figure to file ./figures/tsne_coarse.pdf