Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added stub logic and test to fastq_fastqc_umitools_fastp #5858

Merged
merged 2 commits into from
Jun 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions subworkflows/nf-core/fastq_fastqc_umitools_fastp/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,18 @@ include { FASTP } from '../../../modules/nf-core/fastp/main'
//
import groovy.json.JsonSlurper

def getFastpReadsAfterFiltering(json_file) {
def getFastpReadsAfterFiltering(json_file, min_num_reads) {

if ( workflow.stubRun ) { return min_num_reads }

def Map json = (Map) new JsonSlurper().parseText(json_file.text).get('summary')
return json['after_filtering']['total_reads'].toLong()
}

def getFastpAdapterSequence(json_file){

if ( workflow.stubRun ) { return "" }

def Map json = (Map) new JsonSlurper().parseText(json_file.text)
try{
adapter = json['adapter_cutting']['read1_adapter_sequence']
Expand Down Expand Up @@ -109,7 +115,7 @@ workflow FASTQ_FASTQC_UMITOOLS_FASTP {
.out
.reads
.join(trim_json)
.map { meta, reads, json -> [ meta, reads, getFastpReadsAfterFiltering(json) ] }
.map { meta, reads, json -> [ meta, reads, getFastpReadsAfterFiltering(json, min_trimmed_reads.toLong()) ] }
.set { ch_num_trimmed_reads }

ch_num_trimmed_reads
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -559,4 +559,49 @@ nextflow_workflow {
)
}
}

test("sarscov2 paired-end [fastq] - stub") {

options '-stub'

when {
workflow {
"""
skip_fastqc = false
with_umi = false
skip_umi_extract = false
umi_discard_read = 1
skip_trimming = false
adapter_fasta = []
save_trimmed_fail = false
save_merged = false
min_trimmed_reads = 1

input[0] = Channel.of([
[ id:'test', single_end:false ], // meta map
[
file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_2.fastq.gz', checkIfExists: true)
]
])
input[1] = skip_fastqc
input[2] = with_umi
input[3] = skip_umi_extract
input[4] = umi_discard_read
input[5] = skip_trimming
input[6] = adapter_fasta
input[7] = save_trimmed_fail
input[8] = save_merged
input[9] = min_trimmed_reads
"""
}
}

then {
assertAll(
{ assert workflow.success },
{ assert snapshot(workflow.out).match() }
)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -545,5 +545,230 @@
"nextflow": "24.04.2"
},
"timestamp": "2024-06-10T15:08:32.267769943"
},
"sarscov2 paired-end [fastq] - stub": {
"content": [
{
"0": [
[
{
"id": "test",
"single_end": false
},
[
"test_1.fastp.fastq.gz:md5,68b329da9893e34099c7d8ad5cb9c940",
"test_2.fastp.fastq.gz:md5,68b329da9893e34099c7d8ad5cb9c940"
]
]
],
"1": [
[
{
"id": "test",
"single_end": false
},
"test.html:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"10": [
[
{
"id": "test",
"single_end": false
},
1
]
],
"11": [
[
{
"id": "test",
"single_end": false
},
"test.html:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"12": [
[
{
"id": "test",
"single_end": false
},
"test.zip:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"13": [
"versions.yml:md5,85bd0117e5778fff18e3920972a296ad",
"versions.yml:md5,c50aa59475ab901bc6f9a2cf7b1a14e0",
"versions.yml:md5,f3dcaae948e8eed92b4a5557b4c6668e"
],
"2": [
[
{
"id": "test",
"single_end": false
},
"test.zip:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"3": [

],
"4": [
[
{
"id": "test",
"single_end": false
},
""
]
],
"5": [
[
{
"id": "test",
"single_end": false
},
"test.fastp.json:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"6": [
[
{
"id": "test",
"single_end": false
},
"test.fastp.html:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"7": [
[
{
"id": "test",
"single_end": false
},
"test.fastp.log:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"8": [

],
"9": [

],
"adapter_seq": [
[
{
"id": "test",
"single_end": false
},
""
]
],
"fastqc_raw_html": [
[
{
"id": "test",
"single_end": false
},
"test.html:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"fastqc_raw_zip": [
[
{
"id": "test",
"single_end": false
},
"test.zip:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"fastqc_trim_html": [
[
{
"id": "test",
"single_end": false
},
"test.html:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"fastqc_trim_zip": [
[
{
"id": "test",
"single_end": false
},
"test.zip:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"reads": [
[
{
"id": "test",
"single_end": false
},
[
"test_1.fastp.fastq.gz:md5,68b329da9893e34099c7d8ad5cb9c940",
"test_2.fastp.fastq.gz:md5,68b329da9893e34099c7d8ad5cb9c940"
]
]
],
"trim_html": [
[
{
"id": "test",
"single_end": false
},
"test.fastp.html:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"trim_json": [
[
{
"id": "test",
"single_end": false
},
"test.fastp.json:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"trim_log": [
[
{
"id": "test",
"single_end": false
},
"test.fastp.log:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"trim_read_count": [
[
{
"id": "test",
"single_end": false
},
1
]
],
"trim_reads_fail": [

],
"trim_reads_merged": [

],
"umi_log": [

],
"versions": [
"versions.yml:md5,85bd0117e5778fff18e3920972a296ad",
"versions.yml:md5,c50aa59475ab901bc6f9a2cf7b1a14e0",
"versions.yml:md5,f3dcaae948e8eed92b4a5557b4c6668e"
]
}
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "24.04.2"
},
"timestamp": "2024-06-21T14:46:58.329605"
}
}
Loading