-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from grp-bork/update/nevermore_0.13.0_20240620
Update/nevermore 0.13.0 20240620
- Loading branch information
Showing
31 changed files
with
589 additions
and
131 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
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,76 @@ | ||
process bowtie2_build { | ||
container "quay.io/biocontainers/bowtie2:2.5.3--py39h6fed5c7_1" | ||
tag "${sample.id}" | ||
|
||
input: | ||
tuple val(sample), path(genomeseq) | ||
|
||
output: | ||
tuple val(sample), path("${sample.id}/bowtie2/${sample.id}*"), emit: index | ||
|
||
script: | ||
""" | ||
mkdir -p ${sample.id}/bowtie2/ | ||
gzip -dc ${genomeseq} > genome.fa | ||
bowtie2-build --threads ${task.cpus} -f genome.fa ${sample.id}/bowtie2/${sample.id} | ||
rm -vf genome.fa | ||
""" | ||
|
||
} | ||
|
||
|
||
process bowtie2_align { | ||
// container "quay.io/biocontainers/bowtie2:2.5.3--py39h6fed5c7_1" | ||
container "registry.git.embl.de/schudoma/bowtie2-docker:latest" | ||
tag "${sample.id}" | ||
|
||
input: | ||
tuple val(sample), path(fastqs), path(index) | ||
|
||
output: | ||
tuple val(sample), path("${sample.id}/bowtie2_align/${sample.id}.bam"), emit: bam | ||
tuple val(sample), path("${sample.id}/bowtie2_align/${sample.id}.bam.bai"), emit: bai | ||
tuple val(sample), path("${sample.id}.BOWTIE2.DONE"), emit: sentinel | ||
|
||
script: | ||
|
||
def input_files = "" | ||
def r1_files = fastqs.findAll( { it.name.endsWith("_R1.fastq.gz") && !it.name.matches("(.*)(singles|orphans|chimeras)(.*)") } ) | ||
def r2_files = fastqs.findAll( { it.name.endsWith("_R2.fastq.gz") } ) | ||
def orphans = fastqs.findAll( { it.name.matches("(.*)(singles|orphans|chimeras)(.*)") } ) | ||
|
||
if (r1_files.size() != 0 && r2_files.size() != 0) { | ||
input_files += "-1 ${r1_files.join(' ')} -2 ${r2_files.join(' ')}" | ||
single_reads = false | ||
} else if (r1_files.size() != 0) { | ||
input_files += "-U ${r1_files.join(' ')}" | ||
} else if (r2_files.size() != 0) { | ||
input_files += "-U ${r2_files.join(' ')}" | ||
} else if (orphans.size() != 0) { | ||
input_files += "-U ${orphans.join(' ')}" | ||
} | ||
|
||
// --fr/--rf/--ff | ||
def threads = task.cpus.intdiv(2) | ||
def bowtie2_options = "-p ${threads} -q --phred33" | ||
|
||
def index_id = index[0].name.replaceAll(/.[0-9]+.bt2[l]?$/, "") | ||
// -S ${sample.id}/hisat2_align/${sample.id}.sam | ||
// index_id=\$(ls ${index[0]} | sed 's/\\.[0-9]\\+\\.ht2\$//') | ||
""" | ||
mkdir -p ${sample.id}/bowtie2_align/ tmp/ | ||
export TMPDIR=tmp/ | ||
bowtie2 -x ${index_id} ${bowtie2_options} ${input_files} > ${sample.id}.sam | ||
samtools sort -@ ${threads} ${sample.id}.sam > ${sample.id}/bowtie2_align/${sample.id}.bam | ||
samtools index ${sample.id}/bowtie2_align/${sample.id}.bam | ||
rm -fv ${sample.id}.sam | ||
touch ${sample.id}.BOWTIE2.DONE | ||
""" | ||
|
||
} |
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,86 @@ | ||
process hisat2_build { | ||
container "quay.io/biocontainers/hisat2:2.2.1--hdbdd923_6" | ||
// we need a hisat2/samtools mixed container | ||
// container "registry.git.embl.de/schudoma/hisat2-docker:latest" | ||
|
||
input: | ||
tuple val(sample), path(genomeseq) | ||
|
||
output: | ||
tuple val(sample), path("${sample.id}/hisat2/${sample.id}*"), emit: index | ||
|
||
script: | ||
""" | ||
mkdir -p ${sample.id}/hisat2/ | ||
gzip -dc ${genomeseq} > genome.fa | ||
hisat2-build -f genome.fa ${sample.id}/hisat2/${sample.id} | ||
rm -vf genome.fa | ||
""" | ||
|
||
} | ||
|
||
process hisat2_align { | ||
// container "quay.io/biocontainers/hisat2:2.2.1--hdbdd923_6" | ||
// we need a hisat2/samtools mixed container | ||
container "registry.git.embl.de/schudoma/hisat2-docker:latest" | ||
|
||
input: | ||
tuple val(sample), path(fastqs), path(index) | ||
|
||
output: | ||
// tuple val(sample), path("${sample.id}/hisat2_align/${sample.id}.bam"), path("${sample.id}/hisat2_align/${sample.id}.bam.bai"), emit: bam | ||
tuple val(sample), path("${sample.id}/hisat2_align/${sample.id}.bam"), emit: bam | ||
tuple val(sample), path("${sample.id}/hisat2_align/${sample.id}.bam.bai"), emit: bai | ||
tuple val(sample), path("${sample.id}.HISAT2.DONE"), emit: sentinel | ||
|
||
script: | ||
|
||
def input_files = "" | ||
def r1_files = fastqs.findAll( { it.name.endsWith("_R1.fastq.gz") && !it.name.matches("(.*)(singles|orphans|chimeras)(.*)") } ) | ||
def r2_files = fastqs.findAll( { it.name.endsWith("_R2.fastq.gz") } ) | ||
def orphans = fastqs.findAll( { it.name.matches("(.*)(singles|orphans|chimeras)(.*)") } ) | ||
|
||
if (r1_files.size() != 0 && r2_files.size() != 0) { | ||
input_files += "-1 ${r1_files.join(' ')} -2 ${r2_files.join(' ')}" | ||
single_reads = false | ||
} else if (r1_files.size() != 0) { | ||
input_files += "-U ${r1_files.join(' ')}" | ||
} else if (r2_files.size() != 0) { | ||
input_files += "-U ${r2_files.join(' ')}" | ||
} else if (orphans.size() != 0) { | ||
input_files += "-U ${orphans.join(' ')}" | ||
} | ||
|
||
// --fr/--rf/--ff | ||
def threads = task.cpus.intdiv(2) | ||
def hisat2_options = "-p ${threads} -q --phred33" | ||
if (params.hisat2_no_spliced_alignment) { | ||
// --no-spliced-alignment | ||
hisat2_options += " --no-spliced-alignment" | ||
} | ||
|
||
def index_id = index[0].name.replaceAll(/.[0-9]+.ht2$/, "") | ||
// -S ${sample.id}/hisat2_align/${sample.id}.sam | ||
// index_id=\$(ls ${index[0]} | sed 's/\\.[0-9]\\+\\.ht2\$//') | ||
""" | ||
mkdir -p ${sample.id}/hisat2_align/ tmp/ | ||
export TMPDIR=tmp/ | ||
hisat2 -x ${index_id} ${hisat2_options} ${input_files} > ${sample.id}.sam | ||
samtools sort -@ ${threads} ${sample.id}.sam > ${sample.id}/hisat2_align/${sample.id}.bam | ||
samtools index ${sample.id}/hisat2_align/${sample.id}.bam | ||
rm -fv ${sample.id}.sam | ||
touch ${sample.id}.HISAT2.DONE | ||
""" | ||
// echo "tmpdir is \$TMPDIR" | ||
|
||
// hisat2 -x ${sample.id} ${hisat2_options} ${input_files} > ${sample.id}.sam | ||
} | ||
|
||
|
||
|
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,50 @@ | ||
process minimap2_align { | ||
container "registry.git.embl.de/schudoma/minimap2-docker:latest" | ||
label 'align' | ||
|
||
input: | ||
tuple val(sample), path(fastqs) | ||
path(reference) | ||
val(do_name_sort) | ||
|
||
output: | ||
tuple val(sample), path("${sample.id}/${sample.id}.sam"), emit: sam | ||
|
||
script: | ||
// def reads = (sample.is_paired) ? "${sample.id}_R1.fastq.gz ${sample.id}_R2.fastq.gz" : "${sample.id}_R1.fastq.gz" | ||
|
||
def input_files = "" | ||
def r1_files = fastqs.findAll( { it.name.endsWith("_R1.fastq.gz") && !it.name.matches("(.*)(singles|orphans|chimeras)(.*)") } ) | ||
def r2_files = fastqs.findAll( { it.name.endsWith("_R2.fastq.gz") } ) | ||
def orphans = fastqs.findAll( { it.name.matches("(.*)(singles|orphans|chimeras)(.*)") } ) | ||
|
||
if (r1_files.size() != 0 && r2_files.size() != 0) { | ||
input_files += "${r1_files.join(' ')} ${r2_files.join(' ')}" | ||
single_reads = false | ||
} else if (r1_files.size() != 0) { | ||
input_files += "${r1_files.join(' ')}" | ||
} else if (r2_files.size() != 0) { | ||
input_files += "${r2_files.join(' ')}" | ||
} else if (orphans.size() != 0) { | ||
input_files += "${orphans.join(' ')}" | ||
} | ||
|
||
|
||
|
||
|
||
def threads = task.cpus.intdiv(2) | ||
// def mm_options = "--sam-hit-only -t ${threads} -x sr --secondary=yes -a" | ||
def mm_options = "-t ${threads} -x sr --secondary=yes -a" | ||
|
||
// def sort_cmd = "| " + ((do_name_sort) ? "samtools collate -@ ${threads} -o ${sample.id}.bam - tmp/collated_bam" : "samtools sort -@ ${threads} -o ${sample.id}.bam -") | ||
def sort_cmd = "" // we cannot convert large catalogue alignments to bam, hence we cannot properly sort those | ||
|
||
""" | ||
set -e -o pipefail | ||
mkdir -p ${sample.id}/ tmp/ | ||
minimap2 ${mm_options} --split-prefix ${sample.id}_split ${reference} ${input_files} ${sort_cmd} > ${sample.id}/${sample.id}.sam | ||
rm -rvf tmp/ | ||
""" | ||
} |
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 |
---|---|---|
@@ -1,4 +1,6 @@ | ||
process collate_stats { | ||
label "default" | ||
|
||
input: | ||
path(stats_files) | ||
|
||
|
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
Oops, something went wrong.