Skip to content

Commit

Permalink
Reply @sateeshperi review. Still missing local modules tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mazzalab committed Oct 28, 2024
1 parent 7fbaf48 commit 6389825
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 42 deletions.
4 changes: 0 additions & 4 deletions main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,6 @@ workflow NFCORE_FASTQREPAIR {
FASTQREPAIR (
samplesheet
)

// emit:
// multiqc_report = FASTQREPAIR.out.multiqc_report // channel: /path/to/multiqc_report.html

}
/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
7 changes: 0 additions & 7 deletions modules/local/bbmaprepair/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,10 @@ process BBMAPREPAIR {
task.ext.when == null || task.ext.when

script:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"

def infastq1 = fastq[0]
def infastq2 = fastq[1]
def outfastq1 = infastq1.baseName
def outfastq2 = infastq2.baseName

"""
repair.sh qin=${params.qin} in=${infastq1} in2=${infastq2} out=${outfastq1}_interleaving.fastq.gz out2=${outfastq2}_interleaving.fastq.gz outsingle=${fastq[0].baseName}_singletons.fastq.gz 2> ${fastq[0].baseName}_repair.log
Expand All @@ -35,9 +31,6 @@ process BBMAPREPAIR {
"""

stub:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"

def infastq1 = fastq[0]
def infastq2 = fastq[1]
def outfastq1 = infastq1.baseName
Expand Down
6 changes: 1 addition & 5 deletions modules/local/gzrt/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@ process GZRT {
task.ext.when == null || task.ext.when

script:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
def filename = "${fastqgz.baseName}"

"""
ver_line=""
if [[ $fastqgz == *.fastq ]] || [[ $fastqgz == *.fq ]]; then
Expand All @@ -35,8 +32,7 @@ process GZRT {
"""

stub:
def args = task.ext.args ?: ''

def filename = "${fastqgz.baseName}"
"""
ver_line=""
if [[ $fastqgz == *.fastq ]] || [[ $fastqgz == *.fq ]]; then
Expand Down
36 changes: 29 additions & 7 deletions modules/local/renamer/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ process RENAMER {
task.ext.when == null || task.ext.when

script:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta_fastq.id}"
def VERSION = '1.0.1' // WARN: Version information not provided by tool on CLI. Please update this string when bumping container versions.

def fq1 = fastq[0]
def fq2 = fastq[1]

Expand Down Expand Up @@ -66,20 +66,27 @@ process RENAMER {
cat <<-END_VERSIONS > versions.yml
"${task.process}":
renamer: 1.0.0
renamer: $VERSION
END_VERSIONS
"""

stub:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta_fastq.id}"
def VERSION = '1.0.1' // WARN: Version information not provided by tool on CLI. Please update this string when bumping container versions.

def fq1 = fastq[0]
def fq2 = fastq[1]
def new_name_fq1 = "${meta_fastq.id}_R1_repaired.fastq.gz"
def new_name_fq2 = "${meta_fastq.id}_R2_repaired.fastq.gz"
def new_name_fqsingle = "${meta_fastq.id}_repaired.fastq.gz"
def is_single_end_fq = "${meta_fastq.single_end}".toBoolean()

def rep1 = report[0]
def new_name_rep1 = "${meta_report.id}_R1_report.txt"
def new_name_rep2 = "${meta_report.id}_R2_report.txt"
def new_name_repsingle = "${meta_report.id}_report.txt"
def is_single_end_report = "${meta_report.single_end}".toBoolean()

"""
# Rename FASTQ files
if [[ ${is_single_end_fq} = true ]]; then
# No second file, treat as single-end
touch ${new_name_fqsingle}
Expand All @@ -95,9 +102,24 @@ process RENAMER {
touch "${new_name_fq2}"
fi
# Rename REPORT files
if [[ ${is_single_end_report} = true ]]; then
touch ${new_name_repsingle}
elif [[ "${rep1}" == *"R2.fastq_recovered_merged_report.txt" ]]; then
new_name_rep1="${meta_report.id}_R2_report.txt"
new_name_rep2="${meta_report.id}_R1_report.txt"
touch "${new_name_rep1}"
touch "${new_name_rep2}"
elif [[ "${rep1}" == *"R1.fastq_recovered_merged_report.txt" ]]; then
new_name_rep2="${meta_report.id}_R2_report.txt"
new_name_rep1="${meta_report.id}_R1_report.txt"
touch "${new_name_rep1}"
touch "${new_name_rep2}"
fi
cat <<-END_VERSIONS > versions.yml
"${task.process}":
renamer: 1.0.0
renamer: $VERSION
END_VERSIONS
"""
}
14 changes: 5 additions & 9 deletions modules/local/wipertools/gather.nf
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ process GATHER {

input:
tuple val(filename), val(meta), path(fastq_list)
tuple val(filename), val(meta), path(report_list)
tuple val(report_filename), val(report_meta), path(report_list)

output:
tuple val(meta), path("*merged_wiped.fastq.gz"), emit: fastq_merged_fixed
Expand All @@ -16,32 +16,28 @@ process GATHER {
task.ext.when == null || task.ext.when

script:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
def VERSION = '1.0.0' // WARN: Version information not provided by tool on CLI. Please update this string when bumping container versions.
def VERSION = '1.0.1' // WARN: Version information not provided by tool on CLI. Please update this string when bumping container versions.

"""
cat ${fastq_list} > ${filename}_merged_wiped.fastq.gz
wipertools summarygather -s ${report_list} -f ${filename}_merged_report.txt
cat <<-END_VERSIONS > versions.yml
"${task.process}":
wipertools: $VERSION
wipertools: $VERSION
END_VERSIONS
"""

stub:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
def VERSION = '1.0.0' // WARN: Version information not provided by tool on CLI. Please update this string when bumping container versions.
def VERSION = '1.0.1' // WARN: Version information not provided by tool on CLI. Please update this string when bumping container versions.

"""
gzip < /dev/null > ${filename}_merged_wiped.fastq.gz
touch ${filename}_merged_report.txt
cat <<-END_VERSIONS > versions.yml
"${task.process}":
wipertools: $VERSION
wipertools: $VERSION
END_VERSIONS
"""
}
7 changes: 2 additions & 5 deletions modules/local/wipertools/scatter.nf
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,11 @@ process SCATTER {
tuple val(meta), path("*_chunk.*.fastq"), emit: fastq_chunks
path "versions.yml" , emit: versions

// when:
// task.max_cpus > 1

script:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
def filename = "${fastq.baseName}"
def VERSION = '1.0.0' // WARN: Version information not provided by tool on CLI. Please update this string when bumping container versions.
def VERSION = '1.0.1' // WARN: Version information not provided by tool on CLI. Please update this string when bumping container versions.

"""
split -a3 -l ${params.chunk_size} --numeric-suffixes=1 --additional-suffix .fastq ${fastq} ${filename}_chunk.
Expand All @@ -31,7 +28,7 @@ process SCATTER {
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
def filename = "${fastq.baseName}"
def VERSION = '1.0.0' // WARN: Version information not provided by tool on CLI. Please update this string when bumping container versions.
def VERSION = '1.0.1' // WARN: Version information not provided by tool on CLI. Please update this string when bumping container versions.

"""
touch ${filename}_chunk.001.fastq
Expand Down
4 changes: 2 additions & 2 deletions modules/local/wipertools/wipe.nf
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ process WIPER {
script:
def args = task.ext.args ?: ''
def filename = "${fastq.baseName}"
def VERSION = '1.0.0' // WARN: Version information not provided by tool on CLI. Please update this string when bumping container versions.
def VERSION = '1.0.1' // WARN: Version information not provided by tool on CLI. Please update this string when bumping container versions.
def log_freq = (params.chunk_size / 100 as Integer) * 10
log_freq = log_freq == 0 ? 1 : log_freq

Expand All @@ -33,7 +33,7 @@ process WIPER {
stub:
def args = task.ext.args ?: ''
def filename = "${fastq.baseName}"
def VERSION = '1.0.0' // WARN: Version information not provided by tool on CLI. Please update this string when bumping container versions.
def VERSION = '1.0.1' // WARN: Version information not provided by tool on CLI. Please update this string when bumping container versions.
"""
touch ${filename}_wiped.fastq.gz
touch ${filename}_report.txt
Expand Down
4 changes: 1 addition & 3 deletions subworkflows/local/utils_nfcore_fastqrepair_pipeline/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ workflow PIPELINE_COMPLETION {
outdir // path: Path to output directory where results will be published
monochrome_logs // boolean: Disable ANSI colour codes in log output
hook_url // string: hook URL for notifications
// multiqc_report // string: Path to MultiQC report

main:
summary_params = paramsSummaryMap(workflow, parameters_schema: "nextflow_schema.json")
Expand All @@ -130,8 +129,7 @@ workflow PIPELINE_COMPLETION {
email_on_fail,
plaintext_email,
outdir,
monochrome_logs,
multiqc_report.toList()
monochrome_logs
)
}

Expand Down

0 comments on commit 6389825

Please sign in to comment.