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

Starting to add Ro-crate support

parent 311f78a1
No related branches found
No related tags found
No related merge requests found
...@@ -21,6 +21,27 @@ LIST_OPERATORS = ["distinct", "filter", "first", "last", "randomSample", "take", ...@@ -21,6 +21,27 @@ LIST_OPERATORS = ["distinct", "filter", "first", "last", "randomSample", "take",
"close","dump","ifEmpty","print","println","set","view", "close","dump","ifEmpty","print","println","set","view",
"empty", "of", "fromPath", "fromList", "subscribe", "value", "from"]#This last line is added by me:) "empty", "of", "fromPath", "fromList", "subscribe", "value", "from"]#This last line is added by me:)
TOOLS = [
"samtools",
"bcftools",
"fastqc",
"bedtools",
"multiqc",
"gatk",
"bwa",
"minimap2",
"tabix",
"vcf",
"wget",
"bgzip",
"hmmsearch",
"pigz",
"picard",
"star",
"iqtree",
"idxstats",
]
#========================== #==========================
# PATTERNS # PATTERNS
...@@ -122,3 +143,5 @@ SUBWORKFLOW_HEADER = r'workflow +(\w+|\'[\w ]+\'|\"[\w ]+\") *{' ...@@ -122,3 +143,5 @@ SUBWORKFLOW_HEADER = r'workflow +(\w+|\'[\w ]+\'|\"[\w ]+\") *{'
WORKFLOW_HEADER = r"workflow\s*\{" WORKFLOW_HEADER = r"workflow\s*\{"
WORKFLOW_HEADER_2 = r'[^\w](workflow\s*{)' WORKFLOW_HEADER_2 = r'[^\w](workflow\s*{)'
...@@ -19,6 +19,7 @@ class Process(Nextflow_Building_Blocks): ...@@ -19,6 +19,7 @@ class Process(Nextflow_Building_Blocks):
self.output_code = "" self.output_code = ""
self.when_code = "" self.when_code = ""
self.script_code = "" self.script_code = ""
self.tools = []
self.initialise() self.initialise()
self.initialised = True self.initialised = True
...@@ -71,6 +72,12 @@ class Process(Nextflow_Building_Blocks): ...@@ -71,6 +72,12 @@ class Process(Nextflow_Building_Blocks):
def get_nb_outputs(self): def get_nb_outputs(self):
return len(self.outputs) return len(self.outputs)
def extract_tools(self):
script = self.script_code.lower()
for tool in constant.TOOLS:
if tool in script:
self.tools.append(tool)
def initialise_parts(self): def initialise_parts(self):
code = self.get_code() code = self.get_code()
...@@ -126,6 +133,7 @@ class Process(Nextflow_Building_Blocks): ...@@ -126,6 +133,7 @@ class Process(Nextflow_Building_Blocks):
self.when_code = temp_code self.when_code = temp_code
elif(variables_index[i]=='script'): elif(variables_index[i]=='script'):
self.script_code = temp_code self.script_code = temp_code
self.extract_tools()
else: else:
raise Exception("This shoudn't happen!") raise Exception("This shoudn't happen!")
......
class RO_Crate:
def __init__(self, workflow):
self.nextflow_file = workflow
self.directroy = '/'.join(workflow.get_file_address().split('/')[:-1])
self.dico = {}
def initialise_dico(self):
None
def initialise(self):
self.initialise_dico()
print("i'm initialised")
\ No newline at end of file
from .nextflow_file import Nextflow_File
from .ro_crate import RO_Crate
class Workflow:
def __init__(self, file, duplicate=False, display_info=True):
self.nextflow_file = Nextflow_File(file, duplicate = duplicate, display_info = display_info)
self.rocrate = None
def get_file_address(self):
return self.nextflow_file.get_file_address()
def initialise_rocrate(self):
self.rocrate = RO_Crate(self)
self.rocrate.initialise()
def initialise(self):
self.nextflow_file.initialise()
self.initialise_rocrate()
def generate_all_graphs(self, render_graphs = True):
self.nextflow_file.generate_all_graphs(render_graphs = render_graphs)
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