-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add updates to modules and workflows, and example params (NYI) for tw…
…eaking options
- Loading branch information
Showing
5 changed files
with
107 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
process VARIABLEFILTER { | ||
tag "$meta.id" | ||
label 'process_medium' | ||
container "" | ||
|
||
input: | ||
tuple val(meta), file(reads), file(trimming) from itsStep3.join(itsStep3Trimming) | ||
|
||
output: | ||
tuple val(meta), file("${meta.id}.R1.filtered.fastq.gz") optional true, emit: filteredReadsR1 | ||
tuple val(meta), file("${meta.id}.R2.filtered.fastq.gz") optional true, emit: filteredReadsR2 | ||
tuple val(meta), file("${meta.id}.R[12].filtered.fastq.gz") optional true, emit: reads | ||
file "*.trimmed.txt", emit: read_tracking | ||
|
||
when: | ||
task.ext.when == null || task.ext.when | ||
|
||
script: | ||
def args = task.ext.args ?: '' | ||
def prefix = task.ext.prefix ?: "${meta.id}" | ||
""" | ||
#!/usr/bin/env Rscript | ||
suppressPackageStartupMessages(library(dada2)) | ||
suppressPackageStartupMessages(library(ShortRead)) | ||
suppressPackageStartupMessages(library(Biostrings)) | ||
out <- filterAndTrim(fwd = paste0("${meta.id}",".R1.cutadapt.fastq.gz"), | ||
filt = paste0("${meta.id}", ".R1.filtered.fastq.gz"), | ||
rev = if("${reads[1]}" == "null") NULL else paste0("${meta.id}",".R2.cutadapt.fastq.gz"), | ||
filt.rev = if("${reads[1]}" == "null") NULL else paste0("${meta.id}", ".R2.filtered.fastq.gz"), | ||
maxEE = if("${reads[1]}" == "null") ${params.maxEEFor} else c(${params.maxEEFor}, ${params.maxEERev}), | ||
truncQ = ${params.truncQ}, | ||
rm.phix = as.logical(${params.rmPhiX}), | ||
maxLen = ${params.max_read_len}, | ||
minLen = ${params.min_read_len}, | ||
compress = TRUE, | ||
verbose = TRUE, | ||
multithread = ${task.cpus}) | ||
#Change input read counts to actual raw read counts | ||
colnames(out) <- c('cutadapt', 'filtered') | ||
write.csv(out3, paste0("${meta.id}", ".trimmed.txt")) | ||
""" | ||
|
||
stub: | ||
def args = task.ext.args ?: '' | ||
def prefix = task.ext.prefix ?: "${meta.id}" | ||
""" | ||
touch "${meta.id}.trimmed.txt" | ||
cat <<-END_VERSIONS > versions.yml | ||
"${task.process}": | ||
variablefilter: \$(samtools --version |& sed '1!d ; s/samtools //') | ||
END_VERSIONS | ||
""" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
process VARIABLE_TRIM { | ||
tag "$meta.id" | ||
label 'process_medium' | ||
|
||
container 'quay.io/biocontainers/cutadapt:4.1--py310h1425a21_1' | ||
|
||
input: | ||
tuple val(meta), path(reads) | ||
tuple val(for_primer), val(rev_primer) | ||
tuple val(for_primer_rc), val(rev_primer_rc) | ||
|
||
output: | ||
tuple val(meta), file("${meta.id}.R[12].cutadapt.fastq.gz") optional true, emit: trimmed_reads | ||
file("*.cutadapt.out") into cutadaptToMultiQC | ||
// path "versions.yml" , emit: versions | ||
|
||
when: | ||
task.ext.when == null || task.ext.when | ||
|
||
script: | ||
outr2 = meta.single_end ? '' : "-p ${meta.id}.R2.cutadapt.fastq.gz" | ||
p2 = meta.single_end ? '' : "-G ${rev_primer} -A ${rev_primer_rc}" | ||
""" | ||
cutadapt -g ${for_primer} -a ${for_primer_rc} ${p2} \\ | ||
--cores ${task.cpus} \\ | ||
--max-N ${params.maxN} \\ | ||
-n 2 \\ | ||
-o ${meta.id}.R1.cutadapt.fastq.gz ${outr2} \\ | ||
${reads} > ${meta.id}.cutadapt.out | ||
""" | ||
|
||
stub: | ||
def args = task.ext.args ?: '' | ||
def prefix = task.ext.prefix ?: "${meta.id}" | ||
""" | ||
echo "" | gzip > "${meta.id}.R1.cutadapt.fastq.gz" | ||
touch ${meta.id}.cutadapt.out | ||
""" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters