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

Commit

Permalink
Refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
mali-git committed Nov 14, 2018
1 parent 0e0a66e commit caa48dc
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 14 deletions.
16 changes: 10 additions & 6 deletions src/biokeen/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,13 @@

"""A command line interface for BioKEEN."""

import json
import logging
from collections import OrderedDict

import click

import pykeen
from bio2bel.constants import get_global_connection
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,
Expand All @@ -23,6 +19,11 @@
print_execution_mode_message, print_section_divider, print_training_set_message,
)

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

connection_option = click.option(
'-c',
'--connection',
Expand Down Expand Up @@ -94,13 +95,16 @@ def main(): # noqa: D401


@main.command()
@click.option('-c', '--config', type=click.File())
@connection_option
@click.option('-f', '--config', type=click.File())
@click.option('-r', '--rebuild', is_flag=True)
def start(config, connection, rebuild):
"""Start BioKEEN pipeline."""

if config is None:
config = prompt_config(connection, rebuild)
else:
config = json.load(config)

pykeen.run(config)

Expand Down
2 changes: 1 addition & 1 deletion src/biokeen/cli_utils/cli_query_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

def select_database():
"""Select database."""
click.secho("Current Step: Please select the embedding model you want to train:", fg='blue')
click.secho("Current Step: Please select the database you want to train on:", fg='blue')
for model, model_id in sorted(ID_TO_DATABASE_MAPPING.items()):
click.echo(f'{model}: {model_id}')

Expand Down
16 changes: 9 additions & 7 deletions src/biokeen/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,25 @@
EMOJI = '🍩'

# Available databases
DRUGBANK_NAME = 'drugbank'
COMPATH_NAME = 'compath'
HIPPE_NAME = 'hippie'
KEGG_NAME = 'kegg'
MIRTARBASE_NAME = 'mirtarbase'
WIKIPATHWAYS_NAME = 'wikipathways'
MSIG_NAME = 'msig'
KEGG_NAME = 'kegg'
REACTOME_NAME = 'reactome'
WIKIPATHWAYS_NAME = 'wikipathways'
DRUGBANK_NAME = 'drugbank'

# ToDo: Add databases
DATABASES = [
MIRTARBASE_NAME,
DRUGBANK_NAME,
WIKIPATHWAYS_NAME,
COMPATH_NAME,
HIPPE_NAME,
MSIG_NAME,
KEGG_NAME,
MIRTARBASE_NAME,
MSIG_NAME,
REACTOME_NAME,
WIKIPATHWAYS_NAME,
DRUGBANK_NAME,
]

ID_TO_DATABASE_MAPPING = dict(enumerate(DATABASES, start=1))

0 comments on commit caa48dc

Please sign in to comment.