Skip to content

Commit

Permalink
Merge pull request #35 from phac-nml/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
mattheww95 committed Mar 5, 2024
2 parents 2a2a00e + 09cb226 commit 2cc089e
Show file tree
Hide file tree
Showing 17 changed files with 441 additions and 35 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,5 @@ Makefile
*.bak
docs/TODO.md
.git.bak
assets/schema_input_nfv2.0.0.json
nextflow_schema_nfv2.json
24 changes: 12 additions & 12 deletions assets/schema_input.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://raw.githubusercontent.com/phac-nml/mikrokondo/master/assets/schema_input.json",
"$schema": "http://json-schema.org/draft-07/schema",
"$id": "https://raw.githubusercontent.com/mk-kondo/mikrokondo/master/assets/schema_input.json",
"title": "Samplesheet schema validation",
"description": "Schema for the file provided with params.input",
"type": "array",
Expand All @@ -17,32 +17,32 @@
"type": "string",
"pattern": "^\\S+\\.f(ast)?q\\.gz$",
"errorMessage": "FastQ file for reads 1 (forward reads) must be provided, cannot contain spaces and must have extension '.fq.gz' or '.fastq.gz'. If this is meant to be a run of mikrokondo with long read data please specify the paths under long_reads",
"meta": ["fastq_1"]
"dependentRequired": ["fastq_2"],
"meta": ["fastq_1"],
"unique": true
},
"fastq_2": {
"type": "string",
"pattern": "^\\S+\\.f(ast)?q\\.gz$",
"errorMessage": "FastQ file for reads 2 (reverse reads) cannot contain spaces and must have extension '.fq.gz' or '.fastq.gz'",
"meta": ["fastq_2"]
"meta": ["fastq_2"],
"unique": true
},
"long_reads": {
"type": "string",
"pattern": "^\\S+\\.f(ast)?q\\.gz$",
"errorMessage": "FastQ file for long reads must be provided, cannot contain spaces and must have extension '.fq.gz' or '.fastq.gz'.",
"meta": ["long_reads"]
"meta": ["long_reads"],
"unique": true
},
"assembly": {
"type": "string",
"pattern": "^\\S+\\.f(ast)?n?a\\.gz$",
"errorMessage": "Fasta file, cannot contain spaces and must have extension '.fa.gz' or '.fasta.gz'.",
"meta": ["assembly"]
"meta": ["assembly"],
"unique": true
}
},
"required": ["sample"],
"dependentRequired": {
"fastq_2": ["fastq_1"]
},
"uniqueEntries": ["fastq_1", "fastq_2", "long_reads", "assembly"]
"required": ["sample"]
}
}

2 changes: 1 addition & 1 deletion main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ workflow MIKROKONDO {
def logger2 = LoggerFactory.getLogger(nextflow.script.ScriptBinding)
// This is working but if things get messy a better solution would be to look for a way to detach the console appender
logger2.setLevel(ch.qos.logback.classic.Level.ERROR)
validateParameters(monochrome_logs: true)
validateParameters(monochrome_logs: params.monochrome_logs, monochromeLogs: params.monochrome_logs)
logger2.setLevel(ch.qos.logback.classic.Level.DEBUG)
}

Expand Down
10 changes: 5 additions & 5 deletions nextflow.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mk-kondo/mikrokondo Nextflow config file
phac-nml/mikrokondo Nextflow config file
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Default config options for all compute environments
----------------------------------------------------------------------------------------
Expand Down Expand Up @@ -39,10 +39,10 @@ params {
// Sub sampling options
target_depth = 100

validate_params = false
validate_params = true
show_hidden_params = false
validationS3PathCheck = true
validationSchemaIgnoreParams = 'output_idx_name,filtered_reads,coverage_calc_fields,assembly_status,coverage_calc_fields.fixed_cov,coverage_calc_fields.auto_cov,assembly_status.report_tag,medaka.model,medaka,validation-S3Path-check,validationS3PathCheck,abricate,python3,pointfinder_db_tag,staramr,mobsuite_recon,skip_staramr,genomes,flye_read_type,shigeifinder,lissero,sistr,ectyper,bandage,bakta,unicycler,medaka,pilon_iterative,pilon,racon,samtools,minimap2,r_contaminants,mash,kraken,checkm,quast_filter,quast,fastqc,spades,flye,chopper,fastp,seqtk,seqtk_size,kat,coreutils,opt_platforms,QCReportFields,QCReport-fields,QCReport,kraken_bin,shigatyper,spatyper,kleborate,subtyping_report,kraken_species,top_hit_species,mash_meta,mlst,raw_reads,abricate_params,target_depth'
validationSchemaIgnoreParams = 'seqkit,contigs_too_short,output_idx_name,filtered_reads,coverage_calc_fields,assembly_status,coverage_calc_fields.fixed_cov,coverage_calc_fields.auto_cov,assembly_status.report_tag,medaka.model,medaka,validation-S3Path-check,validationS3PathCheck,abricate,python3,pointfinder_db_tag,staramr,mobsuite_recon,skip_staramr,genomes,flye_read_type,shigeifinder,lissero,sistr,ectyper,bandage,bakta,unicycler,medaka,pilon_iterative,pilon,racon,samtools,minimap2,r_contaminants,mash,kraken,checkm,quast_filter,quast,fastqc,spades,flye,chopper,fastp,seqtk,seqtk_size,kat,coreutils,opt_platforms,QCReportFields,QCReport-fields,QCReport,kraken_bin,shigatyper,spatyper,kleborate,subtyping_report,kraken_species,top_hit_species,mash_meta,mlst,raw_reads,abricate_params,target_depth'
validationFailUnrecognisedParams = false // for the qcreport fields

// SKIP options
Expand Down Expand Up @@ -922,8 +922,8 @@ profiles {
}

plugins {
id 'nf-validation'
// id [email protected]
//id 'nf-validation@2.0.0'
id '[email protected]'
id 'nf-prov'
}

Expand Down
24 changes: 12 additions & 12 deletions nextflow_schema.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$schema": "http://json-schema.org/draft-07/schema",
"$id": "https://raw.githubusercontent.com/phac-nml/mikrokondo/master/nextflow_schema.json",
"title": "mikrokondo pipeline parameters",
"description": "mikrokondo schema",
Expand Down Expand Up @@ -119,7 +119,7 @@
},
"QCReport.escherichia.max_checkm_contamination": {
"type": "number",
"default": 3,
"default": 3.0,
"hidden": true
},
"QCReport.escherichia.min_average_coverage": {
Expand Down Expand Up @@ -169,7 +169,7 @@
},
"QCReport.salmonella.max_checkm_contamination": {
"type": "number",
"default": 3,
"default": 3.0,
"hidden": true
},
"QCReport.salmonella.min_average_coverage": {
Expand Down Expand Up @@ -219,7 +219,7 @@
},
"QCReport.shigella.max_checkm_contamination": {
"type": "number",
"default": 3,
"default": 3.0,
"hidden": true
},
"QCReport.shigella.min_average_coverage": {
Expand Down Expand Up @@ -269,7 +269,7 @@
},
"QCReport.listeria.max_checkm_contamination": {
"type": "number",
"default": 3,
"default": 3.0,
"hidden": true
},
"QCReport.listeria.min_average_coverage": {
Expand Down Expand Up @@ -319,7 +319,7 @@
},
"QCReport.klebsiella.max_checkm_contamination": {
"type": "number",
"default": 3,
"default": 3.0,
"hidden": true
},
"QCReport.klebsiella.min_average_coverage": {
Expand Down Expand Up @@ -369,7 +369,7 @@
},
"QCReport.staphylococcus.max_checkm_contamination": {
"type": "number",
"default": 3,
"default": 3.0,
"hidden": true
},
"QCReport.staphylococcus.min_average_coverage": {
Expand Down Expand Up @@ -413,7 +413,7 @@
},
"QCReport.fallthrough.max_checkm_contamination": {
"type": "number",
"default": 3,
"default": 3.0,
"hidden": true
},
"QCReport.fallthrough.min_average_coverage": {
Expand Down Expand Up @@ -707,7 +707,7 @@
},
"QCReport.campylobacter_jejuni.max_checkm_contamination": {
"type": "number",
"default": 3,
"default": 3.0,
"hidden": true
},
"QCReport.campylobacter_jejuni.min_average_coverage": {
Expand Down Expand Up @@ -762,7 +762,7 @@
},
"QCReport.campylobacter_coli.max_checkm_contamination": {
"type": "number",
"default": 3,
"default": 3.0,
"hidden": true
},
"QCReport.campylobacter_coli.min_average_coverage": {
Expand Down Expand Up @@ -817,7 +817,7 @@
},
"QCReport.vibrio_cholerae.max_checkm_contamination": {
"type": "number",
"default": 3,
"default": 3.0,
"hidden": true
},
"QCReport.vibrio_cholerae.min_average_coverage": {
Expand Down Expand Up @@ -1568,8 +1568,8 @@
"validate_params": {
"type": "boolean",
"description": "Boolean whether to validate parameters against the schema at runtime",
"default": true,
"fa_icon": "fas fa-check-square",
"default": true,
"hidden": true
},
"show_hidden_params": {
Expand Down
1 change: 0 additions & 1 deletion subworkflows/local/input_check.nf
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ def format_reads(ArrayList sheet_data){
}
def ret_val = null


// A map could probably clean this up
if(sequencing_data.fastq_1 && sequencing_data.fastq_2 && sequencing_data.long_reads && !sequencing_data.assembly){
if(params.platform != params.opt_platforms.hybrid){
Expand Down
Binary file added tests/data/databases/campy-staph-ecoli.msh
Binary file not shown.
Binary file added tests/data/databases/campy.mmi
Binary file not shown.
Binary file added tests/data/reads/campy-staph1.fq.gz
Binary file not shown.
Binary file added tests/data/reads/campy-staph2.fq.gz
Binary file not shown.
8 changes: 4 additions & 4 deletions tests/data/sample1.fasta
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
>contig1
>contig1 length=1
A
>contig2
>contig2 length=2
AC
>contig3
>contig3 length=3
ACT
>contig4
>contig4 length=4
ACTG
6 changes: 6 additions & 0 deletions tests/data/sample2.fasta
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
>contig1 length=10
ATCGATCGAT
>contig2 length=20
ATCGATCGATATCGATCGAT
>contig3 length=30
ATCGATCGATATCGATCGATATCGATCGAT
2 changes: 2 additions & 0 deletions tests/data/samplesheets/samplesheet-campy-staph.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
sample,fastq_1,fastq_2,long_reads,assembly
CSE,https://github.com/phac-nml/mikrokondo/raw/dev/tests/data/reads/campy-staph1.fq.gz,https://github.com/phac-nml/mikrokondo/raw/dev/tests/data/reads/campy-staph2.fq.gz,,
39 changes: 39 additions & 0 deletions tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
nextflow_workflow {

name "Full Integration Tests for MIKROKONDO"
script "main.nf"
workflow "MIKROKONDO"

test("Should run without failures") {

when {
params {
input = "samplesheet-staph.csv"
platform = "illumina"
outdir = "results"
mash.mash_sketch = "campy-staph-ecoli.msh"
r_contaminants.mega_mm2_idx = "campy.mmi"
skip_bakta = true
skip_staramr = true
skip_mobrecon = true
skip_checkm = true
skip_raw_read_metrics = true
skip_polishing = true
max_memory = "4.GB"
max_cpus = 2
}
workflow {
"""
// define inputs of the workflow here. Example:
// input[0] = file("test-file.txt")
"""
}
}

then {
assert workflow.success
}

}

}
3 changes: 3 additions & 0 deletions tests/nextflow.config
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@
Nextflow config file for running tests
========================================================================================
*/

params.max_memory = "2.GB"
params.max_cpus = 1
Loading

0 comments on commit 2cc089e

Please sign in to comment.