Skip to content
This repository has been archived by the owner on Sep 7, 2022. It is now read-only.

Commit

Permalink
Add compath resources build
Browse files Browse the repository at this point in the history
  • Loading branch information
cthoyt committed Nov 13, 2018
1 parent 58fe879 commit 0213f71
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 11 deletions.
12 changes: 12 additions & 0 deletions src/biokeen/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
'iterate_source_paths',
'ensure_hippie',
'ensure_drugbank',
'ensure_compath',
]

logger = logging.getLogger(__name__)
Expand All @@ -26,6 +27,9 @@
drugbank_bel_path = os.path.join(DATA_DIR, 'drugbank.bel.pickle')
drugbank_keen_path = os.path.join(DATA_DIR, 'drugbank.keen.tsv')

compath_bel_path = os.path.join(DATA_DIR, 'compath.bel.pickle')
compath_keen_path = os.path.join(DATA_DIR, 'compath.keen.tsv')


def get_full_matrix():
"""Get all built data as a matrix."""
Expand Down Expand Up @@ -76,3 +80,11 @@ def ensure_drugbank(connection: Optional[str] = None):
to_pickle(drugbank_graph, drugbank_bel_path)

to_pykeen_file(drugbank_graph, drugbank_keen_path)


def ensure_compath():
"""Ensure the ComPath mappings are retrieved."""
import compath_resources
graph = compath_resources.get_bel()
to_pickle(graph, compath_bel_path)
to_pykeen_file(graph, compath_keen_path)
21 changes: 10 additions & 11 deletions src/biokeen/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,20 @@

import pykeen
from bio2bel.constants import get_global_connection
from biokeen.build import ensure_drugbank, ensure_hippie, iterate_source_paths
from biokeen.build import ensure_compath, ensure_drugbank, ensure_hippie, iterate_source_paths
from biokeen.cli_utils.bio_2_bel_utils import install_bio2bel_module
from biokeen.cli_utils.cli_print_msg_helper import print_intro, print_welcome_message
from biokeen.cli_utils.cli_query_helper import select_database
from pykeen.cli import (
_configure_evaluation_specific_parameters,
device_prompt,
execution_mode_specific_prompt,
model_selection_prompt,
output_direc_prompt,
training_file_prompt,
_configure_evaluation_specific_parameters, device_prompt, execution_mode_specific_prompt, model_selection_prompt,
output_direc_prompt, training_file_prompt,
)
from pykeen.constants import EXECUTION_MODE, HPO_MODE, TRAINING_MODE, TRAINING_SET_PATH
from pykeen.predict import start_predictions_piepline
from pykeen.utilities.cli_utils.cli_print_msg_helper import (
print_execution_mode_message,
print_section_divider,
print_training_set_message
print_execution_mode_message, print_section_divider, print_training_set_message,
)


connection_option = click.option(
'-c',
'--connection',
Expand Down Expand Up @@ -171,3 +164,9 @@ def hippie(connection):
def drugbank(connection):
"""Build DrugBank."""
ensure_drugbank(connection)


@build.command()
def compath():
"""Build ComPath."""
ensure_compath()

0 comments on commit 0213f71

Please sign in to comment.