Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add hipathia export option #30

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion src/pathme/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@
import pathme.kegg.cli
import pathme.reactome.cli
import pathme.wikipathways.cli
import pybel
from pybel import to_pickle
from pybel.struct.mutation import collapse_all_variants, collapse_to_genes, remove_isolated_list_abundances
from pybel.struct.summary import count_functions
from .constants import CX_DIR, KEGG_BEL, PPI_DIR, REACTOME_BEL, SPIA_DIR, UNIVERSE_DIR, WIKIPATHWAYS_BEL
from .constants import CX_DIR, HIPATHIA_DIR, KEGG_BEL, PPI_DIR, REACTOME_BEL, SPIA_DIR, UNIVERSE_DIR, WIKIPATHWAYS_BEL
from .export_utils import export_helper, get_universe_graph, iterate_universe_graphs

logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -121,6 +122,26 @@ def cx(kegg_path, reactome_path, wikipathways_path, output, no_flatten, no_norma
to_cx_file(graph, file)


@export.command()
@kegg_path_option
@reactome_path_option
@wikipathways_path_option
@click.option('-o', '--output', help='Output directory', default=HIPATHIA_DIR, show_default=True)
@no_flatten_option
@no_normalize_names_option
def hipathia(kegg_path, reactome_path, wikipathways_path, output, no_flatten, no_normalize_names):
"""Export to hipathia directories."""
click.echo(f'Results will be exported to {output}')
for source, path, graph in iterate_universe_graphs(
kegg_path=kegg_path,
reactome_path=reactome_path,
wikipathways_path=wikipathways_path,
flatten=(not no_flatten),
normalize_names=(not no_normalize_names),
):
pybel.to_hipathia(graph, os.path.join(output, os.path.basename(path)))


@export.command()
@kegg_path_option
@reactome_path_option
Expand Down
1 change: 1 addition & 0 deletions src/pathme/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ def get_data_dir() -> str:

SPIA_DIR = os.path.join(DATA_DIR, 'spia')
CX_DIR = os.path.join(DATA_DIR, 'cx')
HIPATHIA_DIR = os.path.join(DATA_DIR, 'hipathia')
PPI_DIR = os.path.join(DATA_DIR, 'ppi')
UNIVERSE_DIR = os.path.join(DATA_DIR, 'universe')

Expand Down