Scanpy compatibility
Since Swan now uses the AnnData data structure to track abundance for transcripts, TSSs, TESs, and edges, this makes these objects directly compatible with the amazing suite of Scanpy preprocessing, analysis, and visualization tools.
For this brief overview of some cool things you can do with Swan, I'll be using the Swan object of the data from my lab's 2021 preprint on LR-Split-seq to showcase how specifically Scanpy can be used for single-cell data.
import swan_vis as swan
import scanpy as sc
fname = '/Users/fairliereese/mortazavi_lab/data/c2c12_paper_2020/sc_pacbio/210618/c2c12.p'
sg = swan.read(fname)Read in graph from /Users/fairliereese/mortazavi_lab/data/c2c12_paper_2020/sc_pacbio/210618/c2c12.pUMAP
Provide the corresponding AnnData from the SwanGraph and the name of the transcript / edge / TES / TSS you want to plot.
sc.pl.umap(sg.tss_adata,
color='Nisch_23',
gene_symbols='tss_name',
layer='tpm',
frameon=False,
size=120,
show=False,
cmap='magma')<AxesSubplot:title={'center':'Nisch_23'}, xlabel='UMAP1', ylabel='UMAP2'>


Dotplots, matrixplots, and heatmaps
Scanpy provides many different options to visualize expression of multiple variables per group. Some of my favorites are dotplots, matrixplots, and heatmaps.
Here, I'll plot the expression of each Tpm2 isoform per cluster using a dotplot. The cluster column name in sg.adata.obs is called leiden.
tid
ENCODEMT000141768
ENCODEMT000141768
ENCODEMT000141768
False
ENCODEMT000141769
ENCODEMT000141769
ENCODEMT000141769
False
ENCODEMT000141770
ENCODEMT000141770
ENCODEMT000141770
False
ENCODEMT000141771
ENCODEMT000141771
ENCODEMT000141771
False
ENCODEMT000141772
ENCODEMT000141772
ENCODEMT000141772
False

Here, I'll use a heatmap to show the expression of each known isoform of Tpm2 in each cluster.

I can also plot using different metadata to group the cells by, like the input sample:

Here's the same data plotted in a matrix plot, which aggregates expression across each category (but doesn't show the colors for each category).

Of course, you can make all the above plots with TSS or TES expression data as well! Such as the dotplot below for different TSSs of Nisch.

Violin plots
Scanpy also offers violin plots which are often used to visualize expression distributions of different categories.
First, I'll show the expression of a single isoform across the different identified cell types:

Of course you can also plot the expression of TSSs and TESs from your SwanGraph using this strategy as well, as shown below.

Last updated
Was this helpful?