Tutorial 6: Stereo-seq mouse embryo E10.5_E1S3

In this tutorial, we demonstrate how to apply STGMVA to Stereo-seq data for spatial domains identification. We take mouse embryo 10.5 data as example and set the number of clusters as 16. Mouse embryo Stereo-seq data were downloaded from https://db.cngb.org/stomics/mosta/ and provided at https://zenodo.org/record/8141084.

Before running the model, please download input data by the link above.

Loading package

[3]:
import os
import torch
import pandas as pd
import scanpy as sc
from sklearn import metrics
import multiprocessing as mp
import squidpy as sq
import numpy as np
import matplotlib.pyplot as plt
[2]:
from STGMVA.STGMVA import STGMMVE
from STGMVA import read_adata
from STGMVA import mk_dir
2023-07-14 21:58:52.180988: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRT

Reading ST data and showing the manual annotation in Stereo-seq study

[3]:
adata = sc.read("/home/tengliu/Paper6-NC/STGMVA_Tutorials/ST data/E10.5_E1S3.MOSTA.h5ad") # read data
WARNING: Your filename has more than two extensions: ['.5_E1S3', '.MOSTA', '.h5ad'].
Only considering the two last: ['.MOSTA', '.h5ad'].
WARNING: Your filename has more than two extensions: ['.5_E1S3', '.MOSTA', '.h5ad'].
Only considering the two last: ['.MOSTA', '.h5ad'].
[5]:
adata
[5]:
AnnData object with n_obs × n_vars = 18670 × 25647
    obs: 'n_genes_by_counts', 'log1p_n_genes_by_counts', 'total_counts', 'log1p_total_counts', 'annotation', 'spatial_leiden_res4', 'Regulon - 1700009N14Rik', 'Regulon - 2610044O15Rik8', 'Regulon - AU041133', 'Regulon - Abcf2', 'Regulon - Alx1', 'Regulon - Alx3', 'Regulon - Arid3a', 'Regulon - Arid3c', 'Regulon - Arnt', 'Regulon - Arx', 'Regulon - Atf1', 'Regulon - Atf2', 'Regulon - Atf3', 'Regulon - Atf4', 'Regulon - Atf6', 'Regulon - Atoh1', 'Regulon - Barhl1', 'Regulon - Barhl2', 'Regulon - Bcl11a', 'Regulon - Bclaf1', 'Regulon - Bdp1', 'Regulon - Bhlhe22', 'Regulon - Bhlhe41', 'Regulon - Bmyc', 'Regulon - Borcs8', 'Regulon - Brf1', 'Regulon - Brf2', 'Regulon - Cebpa', 'Regulon - Cebpb', 'Regulon - Cebpd', 'Regulon - Cebpe', 'Regulon - Cebpg', 'Regulon - Chd1', 'Regulon - Clock', 'Regulon - Cnot3', 'Regulon - Creb1', 'Regulon - Creb3', 'Regulon - Creb3l1', 'Regulon - Crebzf', 'Regulon - Crem', 'Regulon - Crx', 'Regulon - Ctcf', 'Regulon - Cux1', 'Regulon - D3Ertd254e', 'Regulon - Dbx2', 'Regulon - Dlx2', 'Regulon - Dlx5', 'Regulon - Dlx6', 'Regulon - Dmrt3', 'Regulon - Dmrta2', 'Regulon - E2f1', 'Regulon - E2f2', 'Regulon - E2f3', 'Regulon - E2f4', 'Regulon - E2f5', 'Regulon - E2f6', 'Regulon - E2f7', 'Regulon - E2f8', 'Regulon - Egr3', 'Regulon - Egr4', 'Regulon - Ehf', 'Regulon - Elf1', 'Regulon - Elf2', 'Regulon - Elf4', 'Regulon - Elk1', 'Regulon - Elk3', 'Regulon - Elk4', 'Regulon - Emx1', 'Regulon - Emx2', 'Regulon - En1', 'Regulon - En2', 'Regulon - Eomes', 'Regulon - Ep300', 'Regulon - Erf', 'Regulon - Erg', 'Regulon - Esr1', 'Regulon - Esrra', 'Regulon - Esrrg', 'Regulon - Ets1', 'Regulon - Ets2', 'Regulon - Etv2', 'Regulon - Etv3', 'Regulon - Etv6', 'Regulon - Evx1', 'Regulon - Evx2', 'Regulon - Ezh2', 'Regulon - Ferd3l', 'Regulon - Fev', 'Regulon - Fezf2', 'Regulon - Figla', 'Regulon - Fli1', 'Regulon - Fosb', 'Regulon - Fosl2', 'Regulon - Foxa1', 'Regulon - Foxa2', 'Regulon - Foxa3', 'Regulon - Foxc1', 'Regulon - Foxc2', 'Regulon - Foxd1', 'Regulon - Foxd2', 'Regulon - Foxd3', 'Regulon - Foxf1', 'Regulon - Foxf2', 'Regulon - Foxi1', 'Regulon - Foxl2', 'Regulon - Foxn3', 'Regulon - Foxn4', 'Regulon - Foxo1', 'Regulon - Foxo3', 'Regulon - Foxo4', 'Regulon - Foxp1', 'Regulon - Foxp2', 'Regulon - Foxp4', 'Regulon - Gabpa', 'Regulon - Gabpb1', 'Regulon - Gata1', 'Regulon - Gata3', 'Regulon - Gata4', 'Regulon - Gata5', 'Regulon - Gata6', 'Regulon - Gbx1', 'Regulon - Gbx2', 'Regulon - Gcm2', 'Regulon - Gfi1', 'Regulon - Gli1', 'Regulon - Glis2', 'Regulon - Gm15446', 'Regulon - Gm20939', 'Regulon - Gm28047', 'Regulon - Gm28308', 'Regulon - Gm4767', 'Regulon - Gmeb1', 'Regulon - Gsc2', 'Regulon - Gsx1', 'Regulon - Gtf2a1l', 'Regulon - Gtf2b', 'Regulon - Gtf2f1', 'Regulon - Gtf2ird1', 'Regulon - Gtf3c2', 'Regulon - Hcfc1', 'Regulon - Hdac1', 'Regulon - Hdac2', 'Regulon - Hes1', 'Regulon - Hes6', 'Regulon - Hesx1', 'Regulon - Hivep1', 'Regulon - Hmgb3', 'Regulon - Hmgn3', 'Regulon - Hmx1', 'Regulon - Hmx2', 'Regulon - Hmx3', 'Regulon - Hnf4a', 'Regulon - Hoxa1', 'Regulon - Hoxa10', 'Regulon - Hoxa13', 'Regulon - Hoxa4', 'Regulon - Hoxa5', 'Regulon - Hoxa6', 'Regulon - Hoxa7', 'Regulon - Hoxa9', 'Regulon - Hoxb1', 'Regulon - Hoxb13', 'Regulon - Hoxb3', 'Regulon - Hoxb4', 'Regulon - Hoxb5', 'Regulon - Hoxb6', 'Regulon - Hoxb7', 'Regulon - Hoxb8', 'Regulon - Hoxb9', 'Regulon - Hoxc10', 'Regulon - Hoxc11', 'Regulon - Hoxc4', 'Regulon - Hoxc5', 'Regulon - Hoxc6', 'Regulon - Hoxc8', 'Regulon - Hoxc9', 'Regulon - Hoxd10', 'Regulon - Hoxd11', 'Regulon - Hoxd3', 'Regulon - Hoxd8', 'Regulon - Hoxd9', 'Regulon - Hsf1', 'Regulon - Hsf2', 'Regulon - Hsf4', 'Regulon - Ikzf5', 'Regulon - Irf1', 'Regulon - Irf2', 'Regulon - Irf3', 'Regulon - Irf5', 'Regulon - Irf8', 'Regulon - Irf9', 'Regulon - Irx2', 'Regulon - Irx3', 'Regulon - Irx6', 'Regulon - Isx', 'Regulon - Jun', 'Regulon - Junb', 'Regulon - Jund', 'Regulon - Kdm5a', 'Regulon - Klf1', 'Regulon - Klf10', 'Regulon - Klf13', 'Regulon - Klf2', 'Regulon - Klf3', 'Regulon - Klf6', 'Regulon - Klf7', 'Regulon - Klf8', 'Regulon - Lbx1', 'Regulon - Lhx1', 'Regulon - Lhx2', 'Regulon - Lhx3', 'Regulon - Lhx4', 'Regulon - Lhx5', 'Regulon - Lhx6', 'Regulon - Lhx8', 'Regulon - Lhx9', 'Regulon - Lmo2', 'Regulon - Lmx1a', 'Regulon - Lmx1b', 'Regulon - Ltf', 'Regulon - Maf', 'Regulon - Mafa', 'Regulon - Mafb', 'Regulon - Max', 'Regulon - Maz', 'Regulon - Mbd1', 'Regulon - Mbd4', 'Regulon - Mef2a', 'Regulon - Mef2b', 'Regulon - Mef2c', 'Regulon - Mef2d', 'Regulon - Meis1', 'Regulon - Meis3', 'Regulon - Meox2', 'Regulon - Mesp2', 'Regulon - Mitf', 'Regulon - Mlx', 'Regulon - Mnx1', 'Regulon - Msc', 'Regulon - Msx2', 'Regulon - Msx3', 'Regulon - Mta3', 'Regulon - Mtf1', 'Regulon - Mxd3', 'Regulon - Mxi1', 'Regulon - Myb', 'Regulon - Mybl2', 'Regulon - Myc', 'Regulon - Mycn', 'Regulon - Myf6', 'Regulon - Myod1', 'Regulon - Nelfe', 'Regulon - Neurod1', 'Regulon - Neurod2', 'Regulon - Neurog1', 'Regulon - Nfat5', 'Regulon - Nfatc3', 'Regulon - Nfatc4', 'Regulon - Nfe2', 'Regulon - Nfib', 'Regulon - Nfic', 'Regulon - Nfil3', 'Regulon - Nfyb', 'Regulon - Nhlh1', 'Regulon - Nkx1-2', 'Regulon - Nkx2-9', 'Regulon - Nkx3-2', 'Regulon - Nkx6-1', 'Regulon - Noto', 'Regulon - Npdc1', 'Regulon - Nr1h5', 'Regulon - Nr1i3', 'Regulon - Nr2c1', 'Regulon - Nr2c2', 'Regulon - Nr2f6', 'Regulon - Nr5a2', 'Regulon - Nrf1', 'Regulon - Nuak2', 'Regulon - Onecut1', 'Regulon - Onecut2', 'Regulon - Onecut3', 'Regulon - Otp', 'Regulon - Patz1', 'Regulon - Pax3', 'Regulon - Pax5', 'Regulon - Pax6', 'Regulon - Pax7', 'Regulon - Pax8', 'Regulon - Pbx1', 'Regulon - Pbx3', 'Regulon - Pdx1', 'Regulon - Phf8', 'Regulon - Phox2a', 'Regulon - Phox2b', 'Regulon - Pknox1', 'Regulon - Pknox2', 'Regulon - Plg', 'Regulon - Pole3', 'Regulon - Polr3a', 'Regulon - Polr3g', 'Regulon - Pou1f1', 'Regulon - Pou2f1', 'Regulon - Pou2f3', 'Regulon - Pou3f1', 'Regulon - Pou3f2', 'Regulon - Pou3f3', 'Regulon - Pou4f1', 'Regulon - Pou4f2', 'Regulon - Pou4f3', 'Regulon - Pou5f1', 'Regulon - Ppargc1a', 'Regulon - Prop1', 'Regulon - Prrx1', 'Regulon - Prrx2', 'Regulon - Prrxl1', 'Regulon - Psmd12', 'Regulon - Rad21', 'Regulon - Rara', 'Regulon - Rbbp5', 'Regulon - Rcor1', 'Regulon - Rel', 'Regulon - Rela', 'Regulon - Relb', 'Regulon - Rest', 'Regulon - Rfx3', 'Regulon - Rfx5', 'Regulon - Rfxap', 'Regulon - Rorc', 'Regulon - Rreb1', 'Regulon - Runx1', 'Regulon - Runx3', 'Regulon - Rxra', 'Regulon - Rxrb', 'Regulon - Rxrg', 'Regulon - Sap30', 'Regulon - Shox2', 'Regulon - Sin3a', 'Regulon - Six1', 'Regulon - Six2', 'Regulon - Six3', 'Regulon - Six4', 'Regulon - Six5', 'Regulon - Smad1', 'Regulon - Smarca4', 'Regulon - Snai3', 'Regulon - Sox1', 'Regulon - Sox10', 'Regulon - Sox11', 'Regulon - Sox12', 'Regulon - Sox13', 'Regulon - Sox14', 'Regulon - Sox15', 'Regulon - Sox17', 'Regulon - Sox2', 'Regulon - Sox21', 'Regulon - Sox3', 'Regulon - Sox4', 'Regulon - Sox5', 'Regulon - Sox9', 'Regulon - Sp1', 'Regulon - Sp2', 'Regulon - Sp3', 'Regulon - Sp8', 'Regulon - Sp9', 'Regulon - Spdef', 'Regulon - Spi1', 'Regulon - Spic', 'Regulon - Srebf1', 'Regulon - Srebf2', 'Regulon - Srf', 'Regulon - Stat1', 'Regulon - Stat3', 'Regulon - Stat5a', 'Regulon - Stat5b', 'Regulon - Supt20', 'Regulon - Suz12', 'Regulon - T', 'Regulon - Taf1', 'Regulon - Taf7', 'Regulon - Tagln2', 'Regulon - Tal1', 'Regulon - Tbl1xr1', 'Regulon - Tbp', 'Regulon - Tbpl1', 'Regulon - Tbx15', 'Regulon - Tbx2', 'Regulon - Tbx3', 'Regulon - Tbx5', 'Regulon - Tcf12', 'Regulon - Tcf15', 'Regulon - Tcf3', 'Regulon - Tcf4', 'Regulon - Tcf7', 'Regulon - Tcf7l1', 'Regulon - Tcf7l2', 'Regulon - Tead2', 'Regulon - Tead4', 'Regulon - Tfap2a', 'Regulon - Tfap4', 'Regulon - Tfdp1', 'Regulon - Tfdp2', 'Regulon - Tfe3', 'Regulon - Tgif1', 'Regulon - Thap1', 'Regulon - Thap11', 'Regulon - Thap12', 'Regulon - Thra', 'Regulon - Tlx2', 'Regulon - Tlx3', 'Regulon - Tmem33', 'Regulon - Twist1', 'Regulon - Ubtf', 'Regulon - Uncx', 'Regulon - Usf1', 'Regulon - Usf2', 'Regulon - Vax1', 'Regulon - Vdr', 'Regulon - Vezf1', 'Regulon - Vsx1', 'Regulon - Vsx2', 'Regulon - Wt1', 'Regulon - Xbp1', 'Regulon - Xrcc4', 'Regulon - Ybx1', 'Regulon - Yy1', 'Regulon - Zeb1', 'Regulon - Zfhx3', 'Regulon - Zfp105', 'Regulon - Zfp110', 'Regulon - Zfp148', 'Regulon - Zfp160', 'Regulon - Zfp184', 'Regulon - Zfp2', 'Regulon - Zfp235', 'Regulon - Zfp263', 'Regulon - Zfp266', 'Regulon - Zfp275', 'Regulon - Zfp319', 'Regulon - Zfp35', 'Regulon - Zfp358', 'Regulon - Zfp369', 'Regulon - Zfp410', 'Regulon - Zfp426', 'Regulon - Zfp442', 'Regulon - Zfp444', 'Regulon - Zfp46', 'Regulon - Zfp467', 'Regulon - Zfp523', 'Regulon - Zfp524', 'Regulon - Zfp560', 'Regulon - Zfp64', 'Regulon - Zfp655', 'Regulon - Zfp712', 'Regulon - Zfp729a', 'Regulon - Zfp775', 'Regulon - Zfp91', 'Regulon - Zfp930', 'Regulon - Zfp951', 'Regulon - Zfp958', 'Regulon - Zfp961', 'Regulon - Zfp966', 'Regulon - Zhx3', 'Regulon - Zic1', 'Regulon - Zic5', 'Regulon - Zmiz1', 'Regulon - Zscan12', 'Regulon - Zscan2', 'Module_1', 'Module_2', 'Module_3', 'Module_4', 'Module_5', 'Module_6', 'Module_7', 'Module_8', 'Module_9', 'Module_10', 'Module_11', 'Module_12', 'Module_13', 'Module_14', 'Module_15', 'Module_16', 'Module_17', 'Module_18', 'Module_19', 'Module_20', 'pct_counts_in_top_50_genes', 'pct_counts_in_top_100_genes', 'pct_counts_in_top_200_genes', 'pct_counts_in_top_500_genes'
    var: 'n_cells', 'n_cells_by_counts', 'mean_counts', 'log1p_mean_counts', 'pct_dropout_by_counts', 'total_counts', 'log1p_total_counts', 'Regulon - 1700009N14Rik', 'Regulon - 2610044O15Rik8', 'Regulon - Abcf2', 'Regulon - Alx3', 'Regulon - Arid3c', 'Regulon - Atf3', 'Regulon - Atf4', 'Regulon - Atoh1', 'Regulon - Bclaf1', 'Regulon - Borcs8', 'Regulon - Brf1', 'Regulon - Cebpa', 'Regulon - Cebpb', 'Regulon - Cebpd', 'Regulon - Cebpg', 'Regulon - Clock', 'Regulon - Creb1', 'Regulon - Crebzf', 'Regulon - Cux1', 'Regulon - Dlx2', 'Regulon - Dlx5', 'Regulon - E2f1', 'Regulon - E2f2', 'Regulon - E2f3', 'Regulon - E2f4', 'Regulon - E2f5', 'Regulon - E2f7', 'Regulon - E2f8', 'Regulon - Egr4', 'Regulon - Elf1', 'Regulon - Elf2', 'Regulon - Elk3', 'Regulon - Elk4', 'Regulon - Emx1', 'Regulon - En1', 'Regulon - Erg', 'Regulon - Esr1', 'Regulon - Ets1', 'Regulon - Ets2', 'Regulon - Etv2', 'Regulon - Evx1', 'Regulon - Ezh2', 'Regulon - Fev', 'Regulon - Fezf2', 'Regulon - Figla', 'Regulon - Fosl2', 'Regulon - Foxa1', 'Regulon - Foxa2', 'Regulon - Foxa3', 'Regulon - Foxc1', 'Regulon - Foxc2', 'Regulon - Foxd1', 'Regulon - Foxd3', 'Regulon - Foxf1', 'Regulon - Foxf2', 'Regulon - Foxi1', 'Regulon - Foxn3', 'Regulon - Foxn4', 'Regulon - Foxo4', 'Regulon - Foxp1', 'Regulon - Foxp2', 'Regulon - Foxp4', 'Regulon - Gabpa', 'Regulon - Gata1', 'Regulon - Gata3', 'Regulon - Gata4', 'Regulon - Gata5', 'Regulon - Gata6', 'Regulon - Gbx2', 'Regulon - Gcm2', 'Regulon - Gsx1', 'Regulon - Gtf2a1l', 'Regulon - Gtf2b', 'Regulon - Hdac1', 'Regulon - Hivep1', 'Regulon - Hmx2', 'Regulon - Hnf4a', 'Regulon - Hoxa10', 'Regulon - Hoxa13', 'Regulon - Hoxa4', 'Regulon - Hoxa5', 'Regulon - Hoxa6', 'Regulon - Hoxa7', 'Regulon - Hoxa9', 'Regulon - Hoxb4', 'Regulon - Hoxb5', 'Regulon - Hoxb6', 'Regulon - Hoxb7', 'Regulon - Hoxb8', 'Regulon - Hoxb9', 'Regulon - Hoxc10', 'Regulon - Hoxc11', 'Regulon - Hoxc4', 'Regulon - Hoxc5', 'Regulon - Hoxc6', 'Regulon - Hoxc9', 'Regulon - Hoxd10', 'Regulon - Hoxd3', 'Regulon - Hoxd8', 'Regulon - Hoxd9', 'Regulon - Ikzf5', 'Regulon - Irf2', 'Regulon - Irf3', 'Regulon - Irf5', 'Regulon - Irf8', 'Regulon - Irx3', 'Regulon - Jund', 'Regulon - Klf1', 'Regulon - Klf2', 'Regulon - Klf3', 'Regulon - Klf6', 'Regulon - Klf7', 'Regulon - Klf8', 'Regulon - Lbx1', 'Regulon - Lhx1', 'Regulon - Lhx2', 'Regulon - Lhx4', 'Regulon - Lhx5', 'Regulon - Lhx6', 'Regulon - Lmx1b', 'Regulon - Ltf', 'Regulon - Max', 'Regulon - Mbd1', 'Regulon - Mef2a', 'Regulon - Mef2c', 'Regulon - Mef2d', 'Regulon - Mlx', 'Regulon - Mnx1', 'Regulon - Msc', 'Regulon - Msx2', 'Regulon - Mtf1', 'Regulon - Mxd3', 'Regulon - Mybl2', 'Regulon - Myc', 'Regulon - Mycn', 'Regulon - Neurod1', 'Regulon - Neurog1', 'Regulon - Nfat5', 'Regulon - Nfatc4', 'Regulon - Nfe2', 'Regulon - Nfic', 'Regulon - Nkx1-2', 'Regulon - Nkx2-9', 'Regulon - Nkx3-2', 'Regulon - Nr5a2', 'Regulon - Onecut1', 'Regulon - Onecut3', 'Regulon - Otp', 'Regulon - Patz1', 'Regulon - Pbx1', 'Regulon - Pbx3', 'Regulon - Phf8', 'Regulon - Phox2a', 'Regulon - Phox2b', 'Regulon - Polr3a', 'Regulon - Pou1f1', 'Regulon - Pou3f1', 'Regulon - Pou3f2', 'Regulon - Pou3f3', 'Regulon - Pou4f3', 'Regulon - Pou5f1', 'Regulon - Prrxl1', 'Regulon - Rara', 'Regulon - Rbbp5', 'Regulon - Rela', 'Regulon - Rest', 'Regulon - Rfx3', 'Regulon - Rorc', 'Regulon - Runx1', 'Regulon - Runx3', 'Regulon - Rxra', 'Regulon - Sap30', 'Regulon - Six2', 'Regulon - Smad1', 'Regulon - Smarca4', 'Regulon - Snai3', 'Regulon - Sox10', 'Regulon - Sox11', 'Regulon - Sox15', 'Regulon - Sox2', 'Regulon - Sox21', 'Regulon - Sox3', 'Regulon - Sox4', 'Regulon - Sox5', 'Regulon - Sox9', 'Regulon - Sp1', 'Regulon - Sp2', 'Regulon - Spdef', 'Regulon - Spi1', 'Regulon - Srebf1', 'Regulon - Srebf2', 'Regulon - Srf', 'Regulon - Stat3', 'Regulon - T', 'Regulon - Taf1', 'Regulon - Taf7', 'Regulon - Tagln2', 'Regulon - Tal1', 'Regulon - Tbp', 'Regulon - Tbpl1', 'Regulon - Tcf3', 'Regulon - Tcf7', 'Regulon - Tcf7l2', 'Regulon - Tead2', 'Regulon - Tead4', 'Regulon - Tfap4', 'Regulon - Tfdp1', 'Regulon - Tfdp2', 'Regulon - Tfe3', 'Regulon - Tgif1', 'Regulon - Thap1', 'Regulon - Thap12', 'Regulon - Thra', 'Regulon - Tlx2', 'Regulon - Tlx3', 'Regulon - Twist1', 'Regulon - Uncx', 'Regulon - Usf2', 'Regulon - Vdr', 'Regulon - Vsx1', 'Regulon - Wt1', 'Regulon - Yy1', 'Regulon - Zfp105', 'Regulon - Zfp2', 'Regulon - Zfp266', 'Regulon - Zfp319', 'Regulon - Zfp358', 'Regulon - Zfp410', 'Regulon - Zfp426', 'Regulon - Zfp442', 'Regulon - Zfp523', 'Regulon - Zfp560', 'Regulon - Zfp729a', 'Regulon - Zfp91', 'Regulon - Zfp966', 'Regulon - Zhx3', 'Regulon - Zscan12', 'Module_1', 'Module_10', 'Module_11', 'Module_12', 'Module_13', 'Module_14', 'Module_15', 'Module_16', 'Module_17', 'Module_18', 'Module_19', 'Module_2', 'Module_20', 'Module_3', 'Module_4', 'Module_5', 'Module_6', 'Module_7', 'Module_8', 'Module_9'
    uns: 'annotation_colors'
    obsm: 'spatial'
    varm: 'PCs'
    layers: 'count'

Create directory for pretrained model

[6]:
save_path='./results_save/'
section_id = 'mouse_embryos_E10.5_E1S3'
mk_dir(save_path,section_id)

Training the model

STGMVA aims to learn the representations by two-step process. First, pretrained the GMM clustering model. Second, discerned the spatial domains for spatial transcriptomics data.

After model training, the learned representations will be saved in adata.obsm[‘embedding’], and can be used for spatial clustering.

[7]:
model = STGMMVE(adata, datatype = "Stereo", nCluster=16,save_path=save_path, section_id=section_id)

# model.pretrain() # Train your own pretranined model or use the pretrained model we provided.

adata_res = model.train_cluster()

/home/tengliu/miniconda3/envs/Torch_pyG2.0/lib/python3.9/site-packages/scanpy/preprocessing/_highly_variable_genes.py:62: UserWarning: `flavor='seurat_v3'` expects raw count data, but non-integers were found.
  warnings.warn(
Graph constructed!
R[write to console]:                    __           __
   ____ ___  _____/ /_  _______/ /_
  / __ `__ \/ ___/ / / / / ___/ __/
 / / / / / / /__/ / /_/ (__  ) /_
/_/ /_/ /_/\___/_/\__,_/____/\__/   version 5.4.10
Type 'citation("mclust")' for citing this R package in publications.

fitting ...
  |======================================================================| 100%
  0%|          | 0/50 [01:59<?, ?it/s]
Epoch: 0
NMI=0.696584, ARI=0.699695
Loss=94.2251,  ELBO Loss=148.2846
 10%|█         | 5/50 [08:26<1:01:22, 81.82s/it]
Epoch: 5
NMI=0.681753, ARI=0.689614
Loss=95.7493,  ELBO Loss=128.3573
 20%|██        | 10/50 [15:58<57:12, 85.81s/it]
Epoch: 10
NMI=0.659111, ARI=0.546236
Loss=96.4591,  ELBO Loss=119.0897
 30%|███       | 15/50 [21:03<38:33, 66.11s/it]
Epoch: 15
NMI=0.642345, ARI=0.509034
Loss=95.9216,  ELBO Loss=113.5577
 40%|████      | 20/50 [26:20<28:15, 56.51s/it]
Epoch: 20
NMI=0.646638, ARI=0.519938
Loss=96.1766,  ELBO Loss=111.2885
 50%|█████     | 25/50 [31:04<27:29, 65.97s/it]
Epoch: 25
NMI=0.650247, ARI=0.521339
Loss=95.8255,  ELBO Loss=109.6407
 60%|██████    | 30/50 [36:08<17:57, 53.89s/it]
Epoch: 30
NMI=0.666027, ARI=0.541878
Loss=95.6419,  ELBO Loss=108.8884
 70%|███████   | 35/50 [40:36<15:39, 62.65s/it]
Epoch: 35
NMI=0.662663, ARI=0.579486
Loss=95.1746,  ELBO Loss=108.1149
 80%|████████  | 40/50 [46:22<09:32, 57.22s/it]
Epoch: 40
NMI=0.654593, ARI=0.525815
Loss=94.9800,  ELBO Loss=107.6886
 90%|█████████ | 45/50 [51:28<05:51, 70.20s/it]
Epoch: 45
NMI=0.650165, ARI=0.495332
Loss=94.9545,  ELBO Loss=107.5706
100%|██████████| 50/50 [55:43<00:00, 66.87s/it]
[8]:
adata_res
[8]:
AnnData object with n_obs × n_vars = 18670 × 25647
    obs: 'n_genes_by_counts', 'log1p_n_genes_by_counts', 'total_counts', 'log1p_total_counts', 'annotation', 'spatial_leiden_res4', 'Regulon - 1700009N14Rik', 'Regulon - 2610044O15Rik8', 'Regulon - AU041133', 'Regulon - Abcf2', 'Regulon - Alx1', 'Regulon - Alx3', 'Regulon - Arid3a', 'Regulon - Arid3c', 'Regulon - Arnt', 'Regulon - Arx', 'Regulon - Atf1', 'Regulon - Atf2', 'Regulon - Atf3', 'Regulon - Atf4', 'Regulon - Atf6', 'Regulon - Atoh1', 'Regulon - Barhl1', 'Regulon - Barhl2', 'Regulon - Bcl11a', 'Regulon - Bclaf1', 'Regulon - Bdp1', 'Regulon - Bhlhe22', 'Regulon - Bhlhe41', 'Regulon - Bmyc', 'Regulon - Borcs8', 'Regulon - Brf1', 'Regulon - Brf2', 'Regulon - Cebpa', 'Regulon - Cebpb', 'Regulon - Cebpd', 'Regulon - Cebpe', 'Regulon - Cebpg', 'Regulon - Chd1', 'Regulon - Clock', 'Regulon - Cnot3', 'Regulon - Creb1', 'Regulon - Creb3', 'Regulon - Creb3l1', 'Regulon - Crebzf', 'Regulon - Crem', 'Regulon - Crx', 'Regulon - Ctcf', 'Regulon - Cux1', 'Regulon - D3Ertd254e', 'Regulon - Dbx2', 'Regulon - Dlx2', 'Regulon - Dlx5', 'Regulon - Dlx6', 'Regulon - Dmrt3', 'Regulon - Dmrta2', 'Regulon - E2f1', 'Regulon - E2f2', 'Regulon - E2f3', 'Regulon - E2f4', 'Regulon - E2f5', 'Regulon - E2f6', 'Regulon - E2f7', 'Regulon - E2f8', 'Regulon - Egr3', 'Regulon - Egr4', 'Regulon - Ehf', 'Regulon - Elf1', 'Regulon - Elf2', 'Regulon - Elf4', 'Regulon - Elk1', 'Regulon - Elk3', 'Regulon - Elk4', 'Regulon - Emx1', 'Regulon - Emx2', 'Regulon - En1', 'Regulon - En2', 'Regulon - Eomes', 'Regulon - Ep300', 'Regulon - Erf', 'Regulon - Erg', 'Regulon - Esr1', 'Regulon - Esrra', 'Regulon - Esrrg', 'Regulon - Ets1', 'Regulon - Ets2', 'Regulon - Etv2', 'Regulon - Etv3', 'Regulon - Etv6', 'Regulon - Evx1', 'Regulon - Evx2', 'Regulon - Ezh2', 'Regulon - Ferd3l', 'Regulon - Fev', 'Regulon - Fezf2', 'Regulon - Figla', 'Regulon - Fli1', 'Regulon - Fosb', 'Regulon - Fosl2', 'Regulon - Foxa1', 'Regulon - Foxa2', 'Regulon - Foxa3', 'Regulon - Foxc1', 'Regulon - Foxc2', 'Regulon - Foxd1', 'Regulon - Foxd2', 'Regulon - Foxd3', 'Regulon - Foxf1', 'Regulon - Foxf2', 'Regulon - Foxi1', 'Regulon - Foxl2', 'Regulon - Foxn3', 'Regulon - Foxn4', 'Regulon - Foxo1', 'Regulon - Foxo3', 'Regulon - Foxo4', 'Regulon - Foxp1', 'Regulon - Foxp2', 'Regulon - Foxp4', 'Regulon - Gabpa', 'Regulon - Gabpb1', 'Regulon - Gata1', 'Regulon - Gata3', 'Regulon - Gata4', 'Regulon - Gata5', 'Regulon - Gata6', 'Regulon - Gbx1', 'Regulon - Gbx2', 'Regulon - Gcm2', 'Regulon - Gfi1', 'Regulon - Gli1', 'Regulon - Glis2', 'Regulon - Gm15446', 'Regulon - Gm20939', 'Regulon - Gm28047', 'Regulon - Gm28308', 'Regulon - Gm4767', 'Regulon - Gmeb1', 'Regulon - Gsc2', 'Regulon - Gsx1', 'Regulon - Gtf2a1l', 'Regulon - Gtf2b', 'Regulon - Gtf2f1', 'Regulon - Gtf2ird1', 'Regulon - Gtf3c2', 'Regulon - Hcfc1', 'Regulon - Hdac1', 'Regulon - Hdac2', 'Regulon - Hes1', 'Regulon - Hes6', 'Regulon - Hesx1', 'Regulon - Hivep1', 'Regulon - Hmgb3', 'Regulon - Hmgn3', 'Regulon - Hmx1', 'Regulon - Hmx2', 'Regulon - Hmx3', 'Regulon - Hnf4a', 'Regulon - Hoxa1', 'Regulon - Hoxa10', 'Regulon - Hoxa13', 'Regulon - Hoxa4', 'Regulon - Hoxa5', 'Regulon - Hoxa6', 'Regulon - Hoxa7', 'Regulon - Hoxa9', 'Regulon - Hoxb1', 'Regulon - Hoxb13', 'Regulon - Hoxb3', 'Regulon - Hoxb4', 'Regulon - Hoxb5', 'Regulon - Hoxb6', 'Regulon - Hoxb7', 'Regulon - Hoxb8', 'Regulon - Hoxb9', 'Regulon - Hoxc10', 'Regulon - Hoxc11', 'Regulon - Hoxc4', 'Regulon - Hoxc5', 'Regulon - Hoxc6', 'Regulon - Hoxc8', 'Regulon - Hoxc9', 'Regulon - Hoxd10', 'Regulon - Hoxd11', 'Regulon - Hoxd3', 'Regulon - Hoxd8', 'Regulon - Hoxd9', 'Regulon - Hsf1', 'Regulon - Hsf2', 'Regulon - Hsf4', 'Regulon - Ikzf5', 'Regulon - Irf1', 'Regulon - Irf2', 'Regulon - Irf3', 'Regulon - Irf5', 'Regulon - Irf8', 'Regulon - Irf9', 'Regulon - Irx2', 'Regulon - Irx3', 'Regulon - Irx6', 'Regulon - Isx', 'Regulon - Jun', 'Regulon - Junb', 'Regulon - Jund', 'Regulon - Kdm5a', 'Regulon - Klf1', 'Regulon - Klf10', 'Regulon - Klf13', 'Regulon - Klf2', 'Regulon - Klf3', 'Regulon - Klf6', 'Regulon - Klf7', 'Regulon - Klf8', 'Regulon - Lbx1', 'Regulon - Lhx1', 'Regulon - Lhx2', 'Regulon - Lhx3', 'Regulon - Lhx4', 'Regulon - Lhx5', 'Regulon - Lhx6', 'Regulon - Lhx8', 'Regulon - Lhx9', 'Regulon - Lmo2', 'Regulon - Lmx1a', 'Regulon - Lmx1b', 'Regulon - Ltf', 'Regulon - Maf', 'Regulon - Mafa', 'Regulon - Mafb', 'Regulon - Max', 'Regulon - Maz', 'Regulon - Mbd1', 'Regulon - Mbd4', 'Regulon - Mef2a', 'Regulon - Mef2b', 'Regulon - Mef2c', 'Regulon - Mef2d', 'Regulon - Meis1', 'Regulon - Meis3', 'Regulon - Meox2', 'Regulon - Mesp2', 'Regulon - Mitf', 'Regulon - Mlx', 'Regulon - Mnx1', 'Regulon - Msc', 'Regulon - Msx2', 'Regulon - Msx3', 'Regulon - Mta3', 'Regulon - Mtf1', 'Regulon - Mxd3', 'Regulon - Mxi1', 'Regulon - Myb', 'Regulon - Mybl2', 'Regulon - Myc', 'Regulon - Mycn', 'Regulon - Myf6', 'Regulon - Myod1', 'Regulon - Nelfe', 'Regulon - Neurod1', 'Regulon - Neurod2', 'Regulon - Neurog1', 'Regulon - Nfat5', 'Regulon - Nfatc3', 'Regulon - Nfatc4', 'Regulon - Nfe2', 'Regulon - Nfib', 'Regulon - Nfic', 'Regulon - Nfil3', 'Regulon - Nfyb', 'Regulon - Nhlh1', 'Regulon - Nkx1-2', 'Regulon - Nkx2-9', 'Regulon - Nkx3-2', 'Regulon - Nkx6-1', 'Regulon - Noto', 'Regulon - Npdc1', 'Regulon - Nr1h5', 'Regulon - Nr1i3', 'Regulon - Nr2c1', 'Regulon - Nr2c2', 'Regulon - Nr2f6', 'Regulon - Nr5a2', 'Regulon - Nrf1', 'Regulon - Nuak2', 'Regulon - Onecut1', 'Regulon - Onecut2', 'Regulon - Onecut3', 'Regulon - Otp', 'Regulon - Patz1', 'Regulon - Pax3', 'Regulon - Pax5', 'Regulon - Pax6', 'Regulon - Pax7', 'Regulon - Pax8', 'Regulon - Pbx1', 'Regulon - Pbx3', 'Regulon - Pdx1', 'Regulon - Phf8', 'Regulon - Phox2a', 'Regulon - Phox2b', 'Regulon - Pknox1', 'Regulon - Pknox2', 'Regulon - Plg', 'Regulon - Pole3', 'Regulon - Polr3a', 'Regulon - Polr3g', 'Regulon - Pou1f1', 'Regulon - Pou2f1', 'Regulon - Pou2f3', 'Regulon - Pou3f1', 'Regulon - Pou3f2', 'Regulon - Pou3f3', 'Regulon - Pou4f1', 'Regulon - Pou4f2', 'Regulon - Pou4f3', 'Regulon - Pou5f1', 'Regulon - Ppargc1a', 'Regulon - Prop1', 'Regulon - Prrx1', 'Regulon - Prrx2', 'Regulon - Prrxl1', 'Regulon - Psmd12', 'Regulon - Rad21', 'Regulon - Rara', 'Regulon - Rbbp5', 'Regulon - Rcor1', 'Regulon - Rel', 'Regulon - Rela', 'Regulon - Relb', 'Regulon - Rest', 'Regulon - Rfx3', 'Regulon - Rfx5', 'Regulon - Rfxap', 'Regulon - Rorc', 'Regulon - Rreb1', 'Regulon - Runx1', 'Regulon - Runx3', 'Regulon - Rxra', 'Regulon - Rxrb', 'Regulon - Rxrg', 'Regulon - Sap30', 'Regulon - Shox2', 'Regulon - Sin3a', 'Regulon - Six1', 'Regulon - Six2', 'Regulon - Six3', 'Regulon - Six4', 'Regulon - Six5', 'Regulon - Smad1', 'Regulon - Smarca4', 'Regulon - Snai3', 'Regulon - Sox1', 'Regulon - Sox10', 'Regulon - Sox11', 'Regulon - Sox12', 'Regulon - Sox13', 'Regulon - Sox14', 'Regulon - Sox15', 'Regulon - Sox17', 'Regulon - Sox2', 'Regulon - Sox21', 'Regulon - Sox3', 'Regulon - Sox4', 'Regulon - Sox5', 'Regulon - Sox9', 'Regulon - Sp1', 'Regulon - Sp2', 'Regulon - Sp3', 'Regulon - Sp8', 'Regulon - Sp9', 'Regulon - Spdef', 'Regulon - Spi1', 'Regulon - Spic', 'Regulon - Srebf1', 'Regulon - Srebf2', 'Regulon - Srf', 'Regulon - Stat1', 'Regulon - Stat3', 'Regulon - Stat5a', 'Regulon - Stat5b', 'Regulon - Supt20', 'Regulon - Suz12', 'Regulon - T', 'Regulon - Taf1', 'Regulon - Taf7', 'Regulon - Tagln2', 'Regulon - Tal1', 'Regulon - Tbl1xr1', 'Regulon - Tbp', 'Regulon - Tbpl1', 'Regulon - Tbx15', 'Regulon - Tbx2', 'Regulon - Tbx3', 'Regulon - Tbx5', 'Regulon - Tcf12', 'Regulon - Tcf15', 'Regulon - Tcf3', 'Regulon - Tcf4', 'Regulon - Tcf7', 'Regulon - Tcf7l1', 'Regulon - Tcf7l2', 'Regulon - Tead2', 'Regulon - Tead4', 'Regulon - Tfap2a', 'Regulon - Tfap4', 'Regulon - Tfdp1', 'Regulon - Tfdp2', 'Regulon - Tfe3', 'Regulon - Tgif1', 'Regulon - Thap1', 'Regulon - Thap11', 'Regulon - Thap12', 'Regulon - Thra', 'Regulon - Tlx2', 'Regulon - Tlx3', 'Regulon - Tmem33', 'Regulon - Twist1', 'Regulon - Ubtf', 'Regulon - Uncx', 'Regulon - Usf1', 'Regulon - Usf2', 'Regulon - Vax1', 'Regulon - Vdr', 'Regulon - Vezf1', 'Regulon - Vsx1', 'Regulon - Vsx2', 'Regulon - Wt1', 'Regulon - Xbp1', 'Regulon - Xrcc4', 'Regulon - Ybx1', 'Regulon - Yy1', 'Regulon - Zeb1', 'Regulon - Zfhx3', 'Regulon - Zfp105', 'Regulon - Zfp110', 'Regulon - Zfp148', 'Regulon - Zfp160', 'Regulon - Zfp184', 'Regulon - Zfp2', 'Regulon - Zfp235', 'Regulon - Zfp263', 'Regulon - Zfp266', 'Regulon - Zfp275', 'Regulon - Zfp319', 'Regulon - Zfp35', 'Regulon - Zfp358', 'Regulon - Zfp369', 'Regulon - Zfp410', 'Regulon - Zfp426', 'Regulon - Zfp442', 'Regulon - Zfp444', 'Regulon - Zfp46', 'Regulon - Zfp467', 'Regulon - Zfp523', 'Regulon - Zfp524', 'Regulon - Zfp560', 'Regulon - Zfp64', 'Regulon - Zfp655', 'Regulon - Zfp712', 'Regulon - Zfp729a', 'Regulon - Zfp775', 'Regulon - Zfp91', 'Regulon - Zfp930', 'Regulon - Zfp951', 'Regulon - Zfp958', 'Regulon - Zfp961', 'Regulon - Zfp966', 'Regulon - Zhx3', 'Regulon - Zic1', 'Regulon - Zic5', 'Regulon - Zmiz1', 'Regulon - Zscan12', 'Regulon - Zscan2', 'Module_1', 'Module_2', 'Module_3', 'Module_4', 'Module_5', 'Module_6', 'Module_7', 'Module_8', 'Module_9', 'Module_10', 'Module_11', 'Module_12', 'Module_13', 'Module_14', 'Module_15', 'Module_16', 'Module_17', 'Module_18', 'Module_19', 'Module_20', 'pct_counts_in_top_50_genes', 'pct_counts_in_top_100_genes', 'pct_counts_in_top_200_genes', 'pct_counts_in_top_500_genes', 'pre_label'
    var: 'n_cells', 'n_cells_by_counts', 'mean_counts', 'log1p_mean_counts', 'pct_dropout_by_counts', 'total_counts', 'log1p_total_counts', 'Regulon - 1700009N14Rik', 'Regulon - 2610044O15Rik8', 'Regulon - Abcf2', 'Regulon - Alx3', 'Regulon - Arid3c', 'Regulon - Atf3', 'Regulon - Atf4', 'Regulon - Atoh1', 'Regulon - Bclaf1', 'Regulon - Borcs8', 'Regulon - Brf1', 'Regulon - Cebpa', 'Regulon - Cebpb', 'Regulon - Cebpd', 'Regulon - Cebpg', 'Regulon - Clock', 'Regulon - Creb1', 'Regulon - Crebzf', 'Regulon - Cux1', 'Regulon - Dlx2', 'Regulon - Dlx5', 'Regulon - E2f1', 'Regulon - E2f2', 'Regulon - E2f3', 'Regulon - E2f4', 'Regulon - E2f5', 'Regulon - E2f7', 'Regulon - E2f8', 'Regulon - Egr4', 'Regulon - Elf1', 'Regulon - Elf2', 'Regulon - Elk3', 'Regulon - Elk4', 'Regulon - Emx1', 'Regulon - En1', 'Regulon - Erg', 'Regulon - Esr1', 'Regulon - Ets1', 'Regulon - Ets2', 'Regulon - Etv2', 'Regulon - Evx1', 'Regulon - Ezh2', 'Regulon - Fev', 'Regulon - Fezf2', 'Regulon - Figla', 'Regulon - Fosl2', 'Regulon - Foxa1', 'Regulon - Foxa2', 'Regulon - Foxa3', 'Regulon - Foxc1', 'Regulon - Foxc2', 'Regulon - Foxd1', 'Regulon - Foxd3', 'Regulon - Foxf1', 'Regulon - Foxf2', 'Regulon - Foxi1', 'Regulon - Foxn3', 'Regulon - Foxn4', 'Regulon - Foxo4', 'Regulon - Foxp1', 'Regulon - Foxp2', 'Regulon - Foxp4', 'Regulon - Gabpa', 'Regulon - Gata1', 'Regulon - Gata3', 'Regulon - Gata4', 'Regulon - Gata5', 'Regulon - Gata6', 'Regulon - Gbx2', 'Regulon - Gcm2', 'Regulon - Gsx1', 'Regulon - Gtf2a1l', 'Regulon - Gtf2b', 'Regulon - Hdac1', 'Regulon - Hivep1', 'Regulon - Hmx2', 'Regulon - Hnf4a', 'Regulon - Hoxa10', 'Regulon - Hoxa13', 'Regulon - Hoxa4', 'Regulon - Hoxa5', 'Regulon - Hoxa6', 'Regulon - Hoxa7', 'Regulon - Hoxa9', 'Regulon - Hoxb4', 'Regulon - Hoxb5', 'Regulon - Hoxb6', 'Regulon - Hoxb7', 'Regulon - Hoxb8', 'Regulon - Hoxb9', 'Regulon - Hoxc10', 'Regulon - Hoxc11', 'Regulon - Hoxc4', 'Regulon - Hoxc5', 'Regulon - Hoxc6', 'Regulon - Hoxc9', 'Regulon - Hoxd10', 'Regulon - Hoxd3', 'Regulon - Hoxd8', 'Regulon - Hoxd9', 'Regulon - Ikzf5', 'Regulon - Irf2', 'Regulon - Irf3', 'Regulon - Irf5', 'Regulon - Irf8', 'Regulon - Irx3', 'Regulon - Jund', 'Regulon - Klf1', 'Regulon - Klf2', 'Regulon - Klf3', 'Regulon - Klf6', 'Regulon - Klf7', 'Regulon - Klf8', 'Regulon - Lbx1', 'Regulon - Lhx1', 'Regulon - Lhx2', 'Regulon - Lhx4', 'Regulon - Lhx5', 'Regulon - Lhx6', 'Regulon - Lmx1b', 'Regulon - Ltf', 'Regulon - Max', 'Regulon - Mbd1', 'Regulon - Mef2a', 'Regulon - Mef2c', 'Regulon - Mef2d', 'Regulon - Mlx', 'Regulon - Mnx1', 'Regulon - Msc', 'Regulon - Msx2', 'Regulon - Mtf1', 'Regulon - Mxd3', 'Regulon - Mybl2', 'Regulon - Myc', 'Regulon - Mycn', 'Regulon - Neurod1', 'Regulon - Neurog1', 'Regulon - Nfat5', 'Regulon - Nfatc4', 'Regulon - Nfe2', 'Regulon - Nfic', 'Regulon - Nkx1-2', 'Regulon - Nkx2-9', 'Regulon - Nkx3-2', 'Regulon - Nr5a2', 'Regulon - Onecut1', 'Regulon - Onecut3', 'Regulon - Otp', 'Regulon - Patz1', 'Regulon - Pbx1', 'Regulon - Pbx3', 'Regulon - Phf8', 'Regulon - Phox2a', 'Regulon - Phox2b', 'Regulon - Polr3a', 'Regulon - Pou1f1', 'Regulon - Pou3f1', 'Regulon - Pou3f2', 'Regulon - Pou3f3', 'Regulon - Pou4f3', 'Regulon - Pou5f1', 'Regulon - Prrxl1', 'Regulon - Rara', 'Regulon - Rbbp5', 'Regulon - Rela', 'Regulon - Rest', 'Regulon - Rfx3', 'Regulon - Rorc', 'Regulon - Runx1', 'Regulon - Runx3', 'Regulon - Rxra', 'Regulon - Sap30', 'Regulon - Six2', 'Regulon - Smad1', 'Regulon - Smarca4', 'Regulon - Snai3', 'Regulon - Sox10', 'Regulon - Sox11', 'Regulon - Sox15', 'Regulon - Sox2', 'Regulon - Sox21', 'Regulon - Sox3', 'Regulon - Sox4', 'Regulon - Sox5', 'Regulon - Sox9', 'Regulon - Sp1', 'Regulon - Sp2', 'Regulon - Spdef', 'Regulon - Spi1', 'Regulon - Srebf1', 'Regulon - Srebf2', 'Regulon - Srf', 'Regulon - Stat3', 'Regulon - T', 'Regulon - Taf1', 'Regulon - Taf7', 'Regulon - Tagln2', 'Regulon - Tal1', 'Regulon - Tbp', 'Regulon - Tbpl1', 'Regulon - Tcf3', 'Regulon - Tcf7', 'Regulon - Tcf7l2', 'Regulon - Tead2', 'Regulon - Tead4', 'Regulon - Tfap4', 'Regulon - Tfdp1', 'Regulon - Tfdp2', 'Regulon - Tfe3', 'Regulon - Tgif1', 'Regulon - Thap1', 'Regulon - Thap12', 'Regulon - Thra', 'Regulon - Tlx2', 'Regulon - Tlx3', 'Regulon - Twist1', 'Regulon - Uncx', 'Regulon - Usf2', 'Regulon - Vdr', 'Regulon - Vsx1', 'Regulon - Wt1', 'Regulon - Yy1', 'Regulon - Zfp105', 'Regulon - Zfp2', 'Regulon - Zfp266', 'Regulon - Zfp319', 'Regulon - Zfp358', 'Regulon - Zfp410', 'Regulon - Zfp426', 'Regulon - Zfp442', 'Regulon - Zfp523', 'Regulon - Zfp560', 'Regulon - Zfp729a', 'Regulon - Zfp91', 'Regulon - Zfp966', 'Regulon - Zhx3', 'Regulon - Zscan12', 'Module_1', 'Module_10', 'Module_11', 'Module_12', 'Module_13', 'Module_14', 'Module_15', 'Module_16', 'Module_17', 'Module_18', 'Module_19', 'Module_2', 'Module_20', 'Module_3', 'Module_4', 'Module_5', 'Module_6', 'Module_7', 'Module_8', 'Module_9', 'highly_variable', 'highly_variable_rank', 'means', 'variances', 'variances_norm'
    uns: 'annotation_colors', 'hvg', 'log1p', 'mclust_labels', 'ari_list', 'loss'
    obsm: 'spatial', 'graph_neigh', 'adj', 'feat_mat', 'embedding'
    varm: 'PCs'
    layers: 'count'

Visualization

[1]:
import scanpy as sc
adata_res = sc.read_h5ad('/home/tengliu/Paper6-NC/STGMVA_Tutorials/mouse_embryo_E1S3.h5ad')
[4]:

sq.pl.spatial_scatter(adata_res, color=["annotation","pre_label"], size=15, figsize=(8,6),dpi=50, title=["Manual annotation",'STGMVA:' + ' ARI=%.4f'%np.max(adata_res.uns["ari_list"])], shape=None)
WARNING: Please specify a valid `library_id` or set it permanently in `adata.uns['spatial']`
/home/tengliu/miniconda3/envs/Torch_pyG2.0/lib/python3.9/site-packages/squidpy/pl/_spatial_utils.py:955: UserWarning: No data for colormapping provided via 'c'. Parameters 'cmap', 'norm' will be ignored
  _cax = scatter(
/home/tengliu/miniconda3/envs/Torch_pyG2.0/lib/python3.9/site-packages/squidpy/pl/_spatial_utils.py:955: UserWarning: No data for colormapping provided via 'c'. Parameters 'cmap', 'norm' will be ignored
  _cax = scatter(
_images/Tutorial_5_Stereo-seq-mouse_embryo_E10.5_E1S3_16_2.svg

Save the results for more figures

[12]:
adata_res.filename = './'+"mouse_embryo_E10.5_E1S3.h5ad"