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

tweaks filtered fastq filenames and limits large file outputs #3

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
49 changes: 42 additions & 7 deletions conf/modules.config
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,29 @@ process {
publishDir = [
path: { "${params.outdir}/mapping-bp" },
mode: params.publish_dir_mode,
saveAs: { filename -> filename.equals('versions.yml') ? null : filename }
saveAs: { filename ->
if (filename.equals('versions.yml')){ null }
else if (filename.endsWith('.bam') || filename.endsWith('.bam.bai')){
if ( params.keep_big_files == true ) { filename }
else { null }
}
else { filename }
}
]
}
withName: SAMTOOLS_DEPTH {
ext.args = '-aa'
publishDir = [
path: { "${params.outdir}/mapping-bp" },
mode: params.publish_dir_mode,
saveAs: { filename -> filename.equals('versions.yml') ? null : filename }
saveAs: { filename ->
if (filename.equals('versions.yml')){ null }
else if ( filename.endsWith('bp-depth.tsv') ){
if ( params.keep_big_files == true ) { filename }
else { null }
}
else { filename }
}
]
}
withName: HS_FLAGSTAT {
Expand All @@ -81,17 +95,24 @@ process {
withName: HS_FASTQ {
ext.args = '-N'
ext.suffix = 'hs-unmapped.'
ext.filt = 'hs-unmapped.'
ext.filt = 'hs-unmapped'
publishDir = [
path: { "${params.outdir}/mapping-hs" },
mode: params.publish_dir_mode,
saveAs: { filename -> filename.equals('versions.yml') ? null : filename }
saveAs: { filename ->
if (filename.equals('versions.yml')){ null }
else if ( filename.endsWith('fastq.gz') ){
if ( params.keep_big_files == true ) { filename }
else { null }
}
else { filename }
}
]
}
withName: BP_FASTQ {
ext.args = '-N'
ext.suffix = 'bp-mapped.'
ext.filt = 'filtered.'
ext.filt = 'filtered'
publishDir = [
path: { "${params.outdir}/filteredreads" },
mode: params.publish_dir_mode,
Expand All @@ -111,15 +132,29 @@ process {
publishDir = [
path: { "${params.outdir}/mapping-hs" },
mode: params.publish_dir_mode,
saveAs: { filename -> filename.equals('versions.yml') ? null : filename }
saveAs: { filename ->
if (filename.equals('versions.yml')){ null }
else if ( filename.endsWith('.bam') ){
if ( params.keep_big_files == true ) { filename }
else { null }
}
else { filename }
}
]
}
withName: BP_ALIGN {
ext.args = '--local'
publishDir = [
path: { "${params.outdir}/mapping-bp" },
mode: params.publish_dir_mode,
saveAs: { filename -> filename.equals('versions.yml') ? null : filename }
saveAs: { filename ->
if (filename.equals('versions.yml')){ null }
else if (filename.endsWith('.bam')){
if ( params.keep_big_files == true ) { filename }
else { null }
}
else { filename }
}
]
}
withName: BLASTN_PAIRWISE {
Expand Down
4 changes: 2 additions & 2 deletions modules/nf-core/modules/nf-core/samtools/fastq/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ process SAMTOOLS_FASTQ {
val(interleave)

output:
tuple val(meta), path("*.R{1,2}.fastq.gz") , optional:true, emit: fastq
tuple val(meta), path("*_R{1,2}_*.fastq.gz") , optional:true, emit: fastq
tuple val(meta), path("*_interleaved.fastq.gz"), optional:true, emit: interleaved
tuple val(meta), path("*_singleton.fastq.gz") , optional:true, emit: singleton
tuple val(meta), path("*_other.fastq.gz") , optional:true, emit: other
Expand All @@ -28,7 +28,7 @@ process SAMTOOLS_FASTQ {
def filt = task.ext.filt ?: ''
def output = ( interleave && ! meta.single_end ) ? "> ${prefix}_interleaved.fastq.gz" :
meta.single_end ? "-1 ${prefix}_1.fastq.gz -s ${prefix}_singleton.fastq.gz" :
"-1 ${prefix}.${filt}R1.fastq.gz -2 ${prefix}.${filt}R2.fastq.gz" // -s ${prefix}_singleton.fastq.gz"
"-1 ${prefix}_R1_${filt}.fastq.gz -2 ${prefix}_R2_${filt}.fastq.gz" // -s ${prefix}_singleton.fastq.gz"
"""
samtools sort -n --threads ${task.cpus-1} $input -o ${prefix}.${suffix}namesort.bam
samtools \\
Expand Down
1 change: 1 addition & 0 deletions nextflow.config
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ params {
genome = null
igenomes_base = 's3://ngi-igenomes/igenomes'
igenomes_ignore = false
keep_big_files = false // option to keep mapping results

// MultiQC options
multiqc_config = null
Expand Down
6 changes: 6 additions & 0 deletions nextflow_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@
"type": "string",
"description": "MultiQC report title. Printed as page header, used for filename if not otherwise specified.",
"fa_icon": "fas fa-file-signature"
},
"keep_big_files": {
"type": "boolean",
"description": "Option to keep large intermediate *bam and *fastq files.",
"default": false,
"fa_icon": "fas fa-floppy-disk"
}
}
},
Expand Down