IO Utilities¶
Utilities for loading and exporting BEL graphs
-
pybel_tools.ioutils.
get_paths_recursive
(directory, extension='.bel', exclude_directory_pattern=None)[source]¶ Gets all file paths in a given directory to BEL documents
Parameters:
-
pybel_tools.ioutils.
convert_paths
(paths, manager=None, upload=False, do_enrich_protein_and_rna_origins=True, do_enrich_pubmed_citations=False, do_to_web=False, **kwargs)[source]¶ Parse and either uploads/pickles graphs in a given set of files, recursively.
Parameters: - paths (iter[str]) – The paths to convert
- upload (bool) – Should the networks be uploaded to the cache?
- do_enrich_protein_and_rna_origins (bool) – Should the RNA and gene be inferred for each protein?
- do_enrich_pubmed_citations (bool) – Should the citations be enriched using Entrez Utils?
- do_to_web (bool) – Send to BEL Commons?
- kwargs – Parameters to pass to
pybel.from_path()
Returns: A pair of a dictionary {path: bel graph} and list of failed paths
Return type:
-
pybel_tools.ioutils.
convert_directory
(directory, manager=None, upload=False, pickle=False, canonicalize=True, do_enrich_protein_and_rna_origins=True, enrich_citations=False, enrich_genes=False, enrich_go=False, send=False, exclude_directory_pattern=None, version_in_path=False, **kwargs)[source]¶ Parse and either uploads/pickles graphs in a given directory and recursively for sub-directories.
Parameters: - directory (str) – The directory to look through
- upload (bool) – Should the networks be uploaded to the cache?
- pickle (bool) – Should the networks be saved as pickles?
- do_enrich_protein_and_rna_origins (bool) – Should the central dogma be inferred for all proteins, RNAs, and miRNAs
- enrich_citations (bool) – Should the citations be enriched using Entrez Utils?
- enrich_genes (bool) – Should the genes’ descriptions be downloaded from Gene Cards?
- enrich_go (bool) – Should the biological processes’ descriptions be downloaded from Gene Ontology?
- send (bool) – Send to PyBEL Web?
- exclude_directory_pattern (str) – A pattern to use to skip directories
- version_in_path (bool) – Add the current pybel version to the pathname
- kwargs – Parameters to pass to
pybel.from_path()
-
pybel_tools.ioutils.
upload_recursive
(directory, manager=None, exclude_directory_pattern=None)[source]¶ Recursively uploads all gpickles in a given directory and sub-directories
Parameters:
-
pybel_tools.ioutils.
subgraphs_to_pickles
(network, annotation, directory=None)[source]¶ Groups the given graph into subgraphs by the given annotation with
get_subgraph_by_annotation()
and outputs them as gpickle files to the given directory withpybel.to_pickle()
Parameters: - network (pybel.BELGraph) – A BEL network
- annotation (str) – An annotation to split by. Suggestion:
Subgraph
- directory (Optional[str]) – A directory to output the pickles