mirror of
https://github.com/MillironX/nf-core_modules.git
synced 2024-11-10 20:23:10 +00:00
Merge pull request #1660 from matthdsm/update/bowtie2
Bowtie2: add sort option
This commit is contained in:
commit
759223d22d
4 changed files with 62 additions and 8 deletions
|
@ -11,6 +11,7 @@ process BOWTIE2_ALIGN {
|
|||
tuple val(meta), path(reads)
|
||||
path index
|
||||
val save_unaligned
|
||||
val sort_bam
|
||||
|
||||
output:
|
||||
tuple val(meta), path("*.bam") , emit: bam
|
||||
|
@ -36,8 +37,7 @@ process BOWTIE2_ALIGN {
|
|||
reads_args = "-1 ${reads[0]} -2 ${reads[1]}"
|
||||
}
|
||||
|
||||
def samtools_command = "samtools view -@ $task.cpus --bam --with-header ${args2} > ${prefix}.bam"
|
||||
|
||||
def samtools_command = sort_bam ? 'sort' : 'view'
|
||||
|
||||
"""
|
||||
INDEX=`find -L ./ -name "*.rev.1.bt2" | sed "s/.rev.1.bt2//"`
|
||||
|
@ -51,7 +51,7 @@ process BOWTIE2_ALIGN {
|
|||
$unaligned \\
|
||||
$args \\
|
||||
2> ${prefix}.bowtie2.log \\
|
||||
| $samtools_command
|
||||
| samtools $samtools_command $args2 --threads $task.cpus -o ${prefix}.bam -
|
||||
|
||||
if [ -f ${prefix}.unmapped.fastq.1.gz ]; then
|
||||
mv ${prefix}.unmapped.fastq.1.gz ${prefix}.unmapped_1.fastq.gz
|
||||
|
|
|
@ -29,6 +29,15 @@ input:
|
|||
type: file
|
||||
description: Bowtie2 genome index files
|
||||
pattern: "*.ebwt"
|
||||
- save_unaligned:
|
||||
type: boolean
|
||||
description: |
|
||||
Save reads that do not map to the reference (true) or discard them (false)
|
||||
(default: false)
|
||||
- sort_bam:
|
||||
type: boolean
|
||||
description: use samtools sort (true) or samtools view (false)
|
||||
pattern: "true or false"
|
||||
output:
|
||||
- bam:
|
||||
type: file
|
||||
|
|
|
@ -14,9 +14,25 @@ workflow test_bowtie2_align_single_end {
|
|||
]
|
||||
fasta = file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true)
|
||||
save_unaligned = false
|
||||
sort = false
|
||||
|
||||
BOWTIE2_BUILD ( fasta )
|
||||
BOWTIE2_ALIGN ( input, BOWTIE2_BUILD.out.index, save_unaligned )
|
||||
BOWTIE2_ALIGN ( input, BOWTIE2_BUILD.out.index, save_unaligned, sort )
|
||||
}
|
||||
|
||||
workflow test_bowtie2_align_single_end_sorted {
|
||||
input = [
|
||||
[ id:'test', single_end:true ], // meta map
|
||||
[
|
||||
file(params.test_data['sarscov2']['illumina']['test_1_fastq_gz'], checkIfExists: true)
|
||||
]
|
||||
]
|
||||
fasta = file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true)
|
||||
save_unaligned = false
|
||||
sort = true
|
||||
|
||||
BOWTIE2_BUILD ( fasta )
|
||||
BOWTIE2_ALIGN ( input, BOWTIE2_BUILD.out.index, save_unaligned, sort )
|
||||
}
|
||||
|
||||
workflow test_bowtie2_align_paired_end {
|
||||
|
@ -29,9 +45,26 @@ workflow test_bowtie2_align_paired_end {
|
|||
]
|
||||
fasta = file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true)
|
||||
save_unaligned = false
|
||||
sort = false
|
||||
|
||||
BOWTIE2_BUILD ( fasta )
|
||||
BOWTIE2_ALIGN ( input, BOWTIE2_BUILD.out.index, save_unaligned )
|
||||
BOWTIE2_ALIGN ( input, BOWTIE2_BUILD.out.index, save_unaligned, sort )
|
||||
}
|
||||
|
||||
workflow test_bowtie2_align_paired_end_sorted {
|
||||
input = [
|
||||
[ id:'test', single_end:false ], // meta map
|
||||
[
|
||||
file(params.test_data['sarscov2']['illumina']['test_1_fastq_gz'], checkIfExists: true),
|
||||
file(params.test_data['sarscov2']['illumina']['test_2_fastq_gz'], checkIfExists: true)
|
||||
]
|
||||
]
|
||||
fasta = file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true)
|
||||
save_unaligned = false
|
||||
sort = true
|
||||
|
||||
BOWTIE2_BUILD ( fasta )
|
||||
BOWTIE2_ALIGN ( input, BOWTIE2_BUILD.out.index, save_unaligned, sort )
|
||||
}
|
||||
|
||||
workflow test_bowtie2_align_single_end_large_index {
|
||||
|
@ -43,9 +76,10 @@ workflow test_bowtie2_align_single_end_large_index {
|
|||
]
|
||||
fasta = file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true)
|
||||
save_unaligned = false
|
||||
sort = false
|
||||
|
||||
BOWTIE2_BUILD ( fasta )
|
||||
BOWTIE2_ALIGN ( input, BOWTIE2_BUILD.out.index, save_unaligned )
|
||||
BOWTIE2_ALIGN ( input, BOWTIE2_BUILD.out.index, save_unaligned, sort )
|
||||
}
|
||||
|
||||
workflow test_bowtie2_align_paired_end_large_index {
|
||||
|
@ -58,7 +92,8 @@ workflow test_bowtie2_align_paired_end_large_index {
|
|||
]
|
||||
fasta = file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true)
|
||||
save_unaligned = false
|
||||
sort = false
|
||||
|
||||
BOWTIE2_BUILD ( fasta )
|
||||
BOWTIE2_ALIGN ( input, BOWTIE2_BUILD.out.index, save_unaligned )
|
||||
BOWTIE2_ALIGN ( input, BOWTIE2_BUILD.out.index, save_unaligned, sort )
|
||||
}
|
|
@ -8,6 +8,16 @@
|
|||
- path: ./output/bowtie2/test.bowtie2.log
|
||||
- path: ./output/bowtie2/versions.yml
|
||||
|
||||
- name: bowtie2 align test_bowtie2_align_single_end_sorted
|
||||
command: nextflow run ./tests/modules/bowtie2/align -entry test_bowtie2_align_single_end_sorted -c ./tests/config/nextflow.config -c ./tests/modules/bowtie2/align/nextflow.config
|
||||
tags:
|
||||
- bowtie2
|
||||
- bowtie2/align
|
||||
files:
|
||||
- path: ./output/bowtie2/test.bam
|
||||
- path: ./output/bowtie2/test.bowtie2.log
|
||||
- path: ./output/bowtie2/versions.yml
|
||||
|
||||
- name: bowtie2 align test_bowtie2_align_paired_end
|
||||
command: nextflow run tests/modules/bowtie2/align -entry test_bowtie2_align_paired_end -c tests/config/nextflow.config -c tests/modules/bowtie2/align/nextflow.config
|
||||
tags:
|
||||
|
|
Loading…
Reference in a new issue