Skip to content

Commit

Permalink
BugFixes: #100 and #51.
Browse files Browse the repository at this point in the history
  • Loading branch information
bramvds committed Oct 9, 2019
1 parent 275615b commit 8974d39
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
17 changes: 17 additions & 0 deletions scripts/cli_test_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,23 @@ pyscenic ctx "${DATA_FOLDER}/GSE103322.modules.sample.dat" \
--output "${DATA_FOLDER}/motifs.csv" \
--num_workers ${CORES}

pyscenic ctx "${DATA_FOLDER}/GSE103322.modules.sample.dat" \
"${DB_FOLDER}/hg19-500bp-upstream-10species.mc9nr.feather" \
"${DB_FOLDER}/hg19-500bp-upstream-7species.mc9nr.feather" \
--annotations_fname "${RESOURCES_FOLDER}/motifs-v9-nr.hgnc-m0.001-o0.0.tbl" \
--mode "dask_multiprocessing" \
--chunk_size 1 \
--output "${DATA_FOLDER}/regulons.dat" \
--num_workers ${CORES}

pyscenic ctx "${DATA_FOLDER}/GSE103322.modules.sample.dat" \
"${DB_FOLDER}/hg19-500bp-upstream-10species.mc9nr.feather" \
--annotations_fname "${RESOURCES_FOLDER}/motifs-v9-nr.hgnc-m0.001-o0.0.tbl" \
--mode "dask_multiprocessing" \
--chunk_size 1 \
--output "${DATA_FOLDER}/regulons.gmt" \
--num_workers ${CORES}

###############
# TEST AUCELL #
###############
Expand Down
3 changes: 2 additions & 1 deletion src/pyscenic/cli/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,8 @@ def save_enriched_motifs(df, fname:str) -> None:
with open(fname, 'w') as f:
f.write(json.dumps(name2targets))
elif extension == '.dat':
pickle.dump(regulons, fname)
with open(fname, 'wb') as f:
pickle.dump(regulons, f)
elif extension == '.gmt':
GeneSignature.to_gmt(fname, regulons)
elif extension in {'.yaml', '.yml'}:
Expand Down
3 changes: 1 addition & 2 deletions src/pyscenic/genesig.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def to_gmt(cls, fname: str, signatures: List[Type['GeneSignature']], field_separ
:param gene_separator: The separator that separates the genes.
"""
#assert not os.path.exists(fname), "{} already exists.".format(fname)
with open(fname, "w") as file:
with open(fname, "wt") as file:
for signature in signatures:
genes = gene_separator.join(signature.genes)
file.write("{}{}{}{}{}\n".format(signature.name, field_separator,
Expand Down Expand Up @@ -340,7 +340,6 @@ def non_empty(self, attribute, value):
if len(value) == 0:
raise ValueError("A regulon must have a transcription factor.")

@property
def metadata(self, field_separator: str = ',') -> str:
return "tf={}{}score={}".format(self.transcription_factor, field_separator, self.score)

Expand Down

0 comments on commit 8974d39

Please sign in to comment.