Skip to content

Commit

Permalink
Added test for subsetTrim, but didn't get time for runQC
Browse files Browse the repository at this point in the history
  • Loading branch information
harmonbhasin committed Jan 16, 2025
1 parent 7c45ccc commit 1ca495d
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 0 deletions.
29 changes: 29 additions & 0 deletions tests/subworkflows/local/runQc/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
nextflow_workflow {

name "Test Workflow RUN_QC"
script "subworkflows/local/runQc/main.nf"
workflow "RUN_QC"

test("Should run without failures") {

when {
params {
// define parameters here. Example:
// outdir = "tests/results"
}
workflow {
"""
// define inputs of the workflow here. Example:
// input[0] = file("test-file.txt")
"""
}
}

then {
assert workflow.success
assert snapshot(workflow.out).match()
}

}

}
45 changes: 45 additions & 0 deletions tests/subworkflows/local/subsetTrim/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
nextflow_workflow {

name "Test Workflow SUBSET_TRIM"
script "subworkflows/local/subsetTrim/main.nf"
workflow "SUBSET_TRIM"

test("Should run without failures") {
config "tests/run.config"
setup {
run("LOAD_SAMPLESHEET") {
script "subworkflows/local/loadSampleSheet/main.nf"
process {
"""
input[0] = "/home/ec2-user/pipeline-development/bbduk-rearrangement/mgs-workflow/test-data/samplesheet.csv"
input[1] = false
input[2] = false
"""
}
}
}

when {
params {}
workflow {
"""
input[0] = LOAD_SAMPLESHEET.out.samplesheet // reads_ch
input[1] = LOAD_SAMPLESHEET.out.group // group_ch
input[2] = params.n_reads_profile // n_reads
input[3] = params.grouping // grouping
input[4] = params.adapters // adapter_path
input[5] = params.single_end // single_end
"""
}
}

then {
assert workflow.success
def countGzipLines = { file -> path(file).linesGzip.size() }
assert countGzipLines(workflow.out.subset_reads[0][1][0]) == 165 * 4
assert countGzipLines(workflow.out.trimmed_subset_reads[0][1][0]) == 135 * 4
}

}

}

0 comments on commit 1ca495d

Please sign in to comment.