DBS_PARAM = ' '.join(RANKING_DBS_FNAMES)
DBS_PARAM
'/Users/bramvandesande/Projects/lcb/protocol/auxilliaries/mm9-500bp-upstream-10species.mc9nr.feather /Users/bramvandesande/Projects/lcb/protocol/auxilliaries/mm9-tss-centered-10kb-10species.mc9nr.feather /Users/bramvandesande/Projects/lcb/protocol/auxilliaries/mm9-tss-centered-5kb-10species.mc9nr.feather'
ADJACENCIES_FNAME# 打\换行就可以了 官网30min 自己需要50min估计 线程可以改变
'/Users/bramvandesande/Projects/lcb/protocol/results/GSE60361.adjacencies.tsv'
!pyscenic ctx {ADJACENCIES_FNAME} {DBS_PARAM} \
--annotations_fname {MOTIF_ANNOTATIONS_FNAME} \
--expression_mtx_fname {COUNTS_QC_MTX_FNAME} \
--output {MOTIFS_FNAME} \
--num_workers 26
2021-07-15 02:37:04,065 - pyscenic.cli.pyscenic - INFO - Creating modules.
2021-07-15 02:37:05,853 - pyscenic.cli.pyscenic - INFO - Loading expression matrix.
2021-07-15 02:37:44,108 - pyscenic.utils - INFO - Calculating Pearson correlations.
2021-07-15 02:37:45,068 - pyscenic.utils - WARNING - Note on correlation calculation: the default behaviour for calculating the correlations has changed after pySCENIC verion 0.9.16. Previously, the default was to calculate the correlation between a TF and target gene using only cells with non-zero expression values (mask_dropouts=True). The current default is now to use all cells to match the behavior of the R verision of SCENIC. The original settings can be retained by setting 'rho_mask_dropouts=True' in the modules_from_adjacencies function, or '--mask_dropouts' from the CLI.
Dropout masking is currently set to [False].
2021-07-15 02:39:02,419 - pyscenic.utils - INFO - Creating modules.
2021-07-15 02:41:43,455 - pyscenic.cli.pyscenic - INFO - Loading databases.
2021-07-15 02:41:43,455 - pyscenic.cli.pyscenic - INFO - Calculating regulons.
[########################################] | 100% Completed | 26min 53.6s
2021-07-15 03:08:39,664 - pyscenic.cli.pyscenic - INFO - Writing results to file.
df_motifs = load_motifs(MOTIFS_FNAME)
def derive_regulons(motifs, db_names=('mm9-tss-centered-10kb-10species.mc9nr',
'mm9-500bp-upstream-10species.mc9nr',
'mm9-tss-centered-5kb-10species.mc9nr')):
motifs.columns = motifs.columns.droplevel(0)
def contains(*elems):
def f(context):
return any(elem in context for elem in elems)
return f
# For the creation of regulons we only keep the 10-species databases and the activating modules. We also remove the
# enriched motifs for the modules that were created using the method 'weight>50.0%' (because these modules are not part
# of the default settings of modules_from_adjacencies anymore.
motifs = motifs[
np.fromiter(map(compose(op.not_, contains('weight>50.0%')), motifs.Context), dtype=np.bool) & \
np.fromiter(map(contains(*db_names), motifs.Context), dtype=np.bool) & \
np.fromiter(map(contains('activating'), motifs.Context), dtype=np.bool)]
# We build regulons only using enriched motifs with a NES of 3.0 or higher; we take only directly annotated TFs or TF annotated
# for an orthologous gene into account; and we only keep regulons with at least 10 genes.
regulons = list(filter(lambda r: len(r) >= 10, df2regulons(motifs[(motifs['NES'] >= 3.0)
& ((motifs['Annotation'] == 'gene is directly annotated')
| (motifs['Annotation'].str.startswith('gene is orthologous to')
& motifs['Annotation'].str.endswith('which is directly annotated for motif')))
])))
# Rename regulons, i.e. remove suffix.
return list(map(lambda r: r.rename(r.transcription_factor), regulons))
regulons = derive_regulons(df_motifs)
/root/miniconda3/envs/scenic_protocol2/lib/python3.7/site-packages/ipykernel_launcher.py:16: DeprecationWarning: `np.bool` is a deprecated alias for the builtin `bool`. To silence this warning, use `bool` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.bool_` here.
Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
app.launch_new_instance()
/root/miniconda3/envs/scenic_protocol2/lib/python3.7/site-packages/ipykernel_launcher.py:17: DeprecationWarning: `np.bool` is a deprecated alias for the builtin `bool`. To silence this warning, use `bool` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.bool_` here.
Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
Create regulons from a dataframe of enriched features.
Additional columns saved: []
#help(derive_regulons)
#%%time?
with open(REGULONS_DAT_FNAME, 'wb') as f:
pickle.dump(regulons, f)
# Pickle these regulons. with open(REGULONS_DAT_FNAME, 'wb') as f: pickle.dump(regulons, f)
#AUCELL df_counts是前述的表达矩阵 狗日的写错了代码
%time
auc_mtx = aucell(df_counts, regulons, num_workers=32)
auc_mtx.to_csv(AUCELL_MTX_FNAME)
CPU times: user 12 µs, sys: 1e+03 ns, total: 13 µs
Wall time: 26 µs
Less than 80% of the genes in 1810024B03Rik are present in the expression matrix.
Less than 80% of the genes in Atf4 are present in the expression matrix.
Less than 80% of the genes in AI987944 are present in the expression matrix.
Less than 80% of the genes in Cebpb are present in the expression matrix.
Less than 80% of the genes in Atf6 are present in the expression matrix.
Less than 80% of the genes in Dbp are present in the expression matrix.
Less than 80% of the genes in Atf6b are present in the expression matrix.
Less than 80% of the genes in Cebpd are present in the expression matrix.
Less than 80% of the genes in Aire are present in the expression matrix.
Less than 80% of the genes in E2f3 are present in the expression matrix.
Less than 80% of the genes in Cebpz are present in the expression matrix.
Less than 80% of the genes in Atf7 are present in the expression matrix.
Less than 80% of the genes in Deaf1 are present in the expression matrix.
Less than 80% of the genes in Alx1 are present in the expression matrix.
Less than 80% of the genes in Elf4 are present in the expression matrix.
Less than 80% of the genes in Bcl3 are present in the expression matrix.
Less than 80% of the genes in Cers4 are present in the expression matrix.
Less than 80% of the genes in E2f6 are present in the expression matrix.
Less than 80% of the genes in Dlx1 are present in the expression matrix.
Less than 80% of the genes in Esrrb are present in the expression matrix.
Less than 80% of the genes in Chd2 are present in the expression matrix.
Less than 80% of the genes in Bhlhe40 are present in the expression matrix.
Less than 80% of the genes in Elk3 are present in the expression matrix.
Less than 80% of the genes in Arnt are present in the expression matrix.
Less than 80% of the genes in E2f7 are present in the expression matrix.
Less than 80% of the genes in Dlx2 are present in the expression matrix.
Less than 80% of the genes in Creb1 are present in the expression matrix.
Less than 80% of the genes in Brf1 are present in the expression matrix.
Less than 80% of the genes in Foxc2 are present in the expression matrix.
Less than 80% of the genes in Elk4 are present in the expression matrix.
Less than 80% of the genes in Dlx5 are present in the expression matrix.
Less than 80% of the genes in E2f8 are present in the expression matrix.
Less than 80% of the genes in Arnt2 are present in the expression matrix.
Less than 80% of the genes in Ets1 are present in the expression matrix.
Less than 80% of the genes in Gata6 are present in the expression matrix.
Less than 80% of the genes in Crx are present in the expression matrix.
Less than 80% of the genes in En1 are present in the expression matrix.
Less than 80% of the genes in Cdx1 are present in the expression matrix.
Less than 80% of the genes in Ebf1 are present in the expression matrix.
Less than 80% of the genes in Dlx6 are present in the expression matrix.
Less than 80% of the genes in Ets2 are present in the expression matrix.
Less than 80% of the genes in Arntl are present in the expression matrix.
Less than 80% of the genes in Foxn2 are present in the expression matrix.
Less than 80% of the genes in Ctcfl are present in the expression matrix.
Less than 80% of the genes in Hlf are present in the expression matrix.
Less than 80% of the genes in Cebpa are present in the expression matrix.
Less than 80% of the genes in En2 are present in the expression matrix.
Less than 80% of the genes in Egr1 are present in the expression matrix.
Less than 80% of the genes in Dmrta2 are present in the expression matrix.
Less than 80% of the genes in Atf2 are present in the expression matrix.
Less than 80% of the genes in Foxo1 are present in the expression matrix.
Less than 80% of the genes in Ikzf1 are present in the expression matrix.
Less than 80% of the genes in Cux1 are present in the expression matrix.
Less than 80% of the genes in Ezh2 are present in the expression matrix.
Less than 80% of the genes in Egr3 are present in the expression matrix.
Less than 80% of the genes in Gcm1 are present in the expression matrix.
Less than 80% of the genes in E2f1 are present in the expression matrix.
Less than 80% of the genes in Hnf1a are present in the expression matrix.
Less than 80% of the genes in Atf3 are present in the expression matrix.
Less than 80% of the genes in Erg are present in the expression matrix.
Less than 80% of the genes in Irf9 are present in the expression matrix.
Less than 80% of the genes in Ikzf2 are present in the expression matrix.
Less than 80% of the genes in E2f2 are present in the expression matrix.
Less than 80% of the genes in Egr4 are present in the expression matrix.
Less than 80% of the genes in Hnf4a are present in the expression matrix.
Less than 80% of the genes in Figla are present in the expression matrix.
Less than 80% of the genes in Gli1 are present in the expression matrix.
Less than 80% of the genes in Foxp3 are present in the expression matrix.
Less than 80% of the genes in Klf2 are present in the expression matrix.
Less than 80% of the genes in Irf1 are present in the expression matrix.
Less than 80% of the genes in Foxr1 are present in the expression matrix.
Less than 80% of the genes in Homez are present in the expression matrix.
Less than 80% of the genes in Elf1 are present in the expression matrix.
Less than 80% of the genes in Esr1 are present in the expression matrix.
Less than 80% of the genes in Glis2 are present in the expression matrix.
Less than 80% of the genes in Irx5 are present in the expression matrix.
Less than 80% of the genes in Fli1 are present in the expression matrix.
Less than 80% of the genes in Mef2a are present in the expression matrix.
Less than 80% of the genes in Irf2 are present in the expression matrix.
Less than 80% of the genes in Hoxa7 are present in the expression matrix.
Less than 80% of the genes in Klf4 are present in the expression matrix.
Less than 80% of the genes in Gabpa are present in the expression matrix.
Less than 80% of the genes in Irf3 are present in the expression matrix.
Less than 80% of the genes in Myf6 are present in the expression matrix.
Less than 80% of the genes in Klf6 are present in the expression matrix.
Less than 80% of the genes in Gm14403 are present in the expression matrix.
Less than 80% of the genes in Jdp2 are present in the expression matrix.
Less than 80% of the genes in Mef2b are present in the expression matrix.
Less than 80% of the genes in Esrp1 are present in the expression matrix.
Less than 80% of the genes in Nfkb1 are present in the expression matrix.
Less than 80% of the genes in Hoxa9 are present in the expression matrix.
Less than 80% of the genes in Gabpb1 are present in the expression matrix.
Less than 80% of the genes in Fos are present in the expression matrix.
Less than 80% of the genes in Lef1 are present in the expression matrix.
Less than 80% of the genes in Myod1 are present in the expression matrix.
Less than 80% of the genes in Irf4 are present in the expression matrix.
Less than 80% of the genes in Gmeb2 are present in the expression matrix.
Less than 80% of the genes in Mef2c are present in the expression matrix.
Less than 80% of the genes in Jun are present in the expression matrix.
Less than 80% of the genes in Nr2f6 are present in the expression matrix.
Less than 80% of the genes in Lhx2 are present in the expression matrix.
Less than 80% of the genes in Neurod2 are present in the expression matrix.
Less than 80% of the genes in Irf5 are present in the expression matrix.
Less than 80% of the genes in Nfkb2 are present in the expression matrix.
Less than 80% of the genes in Gtf2f1 are present in the expression matrix.
Less than 80% of the genes in Gata2 are present in the expression matrix.
Less than 80% of the genes in Fosb are present in the expression matrix.
Less than 80% of the genes in Esrra are present in the expression matrix.
Less than 80% of the genes in Hoxb3 are present in the expression matrix.
Less than 80% of the genes in Nkx1-2 are present in the expression matrix.
Less than 80% of the genes in Lhx9 are present in the expression matrix.
Less than 80% of the genes in Irf7 are present in the expression matrix.
Less than 80% of the genes in Nfatc1 are present in the expression matrix.
Less than 80% of the genes in Nr3c1 are present in the expression matrix.
Less than 80% of the genes in Mef2d are present in the expression matrix.
Less than 80% of the genes in Pax5 are present in the expression matrix.
Less than 80% of the genes in Helt are present in the expression matrix.
Less than 80% of the genes in Gata3 are present in the expression matrix.
Less than 80% of the genes in Fosl2 are present in the expression matrix.
Less than 80% of the genes in Junb are present in the expression matrix.
Less than 80% of the genes in Pou5f1 are present in the expression matrix.
Less than 80% of the genes in Nr4a3 are present in the expression matrix.
Less than 80% of the genes in Maf are present in the expression matrix.
Less than 80% of the genes in Nfatc2 are present in the expression matrix.
Less than 80% of the genes in Nkx2-9 are present in the expression matrix.
Less than 80% of the genes in Irf8 are present in the expression matrix.
Less than 80% of the genes in Mlx are present in the expression matrix.
Less than 80% of the genes in Phf8 are present in the expression matrix.
Less than 80% of the genes in Hes7 are present in the expression matrix.
Less than 80% of the genes in Hoxc6 are present in the expression matrix.
Less than 80% of the genes in Mafk are present in the expression matrix.
Less than 80% of the genes in Nfatc4 are present in the expression matrix.
Less than 80% of the genes in Onecut1 are present in the expression matrix.
Less than 80% of the genes in Nr1h2 are present in the expression matrix.
Less than 80% of the genes in Prdm1 are present in the expression matrix.
Less than 80% of the genes in Kdm5b are present in the expression matrix.
Less than 80% of the genes in Rel are present in the expression matrix.
Less than 80% of the genes in Msx1 are present in the expression matrix.
Less than 80% of the genes in Nr1h3 are present in the expression matrix.
Less than 80% of the genes in Max are present in the expression matrix.
Less than 80% of the genes in Nfe2 are present in the expression matrix.
Less than 80% of the genes in Hsf1 are present in the expression matrix.
Less than 80% of the genes in Onecut2 are present in the expression matrix.
Less than 80% of the genes in Prdm12 are present in the expression matrix.
Less than 80% of the genes in Runx1 are present in the expression matrix.
Less than 80% of the genes in Rela are present in the expression matrix.
Less than 80% of the genes in Phlda2 are present in the expression matrix.
Less than 80% of the genes in Otx1 are present in the expression matrix.
Less than 80% of the genes in Nr2c1 are present in the expression matrix.
Less than 80% of the genes in Klf11 are present in the expression matrix.
Less than 80% of the genes in Nfe2l2 are present in the expression matrix.
Less than 80% of the genes in Six5 are present in the expression matrix.
Less than 80% of the genes in Relb are present in the expression matrix.
Less than 80% of the genes in Prdm16 are present in the expression matrix.
Less than 80% of the genes in Mybl1 are present in the expression matrix.
Less than 80% of the genes in Pitx1 are present in the expression matrix.
Less than 80% of the genes in Runx2 are present in the expression matrix.
Less than 80% of the genes in Otx2 are present in the expression matrix.
Less than 80% of the genes in Sox2 are present in the expression matrix.
Less than 80% of the genes in Nr2e1 are present in the expression matrix.
Less than 80% of the genes in Nfic are present in the expression matrix.
Less than 80% of the genes in Rfx1 are present in the expression matrix.
Less than 80% of the genes in Runx3 are present in the expression matrix.
Less than 80% of the genes in Myc are present in the expression matrix.
Less than 80% of the genes in Smad1 are present in the expression matrix.
Less than 80% of the genes in Prrx1 are present in the expression matrix.
Less than 80% of the genes in Klf13 are present in the expression matrix.
Less than 80% of the genes in Pknox2 are present in the expression matrix.
Less than 80% of the genes in Spi1 are present in the expression matrix.
Less than 80% of the genes in Ovol2 are present in the expression matrix.
Less than 80% of the genes in Nr2f2 are present in the expression matrix.
Less than 80% of the genes in Rfx2 are present in the expression matrix.
Less than 80% of the genes in Mycn are present in the expression matrix.
Less than 80% of the genes in Rxrg are present in the expression matrix.
Less than 80% of the genes in Spic are present in the expression matrix.
Less than 80% of the genes in Rarb are present in the expression matrix.
Less than 80% of the genes in Taf7 are present in the expression matrix.
Less than 80% of the genes in Smad4 are present in the expression matrix.
Less than 80% of the genes in Sox3 are present in the expression matrix.
Less than 80% of the genes in Klf16 are present in the expression matrix.
Less than 80% of the genes in Plagl2 are present in the expression matrix.
Less than 80% of the genes in Pax3 are present in the expression matrix.
Less than 80% of the genes in Tal1 are present in the expression matrix.
Less than 80% of the genes in Sall4 are present in the expression matrix.
Less than 80% of the genes in Rfx3 are present in the expression matrix.
Less than 80% of the genes in Srebf2 are present in the expression matrix.
Less than 80% of the genes in Rbak are present in the expression matrix.
Less than 80% of the genes in Tead1 are present in the expression matrix.
Less than 80% of the genes in Tbp are present in the expression matrix.
Less than 80% of the genes in Tead2 are present in the expression matrix.
Less than 80% of the genes in Rfxap are present in the expression matrix.
Less than 80% of the genes in Polr3g are present in the expression matrix.
Less than 80% of the genes in Scrt2 are present in the expression matrix.
Less than 80% of the genes in Rbbp5 are present in the expression matrix.
Less than 80% of the genes in Srf are present in the expression matrix.
Less than 80% of the genes in Sox4 are present in the expression matrix.
Less than 80% of the genes in Smarca4 are present in the expression matrix.
Less than 80% of the genes in Tfdp1 are present in the expression matrix.
Less than 80% of the genes in Tead3 are present in the expression matrix.
Less than 80% of the genes in Rora are present in the expression matrix.
Less than 80% of the genes in Tbr1 are present in the expression matrix.
Less than 80% of the genes in Pou3f2 are present in the expression matrix.
Less than 80% of the genes in Rbpjl are present in the expression matrix.
Less than 80% of the genes in Tfe3 are present in the expression matrix.
Less than 80% of the genes in Sf1 are present in the expression matrix.
Less than 80% of the genes in Smarcc2 are present in the expression matrix.
Less than 80% of the genes in Sox8 are present in the expression matrix.
Less than 80% of the genes in Stat3 are present in the expression matrix.
Less than 80% of the genes in Tead4 are present in the expression matrix.
Less than 80% of the genes in Zbtb3 are present in the expression matrix.
Less than 80% of the genes in Tcf12 are present in the expression matrix.
Less than 80% of the genes in Rorb are present in the expression matrix.
Less than 80% of the genes in Pou3f4 are present in the expression matrix.
Less than 80% of the genes in Tfeb are present in the expression matrix.
Less than 80% of the genes in Tcf3 are present in the expression matrix.
Less than 80% of the genes in Tef are present in the expression matrix.
Less than 80% of the genes in Zfp120 are present in the expression matrix.
Less than 80% of the genes in Zbtb33 are present in the expression matrix.
Less than 80% of the genes in Snai1 are present in the expression matrix.
Less than 80% of the genes in Sox9 are present in the expression matrix.
Less than 80% of the genes in Tfec are present in the expression matrix.
Less than 80% of the genes in Six1 are present in the expression matrix.
Less than 80% of the genes in Stat4 are present in the expression matrix.
Less than 80% of the genes in Zfp426 are present in the expression matrix.
Less than 80% of the genes in Tfap2a are present in the expression matrix.
Less than 80% of the genes in Tcf7 are present in the expression matrix.
Less than 80% of the genes in Zbtb7a are present in the expression matrix.
Less than 80% of the genes in Sox1 are present in the expression matrix.
Less than 80% of the genes in Tgif2 are present in the expression matrix.
Less than 80% of the genes in Sp1 are present in the expression matrix.
Less than 80% of the genes in Zfp143 are present in the expression matrix.
Less than 80% of the genes in Zfp442 are present in the expression matrix.
Less than 80% of the genes in Zfp691 are present in the expression matrix.
Less than 80% of the genes in Stat6 are present in the expression matrix.
Less than 80% of the genes in Six4 are present in the expression matrix.
Less than 80% of the genes in Tfap2c are present in the expression matrix.
Less than 80% of the genes in Tcf7l1 are present in the expression matrix.
Less than 80% of the genes in Zbtb7b are present in the expression matrix.
Less than 80% of the genes in Zfp708 are present in the expression matrix.
Less than 80% of the genes in Zfp513 are present in the expression matrix.
Less than 80% of the genes in Sp3 are present in the expression matrix.
Less than 80% of the genes in Sox10 are present in the expression matrix.
Less than 80% of the genes in T are present in the expression matrix.
Less than 80% of the genes in Zfp148 are present in the expression matrix.
Less than 80% of the genes in Thap11 are present in the expression matrix.
Less than 80% of the genes in Tfap4 are present in the expression matrix.
Less than 80% of the genes in Tcf7l2 are present in the expression matrix.
Less than 80% of the genes in Zfp710 are present in the expression matrix.
Less than 80% of the genes in Zeb1 are present in the expression matrix.
Less than 80% of the genes in Sp4 are present in the expression matrix.
Less than 80% of the genes in Zfp521 are present in the expression matrix.
Less than 80% of the genes in Zfpm1 are present in the expression matrix.
Less than 80% of the genes in Sox15 are present in the expression matrix.
Less than 80% of the genes in Taf1 are present in the expression matrix.
Less than 80% of the genes in Tfcp2l1 are present in the expression matrix.
Less than 80% of the genes in Zfp174 are present in the expression matrix.
Less than 80% of the genes in Zfp787 are present in the expression matrix.
Less than 80% of the genes in Zfhx2 are present in the expression matrix.
Less than 80% of the genes in Sp6 are present in the expression matrix.
Less than 80% of the genes in Zfp59 are present in the expression matrix.
Less than 80% of the genes in Trp53 are present in the expression matrix.
Less than 80% of the genes in Zfp819 are present in the expression matrix.
Less than 80% of the genes in Zfx are present in the expression matrix.
Less than 80% of the genes in Zfp202 are present in the expression matrix.
Less than 80% of the genes in Zfp1 are present in the expression matrix.
Less than 80% of the genes in Zfp595 are present in the expression matrix.
Less than 80% of the genes in Yeats4 are present in the expression matrix.
Less than 80% of the genes in Zfp879 are present in the expression matrix.
Less than 80% of the genes in Zic1 are present in the expression matrix.
Less than 80% of the genes in Zfp108 are present in the expression matrix.
Less than 80% of the genes in Zfp236 are present in the expression matrix.
Less than 80% of the genes in Zfp597 are present in the expression matrix.
Less than 80% of the genes in Yy1 are present in the expression matrix.
Less than 80% of the genes in Zfp93 are present in the expression matrix.
Less than 80% of the genes in Zic3 are present in the expression matrix.
Less than 80% of the genes in Zfp112 are present in the expression matrix.
Less than 80% of the genes in Zfp286 are present in the expression matrix.
Less than 80% of the genes in Zfp623 are present in the expression matrix.
Less than 80% of the genes in Zfp930 are present in the expression matrix.
Less than 80% of the genes in Zfp30 are present in the expression matrix.
Less than 80% of the genes in Zfp664 are present in the expression matrix.
Less than 80% of the genes in Zfp941 are present in the expression matrix.
Less than 80% of the genes in Zfp39 are present in the expression matrix.
auc_mtx = pd.read_csv(AUCELL_MTX_FNAME, index_col=0)
#下两行代码错误也可以出图 暂不管了 教程太坑爹了
adata
AnnData object with n_obs × n_vars = 3005 × 4109
obs: 'index', 'group #', 'total mRNA mol', 'well', 'sex', 'age', 'diameter', 'level1class', 'level2class', 'n_genes'
var: 'n_cells', 'highly_variable', 'means', 'dispersions', 'dispersions_norm'
uns: 'log1p', 'hvg', 'pca', 'tsne', 'level1class_colors', 'sex_colors'
obsm: 'X_pca', 'X_tsne'
varm: 'PCs'
add_scenic_metadata(adata, auc_mtx, regulons)
---------------------------------------------------------------------------
AssertionError Traceback (most recent call last)
/tmp/ipykernel_33904/4284807157.py in <module>
----> 1 add_scenic_metadata(adata, auc_mtx, regulons)
~/miniconda3/envs/scenic_protocol2/lib/python3.7/site-packages/pyscenic/export.py in add_scenic_metadata(adata, auc_mtx, regulons, bin_rep, copy)
240 # assert isinstance(adata, sc.AnnData)
241 assert isinstance(auc_mtx, pd.DataFrame)
--> 242 assert len(auc_mtx) == adata.n_obs
243
244 REGULON_SUFFIX_PATTERN = 'Regulon({})'
AssertionError:
sc.tl.tsne(adata, use_rep='X_aucell')
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
/tmp/ipykernel_33904/581935931.py in <module>
----> 1 sc.tl.tsne(adata, use_rep='X_aucell')
~/miniconda3/envs/scenic_protocol2/lib/python3.7/site-packages/scanpy/tools/_tsne.py in tsne(adata, n_pcs, use_rep, perplexity, early_exaggeration, learning_rate, random_state, use_fast_tsne, n_jobs, copy, metric)
84 start = logg.info('computing tSNE')
85 adata = adata.copy() if copy else adata
---> 86 X = _choose_representation(adata, use_rep=use_rep, n_pcs=n_pcs)
87 # params for sklearn
88 n_jobs = settings.n_jobs if n_jobs is None else n_jobs
~/miniconda3/envs/scenic_protocol2/lib/python3.7/site-packages/scanpy/tools/_utils.py in _choose_representation(adata, use_rep, n_pcs, silent)
57 raise ValueError(
58 'Did not find {} in `.obsm.keys()`. '
---> 59 'You need to compute it first.'.format(use_rep)
60 )
61 settings.verbosity = verbosity # resetting verbosity
ValueError: Did not find X_aucell in `.obsm.keys()`. You need to compute it first.
sc.set_figure_params(frameon=False, dpi=150, fontsize=8)
sc.pl.tsne(adata, color=['level1class', 'sex', 'age', 'Gad1'],
title=['GSE60361 - Cell types', 'Sex', 'Age', 'Gad1'], ncols=2)
[图片上传失败...(image-e7a835-1626336017227)]