Closed ShaowenJ closed 4 years ago
Hi,
You can save the regulons to gmt using the save_enriched_motifs
function in pySCENIC. Set the output file to have the gmt extension:
save_enriched_motifs(regulons, 'regulons.gmt')
This also supports csv, tsv, pickle, json, and yaml.
Hi,
Thanks for the quick response. but why I cannot import this function? ImportError: cannot import name 'save_enriched_motifs' from 'pyscenic.utils' (/Users/levylabmini2/opt/anaconda3/lib/python3.7/site-packages/pyscenic/utils.py)
Thanks,
It should be:
from pyscenic.cli.utils import save_enriched_motifs
Hi, I have a quick question, So in this step, I use the tutorial code to write down the regulon file to "regulon.p" But it might be a better idea to output it to gmt file so that it can be imported into R. Could anyone kindly tell me how to do that?
REGULONS_FNAME = os.path.join(SCENIC_FOLDER, "regulons.p")
Calculate a list of enriched motifs and the corresponding target genes for all modules.
with ProgressBar(): df = prune2df(dbs, modules, MOTIF_ANNOTATIONS_FNAME)
Create regulons from this table of enriched motifs.
regulons = df2regulons(df)
Save the enriched motifs and the discovered regulons to disk.
df.to_csv(MOTIFS_FNAME) with open(REGULONS_FNAME, "wb") as f: pickle.dump(regulons, f)