@@ -30,7 +30,7 @@ def parse_cwl(cwl_path):
30
30
p = CWLToolParser ()
31
31
return p .import_cwl (cwl_path )
32
32
if cl == "Workflow" :
33
- p = CWLToolParser ()
33
+ p = CWLWorkflowParser ()
34
34
return p .import_cwl (cwl_path )
35
35
return None
36
36
@@ -595,8 +595,9 @@ class StepsParser(object):
595
595
"""
596
596
Class to parse content of steps of workflow from existing CWL Workflow.
597
597
"""
598
- def __init__ (self , basedir = None ):
598
+ def __init__ (self , basedir = None , expand_run = True ):
599
599
self .basedir = basedir
600
+ self .expand_run = expand_run
600
601
601
602
def _load_in (self , step_obj , in_el ):
602
603
for key , val in in_el .items ():
@@ -613,10 +614,12 @@ def _load_out(self, step_obj, in_el):
613
614
step_obj .outputs .append (o )
614
615
615
616
def _load_run (self , step_obj , in_el ):
616
- if isinstance (in_el , basestring ):
617
+ if isinstance (in_el , basestring ) and self . expand_run :
617
618
path = os .path .join (self .basedir , in_el )
618
619
#logger.info("Parsing: %s", path)
619
620
step_obj .run = parse_cwl (path )
621
+ else :
622
+ step_obj .run = in_el
620
623
621
624
622
625
def load_steps (self , steps_obj , steps_elm ):
@@ -640,8 +643,9 @@ def load_steps(self, steps_obj, steps_elm):
640
643
641
644
class CWLWorkflowParser (object ):
642
645
643
- def __init__ (self , basedir = None ):
646
+ def __init__ (self , basedir = None , expand_run = True ):
644
647
self .basedir = basedir
648
+ self .expand_run = expand_run
645
649
646
650
def _init_workflow (self , cwl_dict ):
647
651
"""
@@ -744,5 +748,5 @@ def _load_steps(self, tool, outputs_el):
744
748
:param outputs_el: Content of outputs
745
749
:type outputs_el: LIST or DICT
746
750
"""
747
- inp_parser = StepsParser (self .basedir )
751
+ inp_parser = StepsParser (self .basedir , self . expand_run )
748
752
inp_parser .load_steps (tool .steps , outputs_el )
0 commit comments