Skip to content
Snippets Groups Projects
Commit 76932776 authored by George Marchment's avatar George Marchment
Browse files

update

parent acfd81af
No related branches found
No related tags found
No related merge requests found
Pipeline #13377 failed with stage
in 1 minute and 1 second
......@@ -38,6 +38,9 @@ class Nextflow_Building_Blocks:
def get_DSL(self):
return self.origin.get_DSL()
def get_processes_annotation(self):
return self.origin.get_processes_annotation()
def get_file_address(self):
return self.origin.get_file_address()
......
......@@ -21,7 +21,8 @@ from .bioflowinsighterror import BioFlowInsightError
class Nextflow_File(Nextflow_Building_Blocks):
def __init__(self, address, duplicate = True, DSL="", author = None, name = None, origin=None, output_dir='./results', display_info = True):
def __init__(self, address, duplicate = True, DSL="", author = None, name = None, origin=None, output_dir='./results', display_info = True,
workflow = None):
self.file = address
if(self.get_file_address().find('/')==-1):
raise BioFlowInsightError(f"BioFlow-Insight cannot directly analyse a workflow from its directory. Please analyse the workflow from the parent directory instead.", num = -1)
......@@ -40,6 +41,7 @@ class Nextflow_File(Nextflow_Building_Blocks):
self.duplicate = duplicate
self.origin = origin
self.DSL = ""
self.workflow = workflow
self.first_file = DSL==""
self.graph = None
self.display_info = display_info
......@@ -95,6 +97,12 @@ class Nextflow_File(Nextflow_Building_Blocks):
return self.output_dir
else:
return self.origin.get_output_dir()
def get_processes_annotation(self):
if(self.first_file):
return self.workflow.get_processes_annotation()
else:
return self.origin.get_processes_annotation()
def get_display_info(self):
if (self.first_file):
......
......@@ -20,6 +20,8 @@ class Process(Nextflow_Building_Blocks):
self.when_code = ""
self.script_code = ""
self.tools = []
self.modules = []
self.commands = []
self.initialise()
self.initialised = True
......@@ -203,6 +205,11 @@ class Process(Nextflow_Building_Blocks):
def get_output_code(self):
return self.output_code
def get_modules(self):
return self.modules
def get_commands(self):
return self.commands
......@@ -271,6 +278,11 @@ class Process(Nextflow_Building_Blocks):
self.initialise_name()
self.initialise_parts()
self.initialise_inputs_outputs()
annotations = self.get_processes_annotation()
if(annotations!=None):
self.tools = annotations[self.get_code()]["tools"]
self.commands = annotations[self.get_code()]["commands"]
self.modules = annotations[self.get_code()]["modules"]
def add_2_rocrate(self, dico, parent_key):
process_key = self.get_rocrate_key(dico)
......
......@@ -18,7 +18,8 @@ class Workflow:
name = None, datePublished=None, description=None,
license = None, creativeWorkStatus = None, authors = None,
version = None, keywords = None, producer = None,
publisher = None, processes_2_remove = None):
publisher = None, processes_2_remove = None,
processes_annotation = None):
if(not os.path.isfile(file)):
nextflow_files = glob.glob(f'{file}/*.nf')
......@@ -31,12 +32,14 @@ class Workflow:
except:
file =nextflow_files[0]
self.processes_annotation = processes_annotation
self.nextflow_file = Nextflow_File(
file,
duplicate=duplicate,
display_info=display_info,
output_dir=output_dir
output_dir=output_dir,
workflow = self
)
self.output_dir = Path(output_dir)
self.rocrate = None
......@@ -67,7 +70,9 @@ class Workflow:
repo = current_directory
return repo
def get_processes_annotation(self):
return self.processes_annotation
def fill_log(self):
current_directory = os.getcwd()
os.chdir(self.get_repo_adress())
......@@ -231,13 +236,33 @@ class Workflow:
def get_processes_called(self):
return self.nextflow_file.get_processes_called()
def get_tools(self):
processes = self.get_processes_called()
tab = []
for p in processes:
tab+=p.get_tools()
return list(set(tab))
def get_commands(self):
processes = self.get_processes_called()
tab = []
for p in processes:
tab+=p.get_commands()
return list(set(tab))
def get_modules(self):
processes = self.get_processes_called()
tab = []
for p in processes:
tab+=p.get_modules()
return list(set(tab))
def initialise_rocrate(self):
self.rocrate = RO_Crate(self)
self.rocrate.initialise()
def initialise(self, create_rocrate = True):
self.nextflow_file.initialise()
if(create_rocrate):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment