2021-07-15pyscenic-2

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)]


最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 215,723评论 6 498
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 92,003评论 3 391
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 161,512评论 0 351
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 57,825评论 1 290
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 66,874评论 6 388
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 50,841评论 1 295
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 39,812评论 3 416
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 38,582评论 0 271
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 45,033评论 1 308
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 37,309评论 2 331
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 39,450评论 1 345
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 35,158评论 5 341
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 40,789评论 3 325
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 31,409评论 0 21
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 32,609评论 1 268
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 47,440评论 2 368
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 44,357评论 2 352