Skip to content

Commit

Permalink
added --no-graph, added graphviz to pip req
Browse files Browse the repository at this point in the history
  • Loading branch information
leepc12 committed Dec 9, 2019
1 parent 3c0db1a commit f0b0e8f
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 8 deletions.
11 changes: 7 additions & 4 deletions croo/croo.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ class Croo(object):
def __init__(self, metadata_json, out_def_json, out_dir,
soft_link=True,
ucsc_genome_db=None,
ucsc_genome_pos=None):
ucsc_genome_pos=None,
no_graph=False):
"""Initialize croo with output definition JSON
"""
if isinstance(metadata_json, dict):
Expand All @@ -52,6 +53,7 @@ def __init__(self, metadata_json, out_def_json, out_dir,
self._cm = CromwellMetadata(self._metadata)
self._ucsc_genome_db = ucsc_genome_db
self._ucsc_genome_pos = ucsc_genome_pos
self._no_graph = no_graph

if isinstance(out_def_json, dict):
self._out_def_json = out_def_json
Expand Down Expand Up @@ -103,7 +105,7 @@ def organize_output(self):
full_path = node.output_path
shard_idx = node.shard_idx

if node_format is not None:
if node_format is not None and not self._no_graph:
interpreted_node_format = Croo.__interpret_inline_exp(
node_format, full_path, shard_idx)
if subgraph is not None:
Expand Down Expand Up @@ -170,7 +172,7 @@ def organize_output(self):
ucsc_track, full_path, shard_idx)
report.add_to_ucsc_track(target_url,
interpreted_ucsc_track)
if node_format is not None:
if node_format is not None and not self._no_graph:
interpreted_node_format = Croo.__interpret_inline_exp(
node_format, full_path, shard_idx)
if subgraph is not None:
Expand Down Expand Up @@ -296,7 +298,8 @@ def main():
out_dir=args['out_dir'],
ucsc_genome_db=args['ucsc_genome_db'],
ucsc_genome_pos=args['ucsc_genome_pos'],
soft_link=args['method'] == 'link')
soft_link=args['method'] == 'link',
no_graph=args['no_graph'])

co.organize_output()

Expand Down
5 changes: 4 additions & 1 deletion croo/croo_args.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
MAX_DURATION_SEC_PRESIGNED_URL_GCS)


__version__ = '0.3.1'
__version__ = '0.3.2'

def parse_croo_arguments():
"""Argument parser for Cromwell Output Organizer (COO)
Expand All @@ -36,6 +36,9 @@ def parse_croo_arguments():
'Original output files will be kept in Cromwell\'s output '
'directory. '
'"copy" makes copies of Cromwell\'s original outputs')
p.add_argument(
'--no-graph', action='store_true',
help='No task graph.')
p.add_argument(
'--ucsc-genome-db',
help='UCSC genome browser\'s "db=" parameter. '
Expand Down
6 changes: 4 additions & 2 deletions croo/croo_html_report_task_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import os
from copy import deepcopy
from base64 import b64encode
from graphviz import (Source, render)
from caper.caper_uri import CaperURI, URI_LOCAL, URI_URL


Expand Down Expand Up @@ -60,6 +59,10 @@ def __make_svg(self):
Returns:
An SVG string, but also saves to CrooHtmlReportTaskGraph.TASK_GRAPH_SVG
"""
if not self._items:
return None
from graphviz import Source

# define call back functions for node format, href, subgraph
def fnc_node_format(n):
if (n.type, n.output_name, n.task_name, n.shard_idx) in self._items:
Expand All @@ -78,7 +81,6 @@ def fnc_subgraph(n):
return self._items[(n.type, n.output_name, n.task_name, n.shard_idx)][2]
else:
return None

# convert to dot string
dot_str = self._dag.to_dot(
fnc_node_format=fnc_node_format,
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@
'License :: OSI Approved :: MIT License',
'Operating System :: POSIX :: Linux',
],
install_requires=['caper>=0.6.1']
install_requires=['caper>=0.6.1', 'graphviz']
)

0 comments on commit f0b0e8f

Please sign in to comment.