Skip to content

Commit 259f675

Browse files
committed
Add debugging and change home page text
1 parent 5a8c584 commit 259f675

File tree

4 files changed

+19
-7
lines changed

4 files changed

+19
-7
lines changed

src/pathme_viewer/cli.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,8 @@
99

1010
import click
1111
from bio2bel_chebi import Manager as ChebiManager
12-
from bio2bel_hgnc import Manager as HgncManager
13-
from pybel import union
1412

13+
from bio2bel_hgnc import Manager as HgncManager
1514
from pathme.constants import (
1615
KEGG,
1716
KEGG_DIR,
@@ -28,6 +27,7 @@
2827
get_file_name_from_url,
2928
unzip_file
3029
)
30+
from pybel import union
3131
from .constants import DEFAULT_CACHE_CONNECTION
3232
from .load_db import load_kegg, load_reactome, load_wikipathways
3333
from .manager import Manager
@@ -55,17 +55,25 @@ def set_debug_param(debug):
5555
@click.group(help='PathMe')
5656
def main():
5757
"""Main click method"""
58-
logging.basicConfig(level=20, format="%(asctime)s - %(levelname)s - %(name)s - %(message)s")
58+
logging.basicConfig(level=10, format="%(asctime)s - %(levelname)s - %(name)s - %(message)s")
5959

6060

6161
@main.command()
6262
@click.option('--host', default='0.0.0.0', help='Flask host. Defaults to 0.0.0.0')
6363
@click.option('--port', type=int, default=5000, help='Flask port. Defaults to 5000')
6464
@click.option('--template', help='Defaults to "../templates"')
6565
@click.option('--static', help='Defaults to "../static"')
66-
def web(host, port, template, static):
66+
@click.option('-v', '--verbose', is_flag=True)
67+
def web(host, port, template, static, verbose):
6768
"""Run web service."""
6869
from .web.web import create_app
70+
71+
if verbose:
72+
log.setLevel(logging.DEBUG)
73+
log.debug('Debug mode activated')
74+
else:
75+
log.setLevel(logging.INFO)
76+
6977
app = create_app(template_folder=template, static_folder=static)
7078
app.run(host=host, port=port)
7179

src/pathme_viewer/graph_utils.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,10 @@ def merge_pathways(pathways):
7777
add_annotation_value(graph, 'Database', pathway.resource_name)
7878
add_annotation_value(graph, 'PathwayID', pathway.pathway_id)
7979

80+
log.debug('Adding graph {} {}:with {} nodes and {} edges'.format(
81+
name, resource, graph.number_of_nodes(), graph.number_of_edges())
82+
)
83+
8084
networks.append(graph)
8185

8286
if not networks:

src/pathme_viewer/templates/pathme.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@
5151
{{ util.flashed_messages(dismissible=True, container=False) }}
5252

5353
<div class="jumbotron">
54-
<h1>PathMe</h1>
55-
<p>A tool to merge and explore the mechanistic pathway knowledge.
54+
<h1>PathMe Viewer</h1>
55+
<p>A web application to merge and explore the mechanistic pathway knowledge.
5656
</p>
5757
</div>
5858

src/pathme_viewer/web/views.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ def get_network():
120120

121121
graph = merge_pathways(pathways)
122122

123-
log.info('Exporting graph with {} nodes and {} edges'.format(graph.number_of_nodes(), graph.number_of_edges()))
123+
log.info('Exporting merged graph with {} nodes and {} edges'.format(graph.number_of_nodes(), graph.number_of_edges()))
124124

125125
return export_graph(graph, request.args.get('format'))
126126

0 commit comments

Comments
 (0)