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 swanimport scanpy as scfname ='/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.p
UMAP
Provide the corresponding AnnData from the SwanGraph and the name of the transcript / edge / TES / TSS you want to plot.
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
tname
annotation
tid
ENCODEMT000141768
ENCODEMT000141768
ENCODEMT000141768
False
ENCODEMT000141769
ENCODEMT000141769
ENCODEMT000141769
False
ENCODEMT000141770
ENCODEMT000141770
ENCODEMT000141770
False
ENCODEMT000141771
ENCODEMT000141771
ENCODEMT000141771
False
ENCODEMT000141772
ENCODEMT000141772
ENCODEMT000141772
False
png
Here, I'll use a heatmap to show the expression of each known isoform of Tpm2 in each cluster.
png
I can also plot using different metadata to group the cells by, like the input sample:
png
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).
png
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.
png
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:
png
Of course you can also plot the expression of TSSs and TESs from your SwanGraph using this strategy as well, as shown below.
# merge with transcript names and annotation information
sg.adata.var = sg.adata.var.merge(sg.t_df[['tname', 'annotation']], left_index=True, right_index=True)
sg.adata.var.head()