Skip to content

Commit

Permalink
Modify imports
Browse files Browse the repository at this point in the history
  • Loading branch information
ddomingof committed Apr 25, 2019
1 parent f480346 commit b13c585
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
15 changes: 9 additions & 6 deletions src/pathme/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,11 @@
import time

import click
import networkx as nx
from bio2bel_chebi import Manager as ChebiManager
from bio2bel_hgnc import Manager as HgncManager
from pybel import from_pickle, to_pickle
from pybel.dsl import ListAbundance
from pybel.struct.mutation import collapse_to_genes, collapse_all_variants
from pybel_tools.analysis.spia import bel_to_spia_matrices, spia_matrices_to_excel
from pybel.struct.summary import count_functions
from tqdm import tqdm

import networkx as nx
from pathme.constants import *
from pathme.export_utils import get_all_pickles, get_files_in_folder, get_universe_graph
from pathme.kegg.convert_to_bel import kegg_to_pickles
Expand All @@ -26,6 +21,11 @@
from pathme.utils import CallCounted, make_downloader, statistics_to_df, summarize_helper
from pathme.wikipathways.rdf_sparql import get_wp_statistics, wikipathways_to_pickles
from pathme.wikipathways.utils import get_file_name_from_url, get_wikipathways_files, unzip_file
from pybel import from_pickle, to_pickle
from pybel.dsl import ListAbundance
from pybel.struct.mutation import collapse_to_genes, collapse_all_variants, remove_isolated_list_abundances
from pybel.struct.summary import count_functions
from pybel_tools.analysis.spia import bel_to_spia_matrices, spia_matrices_to_excel

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -389,6 +389,9 @@ def universe(kegg_path, reactome_path, wikipathways_path, output, no_flatten, no
)
click.echo(f'Number of isolates after getting universe: {nx.number_of_isolates(universe_graph)}')

# Remove isolated list abundances
remove_isolated_list_abundances(universe_graph)

if flatten:
universe_graph.remove_nodes_from({
node
Expand Down
13 changes: 6 additions & 7 deletions src/pathme/export_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@
import os
from typing import List

from tqdm import tqdm

from pathme.constants import KEGG, REACTOME, WIKIPATHWAYS
from pathme.normalize_names import normalize_graph_names
from pathme.pybel_utils import flatten_complex_nodes
from pybel import BELGraph
from pybel import from_pickle
from pybel import union
from tqdm import tqdm
from pybel import BELGraph, from_pickle, union

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -78,7 +77,7 @@ def _iterate_universe_graphs(
continue

if file in kegg_pickles:
graph = from_pickle(os.path.join(kegg_path, file))
graph = from_pickle(os.path.join(kegg_path, file), check_version=False)

if flatten:
flatten_complex_nodes(graph)
Expand All @@ -87,7 +86,7 @@ def _iterate_universe_graphs(
normalize_graph_names(graph, KEGG)

elif file in reactome_pickles:
graph = from_pickle(os.path.join(reactome_path, file))
graph = from_pickle(os.path.join(reactome_path, file), check_version=False)

if flatten:
flatten_complex_nodes(graph)
Expand All @@ -96,7 +95,7 @@ def _iterate_universe_graphs(
normalize_graph_names(graph, REACTOME)

elif file in wp_pickles:
graph = from_pickle(os.path.join(wikipathways_path, file))
graph = from_pickle(os.path.join(wikipathways_path, file), check_version=False)

if flatten:
flatten_complex_nodes(graph)
Expand Down

0 comments on commit b13c585

Please sign in to comment.