-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #569 from KnowledgeCaptureAndDiscovery/dev
Dev
- Loading branch information
Showing
7 changed files
with
132 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import re | ||
Galaxy_pattern = r"(?i)a[_\s-]?galaxy[_\s-]?workflow" | ||
CWL_pattern = r"\bclass:\s*[Ww]orkflow\b" | ||
Workflow_content_pattern = r"in:\s*[^}]*\s*out:\s*(?:\[.*?\]|.*?(?=\n\s*\S+:|$))" | ||
workflow_pattern=r'\bworkflow\b' | ||
Nextflow_pattern= r"(?i)nextflow[\s\S]*?(workflow\s*\{[\s\S]*?\})" | ||
|
||
def is_file_workflow(file_path): | ||
with open(file_path, 'r') as file: | ||
content = file.read() | ||
try: | ||
Galaxy_match=re.search(Galaxy_pattern,content) | ||
CWL_match=re.search(CWL_pattern,content) | ||
Workflow_match=re.search(Workflow_content_pattern,content) | ||
Workflow_match_2=re.search(workflow_pattern,content,re.IGNORECASE) | ||
Nextflow_match=re.search(Nextflow_pattern,content) | ||
if Galaxy_match or CWL_match or Workflow_match or Workflow_match_2 or Nextflow_match: | ||
return True | ||
else: | ||
return False | ||
except Exception: | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
version 1.0 | ||
|
||
|
||
import "../../structs/dna_seq_structs.wdl" | ||
import "../../structs/read_simulation_structs.wdl" | ||
|
||
import "../../tasks/pedigree_simulator_utils.wdl" | ||
import "../../tasks/JointReports.wdl" as reports | ||
|
||
import "../../subworkflows/SimulatedSingleFamily.wdl" as sub | ||
|
||
workflow SimulatedReads { | ||
|
||
input { | ||
ReferenceFasta references | ||
Family family | ||
Sequencing sequencing | ||
Int number_of_families | ||
Int global_seed | ||
Int max_cores | ||
Int n_chrom | ||
String? filters | ||
|
||
Int chunk_size = 5 | ||
Boolean gatk_mchap = false | ||
Boolean hardfilters = true | ||
Boolean replaceAD = true | ||
} | ||
|
||
# ProduceFamiliesSeeds just generates random seeds. It returns an | ||
# array of integers | ||
call pedigree_simulator_utils.ProduceFamiliesSeeds { | ||
input: | ||
global_seed= global_seed, | ||
number_of_families=number_of_families | ||
} | ||
|
||
# Here we generate Family objects on the fly, based on the values | ||
# from the family and the random seed of the previous task. | ||
scatter (seed in ProduceFamiliesSeeds.seeds) { | ||
# Calling reads_simu for each seed | ||
call sub.SimulatedSingleFamily { | ||
input: | ||
references=references, | ||
family=family, | ||
sequencing = sequencing, | ||
max_cores = max_cores, | ||
filters = filters, | ||
ploidy = family.ploidy, | ||
chunk_size = chunk_size, | ||
gatk_mchap=gatk_mchap, | ||
hardfilters = hardfilters, | ||
replaceAD = replaceAD, | ||
n_chrom = n_chrom | ||
} | ||
} | ||
|
||
call reports.JointTablesSimu { | ||
input: | ||
data1_depths_geno_prob = SimulatedSingleFamily.data1_depths_geno_prob, | ||
data2_maps = SimulatedSingleFamily.data2_maps, | ||
data3_filters = SimulatedSingleFamily.data3_filters, | ||
data5_SNPCall_efficiency = SimulatedSingleFamily.data5_SNPCall_efficiency, | ||
data4_times = SimulatedSingleFamily.data4_times, | ||
data6_RDatas = SimulatedSingleFamily.data6_RDatas, | ||
data7_gusmap = SimulatedSingleFamily.data7_gusmap, | ||
data8_names = SimulatedSingleFamily.data8_names, | ||
data9_simu_haplo = SimulatedSingleFamily.simu_haplo, | ||
data10_counts = SimulatedSingleFamily.data10_counts, | ||
depth = sequencing.depth, | ||
plots = SimulatedSingleFamily.Plots, | ||
positions = SimulatedSingleFamily.positions | ||
} | ||
|
||
# Here you can reference outputs from the sub workflow. Remember that | ||
# it will be an array of the same type of the original. | ||
output { | ||
File results = JointTablesSimu.results | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import unittest | ||
import os | ||
from pathlib import Path | ||
|
||
from .. import extract_workflows | ||
|
||
test_data_repositories = str(Path(__file__).parent / "test_data" ) + os.path.sep | ||
|
||
class TestWorkflows(unittest.TestCase): | ||
def test_is_workflow(self): | ||
|
||
workflow = extract_workflows.is_file_workflow(test_data_repositories + "SimulatedReads2Map.wdl") | ||
assert workflow, "The file does contain a workflow." | ||
|
||
def test_is_workflow_fake(self): | ||
workflow = extract_workflows.is_file_workflow(test_data_repositories + "repositories/wav2letter/scripts/arrayfire_parser.py") | ||
assert(workflow is False) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters