mirror of
https://github.com/MillironX/nf-core_modules.git
synced 2024-12-22 11:08:17 +00:00
Replaced param with input val channel (#595)
* Replaced param with input val channel * Apply suggestions from code review Co-authored-by: Jose Espinosa-Carrasco <kadomu@gmail.com> Co-authored-by: Harshil Patel <drpatelh@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: Harshil Patel <drpatelh@users.noreply.github.com> * Apply suggestions from code review (missed one) * YAML lint Co-authored-by: Jose Espinosa-Carrasco <kadomu@gmail.com> Co-authored-by: Harshil Patel <drpatelh@users.noreply.github.com>
This commit is contained in:
parent
e4df336294
commit
10502399ad
3 changed files with 76 additions and 4 deletions
|
@ -20,6 +20,7 @@ process FASTP {
|
|||
|
||||
input:
|
||||
tuple val(meta), path(reads)
|
||||
val save_trimmed_fail
|
||||
|
||||
output:
|
||||
tuple val(meta), path('*.trim.fastq.gz'), emit: reads
|
||||
|
@ -34,7 +35,7 @@ process FASTP {
|
|||
def software = getSoftwareName(task.process)
|
||||
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
||||
if (meta.single_end) {
|
||||
def fail_fastq = params.save_trimmed_fail ? "--failed_out ${prefix}.fail.fastq.gz" : ''
|
||||
def fail_fastq = save_trimmed_fail ? "--failed_out ${prefix}.fail.fastq.gz" : ''
|
||||
"""
|
||||
[ ! -f ${prefix}.fastq.gz ] && ln -s $reads ${prefix}.fastq.gz
|
||||
fastp \\
|
||||
|
@ -49,7 +50,7 @@ process FASTP {
|
|||
echo \$(fastp --version 2>&1) | sed -e "s/fastp //g" > ${software}.version.txt
|
||||
"""
|
||||
} else {
|
||||
def fail_fastq = params.save_trimmed_fail ? "--unpaired1 ${prefix}_1.fail.fastq.gz --unpaired2 ${prefix}_2.fail.fastq.gz" : ''
|
||||
def fail_fastq = save_trimmed_fail ? "--unpaired1 ${prefix}_1.fail.fastq.gz --unpaired2 ${prefix}_2.fail.fastq.gz" : ''
|
||||
"""
|
||||
[ ! -f ${prefix}_1.fastq.gz ] && ln -s ${reads[0]} ${prefix}_1.fastq.gz
|
||||
[ ! -f ${prefix}_2.fastq.gz ] && ln -s ${reads[1]} ${prefix}_2.fastq.gz
|
||||
|
|
|
@ -11,8 +11,9 @@ workflow test_fastp_single_end {
|
|||
input = [ [ id:'test', single_end:true ], // meta map
|
||||
[ file(params.test_data['sarscov2']['illumina']['test_1_fastq_gz'], checkIfExists: true) ]
|
||||
]
|
||||
save_trimmed_fail = false
|
||||
|
||||
FASTP ( input )
|
||||
FASTP ( input, save_trimmed_fail )
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -23,7 +24,32 @@ workflow test_fastp_paired_end {
|
|||
[ file(params.test_data['sarscov2']['illumina']['test_1_fastq_gz'], checkIfExists: true),
|
||||
file(params.test_data['sarscov2']['illumina']['test_2_fastq_gz'], checkIfExists: true) ]
|
||||
]
|
||||
save_trimmed_fail = false
|
||||
|
||||
FASTP ( input )
|
||||
FASTP ( input, save_trimmed_fail )
|
||||
}
|
||||
|
||||
//
|
||||
// Test with single-end data with saving trimming fails
|
||||
//
|
||||
workflow test_fastp_single_end_trim_fail {
|
||||
input = [ [ id:'test', single_end:true ], // meta map
|
||||
[ file(params.test_data['sarscov2']['illumina']['test_1_fastq_gz'], checkIfExists: true) ]
|
||||
]
|
||||
save_trimmed_fail = true
|
||||
|
||||
FASTP ( input, save_trimmed_fail )
|
||||
}
|
||||
|
||||
//
|
||||
// Test with paired-end data with saving trimming fails
|
||||
//
|
||||
workflow test_fastp_paired_end_trim_fail {
|
||||
input = [ [ id:'test', single_end:false ], // meta map
|
||||
[ file(params.test_data['sarscov2']['illumina']['test_1_fastq_gz'], checkIfExists: true),
|
||||
file(params.test_data['sarscov2']['illumina']['test_2_fastq_gz'], checkIfExists: true) ]
|
||||
]
|
||||
save_trimmed_fail = true
|
||||
|
||||
FASTP ( input, save_trimmed_fail )
|
||||
}
|
||||
|
|
|
@ -36,3 +36,48 @@
|
|||
md5sum: e2257263668dc8a75d95475099fb472d
|
||||
- path: output/fastp/test_2.trim.fastq.gz
|
||||
md5sum: 9eff7203596580cc5e42aceab4a469df
|
||||
|
||||
- name: fastp test_fastp_single_end_trim_fail
|
||||
command: nextflow run tests/modules/fastp -entry test_fastp_single_end_trim_fail -c tests/config/nextflow.config
|
||||
tags:
|
||||
- fastp
|
||||
files:
|
||||
- path: output/fastp/test.fastp.html
|
||||
contains:
|
||||
- "Q20 bases:</td><td class='col2'>12.922000 K (92.984097%)"
|
||||
- "single end (151 cycles)"
|
||||
- path: output/fastp/test.fastp.log
|
||||
contains:
|
||||
- "Q20 bases: 12922(92.9841%)"
|
||||
- "reads passed filter: 99"
|
||||
- path: output/fastp/test.trim.fastq.gz
|
||||
md5sum: e2257263668dc8a75d95475099fb472d
|
||||
- path: output/fastp/test.fastp.json
|
||||
md5sum: ee65a46d6e59fa556f112727b8a902ce
|
||||
- path: output/fastp/test.fail.fastq.gz
|
||||
md5sum: de315d397c994d8e66bafc7a8dc11070
|
||||
|
||||
- name: fastp test_fastp_paired_end_trim_fail
|
||||
command: nextflow run tests/modules/fastp -entry test_fastp_paired_end_trim_fail -c tests/config/nextflow.config
|
||||
tags:
|
||||
- fastp
|
||||
files:
|
||||
- path: output/fastp/test.fastp.html
|
||||
contains:
|
||||
- "Q20 bases:</td><td class='col2'>25.719000 K (93.033098%)"
|
||||
- "The input has little adapter percentage (~0.000000%), probably it's trimmed before."
|
||||
- path: output/fastp/test.fastp.log
|
||||
contains:
|
||||
- "No adapter detected for read1"
|
||||
- "Q30 bases: 12281(88.3716%)"
|
||||
- path: output/fastp/test.fastp.json
|
||||
contains:
|
||||
- '"passed_filter_reads": 198'
|
||||
- path: output/fastp/test_1.trim.fastq.gz
|
||||
md5sum: e2257263668dc8a75d95475099fb472d
|
||||
- path: output/fastp/test_2.trim.fastq.gz
|
||||
md5sum: 9eff7203596580cc5e42aceab4a469df
|
||||
- path: output/fastp/test_1.fail.fastq.gz
|
||||
md5sum: e62ff0123a74adfc6903d59a449cbdb0
|
||||
- path: output/fastp/test_2.fail.fastq.gz
|
||||
md5sum: f52309b35a7c15cbd56a9c3906ef98a5
|
||||
|
|
Loading…
Reference in a new issue