diff --git a/scripts/cli_test_script.sh b/scripts/cli_test_script.sh index 776c2fd..f392384 100644 --- a/scripts/cli_test_script.sh +++ b/scripts/cli_test_script.sh @@ -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 # ############### diff --git a/src/pyscenic/cli/utils.py b/src/pyscenic/cli/utils.py index 278d4c4..804fdd3 100644 --- a/src/pyscenic/cli/utils.py +++ b/src/pyscenic/cli/utils.py @@ -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'}: diff --git a/src/pyscenic/genesig.py b/src/pyscenic/genesig.py index 0d8518a..2e0779a 100644 --- a/src/pyscenic/genesig.py +++ b/src/pyscenic/genesig.py @@ -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, @@ -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)