aertslab / pySCENIC

pySCENIC is a lightning-fast python implementation of the SCENIC pipeline (Single-Cell rEgulatory Network Inference and Clustering) which enables biologists to infer transcription factors, gene regulatory networks and cell types from single-cell RNA-seq data.
http://scenic.aertslab.org
GNU General Public License v3.0
420 stars 179 forks source link

pySCENIC reads regulon collection placeholder as existing file and quits #81

Closed jamesrhowe closed 5 years ago

jamesrhowe commented 5 years ago

Hello,

I am running the command line implementation of pySCENIC on a Mac. The GRN step works just fine. When I do the ctx step, using a CSV adjacency file as input, I get an error when I try to save the regulon collection file output as a yaml or gmt file, but not when I save the table of enriched motifs and target genes as a CSV. It seems like it does not write the file because the placeholder created during initialization gets read as already occupying the space to write to, and it then shuts down with a zero byte file in the directory of interest. Is there something I am doing wrong, or is this a bug?

Here is the command I used to start the step:

pyscenic ctx -o SCENIC/cisTarget_regulons.gmt --annotations_fname SCENIC/motifs-v9-nr-mgi.txt SCENIC/GRNboost2_output.csv SCENIC/mm10__refseq-r80__10kb_up_and_down_tss.mc9nr.feather SCENIC/mm10__refseq-r80__500bp_up_and_100bp_down_tss.mc9nr.feather

Here is the error I received:

2019-06-17 00:04:21,139 - pyscenic.cli.pyscenic - INFO - Writing results to file. Traceback (most recent call last): File "/Users/jhowe6/anaconda3/bin/pyscenic", line 10, in sys.exit(main()) File "/Users/jhowe6/anaconda3/lib/python3.7/site-packages/pyscenic/cli/pyscenic.py", line 405, in main args.func(args) File "/Users/jhowe6/anaconda3/lib/python3.7/site-packages/pyscenic/cli/pyscenic.py", line 164, in prune_targets_command save_enriched_motifs(df_motifs, args.output.name) File "/Users/jhowe6/anaconda3/lib/python3.7/site-packages/pyscenic/cli/utils.py", line 177, in save_enriched_motifs GeneSignature.to_gmt(fname, regulons) File "/Users/jhowe6/anaconda3/lib/python3.7/site-packages/pyscenic/genesig.py", line 89, in to_gmt assert not os.path.exists(fname), "{} already exists.".format(fname) AssertionError: SCENIC/cisTarget_regulons.gmt already exists.

cflerin commented 5 years ago

Thanks for reporting this, it seems to be a bug. As a workaround, use the csv format instead of gmt for your regulons file (-o regulons.csv, as you've already discovered). The csv can then be passed into the next step (AUCell), which will produce results equivalent to using the gmt format.

bramvds commented 5 years ago

Will be fixed in next release.