single and paired end supported

This commit is contained in:
Piotr Faba 2020-03-06 13:23:12 +00:00
parent 88bc7dcdd8
commit 490eca706c
6 changed files with 75 additions and 34 deletions

View file

@ -4,24 +4,42 @@ process cutadapt {
container 'quay.io/biocontainers/cutadapt:1.16--py27_1'
input:
tuple sample_id, file(input_forward_fq), file(input_reverse_fq)
tuple val(sample_id), file(reads)
output:
tuple sample_id, file(forward_fq), file(reverse_fq)
tuple sample_id, file("trimmed_*.fastq")
script:
forward_fq = "trimmed_forward.fastq"
reverse_fq = "trimmed_reverse.fastq"
forward_fq = "trimmed_1.fastq"
reverse_fq = "trimmed_2.fastq"
if (params.singleEnd) {
processing = """
cutadapt \
-j ${task.cpus} \
-q $params.cutadapt_min_quality \
--minimum-length $params.cutadapt_min_length \
--output ${forward_fq} \
${reads}
"""
} else {
processing = """
cutadapt \
-j ${task.cpus} \
-q $params.cutadapt_min_quality \
--minimum-length $params.cutadapt_min_length \
--pair-filter=any \
--output ${forward_fq} \
--paired-output ${reverse_fq} '${input_forward_fq}' '${input_reverse_fq}'
--paired-output ${reverse_fq} ${reads}
"""
}
version = """
cutadapt --version &> v_cutadapt.txt
"""
return processing + version
}

View file

@ -1,22 +0,0 @@
#!/usr/bin/env nextflow
nextflow.preview.dsl = 2
include '../../../nf-core/module_testing/check_process_outputs.nf' params(params)
include '../main.nf' params(params)
// Define input channels
readPaths = [
[ sample: 'SRR4238351',
R1: '../../../test-datasets/tools/cutadapt/input/SRR396636.sra_1.fastq',
R2: '../../../test-datasets/tools/cutadapt/input/SRR396636.sra_2.fastq'
]
]
Channel
.from(readPaths)
.map { row -> tuple( row.sample_name, file(row.R1.trim()), file(row.R2.trim()) ) }
.set { ch_read_files }
// Run the workflow
workflow {
cutadapt(ch_read_files)
// .check_output()
}

View file

@ -0,0 +1,14 @@
#!/usr/bin/env nextflow
nextflow.preview.dsl = 2
include '../main.nf' params(params)
// Define input channels
Channel
.fromFilePairs('../../../test-datasets/tools/cutadapt/input/*_{1,2}.fastq' )
.set { ch_read_files }
// Run the workflow
workflow {
cutadapt(ch_read_files)
}

View file

@ -0,0 +1,9 @@
docker.enabled = true
params.outdir = './results'
params{
//preprocessing options
cutadapt_min_length = 40
cutadapt_min_quality = 25
singleEnd = false
}

View file

@ -0,0 +1,21 @@
#!/usr/bin/env nextflow
nextflow.preview.dsl = 2
include '../main.nf' params(params)
// Define input channels
readPaths = [
['SRR4238351', '../../../test-datasets/tools/fastqc/input/SRR4238351_subsamp.fastq.gz'],
['SRR4238355', '../../../test-datasets/tools/fastqc/input/SRR4238355_subsamp.fastq.gz'],
['SRR4238359', '../../../test-datasets/tools/fastqc/input/SRR4238359_subsamp.fastq.gz'],
['SRR4238379', '../../../test-datasets/tools/fastqc/input/SRR4238379_subsamp.fastq.gz']
]
Channel
.from(readPaths)
.map { row -> [ row[0], [ file(row[1]) ] ] }
.set { ch_read_files }
// Run the workflow
workflow {
cutadapt(ch_read_files)
}

View file

@ -5,4 +5,5 @@ params{
//preprocessing options
cutadapt_min_length = 40
cutadapt_min_quality = 25
singleEnd = true
}