Skip to content

Commit

Permalink
improve code formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
mazzalab committed Oct 29, 2024
1 parent 55e5a02 commit dff4907
Show file tree
Hide file tree
Showing 5 changed files with 138 additions and 138 deletions.
50 changes: 25 additions & 25 deletions modules/local/bbmaprepair/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -17,33 +17,33 @@ process BBMAPREPAIR {
task.ext.when == null || task.ext.when

script:
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
cat <<-END_VERSIONS > versions.yml
"${task.process}":
repair.sh: \$(bbversion.sh)
END_VERSIONS
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
cat <<-END_VERSIONS > versions.yml
"${task.process}":
repair.sh: \$(bbversion.sh)
END_VERSIONS
"""

stub:
def infastq1 = fastq[0]
def infastq2 = fastq[1]
def outfastq1 = infastq1.baseName
def outfastq2 = infastq2.baseName
"""
touch ${outfastq1}_interleaving.fastq.gz
touch ${outfastq2}_interleaving.fastq.gz
touch ${fastq[0].baseName}_singletons.fastq.gz
touch ${fastq[0].baseName}_repair.log
cat <<-END_VERSIONS > versions.yml
"${task.process}":
repair.sh: \$(bbversion.sh)
END_VERSIONS
def infastq1 = fastq[0]
def infastq2 = fastq[1]
def outfastq1 = infastq1.baseName
def outfastq2 = infastq2.baseName
"""
touch ${outfastq1}_interleaving.fastq.gz
touch ${outfastq2}_interleaving.fastq.gz
touch ${fastq[0].baseName}_singletons.fastq.gz
touch ${fastq[0].baseName}_repair.log
cat <<-END_VERSIONS > versions.yml
"${task.process}":
repair.sh: \$(bbversion.sh)
END_VERSIONS
"""
}
98 changes: 49 additions & 49 deletions modules/local/renamer/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -15,59 +15,59 @@ process RENAMER {
task.ext.when == null || task.ext.when

script:
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 VERSION = '1.0.1' // WARN: Version information not provided by tool on CLI. Please update this string when bumping container versions.

def rep1 = report[0]
def rep2 = report[1]
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()
def fq1 = fastq[0]
def fq2 = fastq[1]

"""
# Rename FASTQ files
if [[ ${is_single_end_fq} = true ]]; then
# No second file, treat as single-end
cp ${fq1} ${new_name_fqsingle}
elif [[ "${fq1}" == *"trim_2.fastq_interleaving.fastq.gz" ]]; then
new_name_fq1="${meta_fastq.id}_R2_repaired.fastq.gz"
new_name_fq2="${meta_fastq.id}_R1_repaired.fastq.gz"
cp "${fq1}" "${new_name_fq1}"
cp "${fq2}" "${new_name_fq2}"
elif [[ "${fq1}" == *"trim_1.fastq_interleaving.fastq.gz" ]]; then
new_name_fq2="${meta_fastq.id}_R2_repaired.fastq.gz"
new_name_fq1="${meta_fastq.id}_R1_repaired.fastq.gz"
cp "${fq1}" "${new_name_fq1}"
cp "${fq2}" "${new_name_fq2}"
fi
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()

# Rename REPORT files
if [[ ${is_single_end_report} = true ]]; then
cp ${rep1} ${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"
cp "${rep1}" "${new_name_rep1}"
cp "${rep2}" "${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"
cp "${rep1}" "${new_name_rep1}"
cp "${rep2}" "${new_name_rep2}"
fi
def rep1 = report[0]
def rep2 = report[1]
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()

cat <<-END_VERSIONS > versions.yml
"${task.process}":
renamer: $VERSION
END_VERSIONS
"""
# Rename FASTQ files
if [[ ${is_single_end_fq} = true ]]; then
# No second file, treat as single-end
cp ${fq1} ${new_name_fqsingle}
elif [[ "${fq1}" == *"trim_2.fastq_interleaving.fastq.gz" ]]; then
new_name_fq1="${meta_fastq.id}_R2_repaired.fastq.gz"
new_name_fq2="${meta_fastq.id}_R1_repaired.fastq.gz"
cp "${fq1}" "${new_name_fq1}"
cp "${fq2}" "${new_name_fq2}"
elif [[ "${fq1}" == *"trim_1.fastq_interleaving.fastq.gz" ]]; then
new_name_fq2="${meta_fastq.id}_R2_repaired.fastq.gz"
new_name_fq1="${meta_fastq.id}_R1_repaired.fastq.gz"
cp "${fq1}" "${new_name_fq1}"
cp "${fq2}" "${new_name_fq2}"
fi
# Rename REPORT files
if [[ ${is_single_end_report} = true ]]; then
cp ${rep1} ${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"
cp "${rep1}" "${new_name_rep1}"
cp "${rep2}" "${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"
cp "${rep1}" "${new_name_rep1}"
cp "${rep2}" "${new_name_rep2}"
fi
cat <<-END_VERSIONS > versions.yml
"${task.process}":
renamer: $VERSION
END_VERSIONS
"""

stub:
Expand Down
32 changes: 16 additions & 16 deletions modules/local/wipertools/gather.nf
Original file line number Diff line number Diff line change
Expand Up @@ -16,28 +16,28 @@ process GATHER {
task.ext.when == null || task.ext.when

script:
def VERSION = '1.0.1' // 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 ${fastq_list} > ${filename}_merged_wiped.fastq.gz
wipertools summarygather -s ${report_list} -f ${filename}_merged_report.txt
cat <<-END_VERSIONS > versions.yml
"${task.process}":
cat <<-END_VERSIONS > versions.yml
"${task.process}":
wipertools: $VERSION
END_VERSIONS
"""
END_VERSIONS
"""

stub:
def VERSION = '1.0.1' // 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
"""
gzip < /dev/null > ${filename}_merged_wiped.fastq.gz
touch ${filename}_merged_report.txt
cat <<-END_VERSIONS > versions.yml
"${task.process}":
cat <<-END_VERSIONS > versions.yml
"${task.process}":
wipertools: $VERSION
END_VERSIONS
"""
END_VERSIONS
"""
}
50 changes: 25 additions & 25 deletions modules/local/wipertools/scatter.nf
Original file line number Diff line number Diff line change
Expand Up @@ -10,33 +10,33 @@ process SCATTER {
path "versions.yml" , emit: versions

script:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
def filename = "${fastq.baseName}"
def VERSION = '1.0.1' // WARN: Version information not provided by tool on CLI. Please update this string when bumping container versions.
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
def filename = "${fastq.baseName}"
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.
"""
split -a3 -l ${params.chunk_size} --numeric-suffixes=1 --additional-suffix .fastq ${fastq} ${filename}_chunk.
cat <<-END_VERSIONS > versions.yml
"${task.process}":
wipertools: $VERSION
END_VERSIONS
"""
cat <<-END_VERSIONS > versions.yml
"${task.process}":
wipertools: $VERSION
END_VERSIONS
"""

stub:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
def filename = "${fastq.baseName}"
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
touch ${filename}_chunk.002.fastq
cat <<-END_VERSIONS > versions.yml
"${task.process}":
wipertools: $VERSION
END_VERSIONS
"""
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
def filename = "${fastq.baseName}"
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
touch ${filename}_chunk.002.fastq
cat <<-END_VERSIONS > versions.yml
"${task.process}":
wipertools: $VERSION
END_VERSIONS
"""
}
46 changes: 23 additions & 23 deletions modules/local/wipertools/wipe.nf
Original file line number Diff line number Diff line change
Expand Up @@ -15,32 +15,32 @@ process WIPER {
task.ext.when == null || task.ext.when

script:
def args = task.ext.args ?: ''
def filename = "${fastq.baseName}"
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
def args = task.ext.args ?: ''
def filename = "${fastq.baseName}"
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

"""
wipertools fastqwiper -i $fastq -o ${filename}_wiped.fastq.gz -f ${log_freq} -a ${params.alphabet} -l ${filename}_report.txt
"""
wipertools fastqwiper -i $fastq -o ${filename}_wiped.fastq.gz -f ${log_freq} -a ${params.alphabet} -l ${filename}_report.txt
cat <<-END_VERSIONS > versions.yml
"${task.process}":
wipertools: $VERSION
END_VERSIONS
"""
cat <<-END_VERSIONS > versions.yml
"${task.process}":
wipertools: $VERSION
END_VERSIONS
"""

stub:
def args = task.ext.args ?: ''
def filename = "${fastq.baseName}"
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
cat <<-END_VERSIONS > versions.yml
"${task.process}":
wipertools: $VERSION
END_VERSIONS
def args = task.ext.args ?: ''
def filename = "${fastq.baseName}"
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
cat <<-END_VERSIONS > versions.yml
"${task.process}":
wipertools: $VERSION
END_VERSIONS
"""
}

0 comments on commit dff4907

Please sign in to comment.