nf-core_modules/modules/hisat2/align/main.nf
Harshil Patel 4eed099a12
Bump HISAT2 version to 2.2.1 in all modules (#2139)
* Fix broken Quast module and bump MultiQC version in dumpsoftwareversions

* Bump HISAT2 version to 2.2.1

* Remove empty md5sums

* Remove empty md5sums

* Remove empty md5sums
2022-09-30 20:34:06 +01:00

92 lines
3.7 KiB
Text

process HISAT2_ALIGN {
tag "$meta.id"
label 'process_high'
// WARN: Version information not provided by tool on CLI. Please update version string below when bumping container versions.
conda (params.enable_conda ? "bioconda::hisat2=2.2.1 bioconda::samtools=1.15.1" : null)
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/mulled-v2-a97e90b3b802d1da3d6958e0867610c718cb5eb1:38aed4501da19db366dc7c8d52d31d94e760cfaf-0' :
'quay.io/biocontainers/mulled-v2-a97e90b3b802d1da3d6958e0867610c718cb5eb1:38aed4501da19db366dc7c8d52d31d94e760cfaf-0' }"
input:
tuple val(meta), path(reads)
path index
path splicesites
output:
tuple val(meta), path("*.bam") , emit: bam
tuple val(meta), path("*.log") , emit: summary
tuple val(meta), path("*fastq.gz"), optional:true, emit: fastq
path "versions.yml" , emit: versions
when:
task.ext.when == null || task.ext.when
script:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
def VERSION = '2.2.1' // WARN: Version information not provided by tool on CLI. Please update this string when bumping container versions.
def strandedness = ''
if (meta.strandedness == 'forward') {
strandedness = meta.single_end ? '--rna-strandness F' : '--rna-strandness FR'
} else if (meta.strandedness == 'reverse') {
strandedness = meta.single_end ? '--rna-strandness R' : '--rna-strandness RF'
}
def seq_center = params.seq_center ? "--rg-id ${prefix} --rg SM:$prefix --rg CN:${params.seq_center.replaceAll('\\s','_')}" : "--rg-id ${prefix} --rg SM:$prefix"
if (meta.single_end) {
def unaligned = params.save_unaligned ? "--un-gz ${prefix}.unmapped.fastq.gz" : ''
"""
INDEX=`find -L ./ -name "*.1.ht2" | sed 's/.1.ht2//'`
hisat2 \\
-x \$INDEX \\
-U $reads \\
$strandedness \\
--known-splicesite-infile $splicesites \\
--summary-file ${prefix}.hisat2.summary.log \\
--threads $task.cpus \\
$seq_center \\
$unaligned \\
$args \\
| samtools view -bS -F 4 -F 256 - > ${prefix}.bam
cat <<-END_VERSIONS > versions.yml
"${task.process}":
hisat2: $VERSION
samtools: \$(echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//')
END_VERSIONS
"""
} else {
def unaligned = params.save_unaligned ? "--un-conc-gz ${prefix}.unmapped.fastq.gz" : ''
"""
INDEX=`find -L ./ -name "*.1.ht2" | sed 's/.1.ht2//'`
hisat2 \\
-x \$INDEX \\
-1 ${reads[0]} \\
-2 ${reads[1]} \\
$strandedness \\
--known-splicesite-infile $splicesites \\
--summary-file ${prefix}.hisat2.summary.log \\
--threads $task.cpus \\
$seq_center \\
$unaligned \\
--no-mixed \\
--no-discordant \\
$args \\
| samtools view -bS -F 4 -F 8 -F 256 - > ${prefix}.bam
if [ -f ${prefix}.unmapped.fastq.1.gz ]; then
mv ${prefix}.unmapped.fastq.1.gz ${prefix}.unmapped_1.fastq.gz
fi
if [ -f ${prefix}.unmapped.fastq.2.gz ]; then
mv ${prefix}.unmapped.fastq.2.gz ${prefix}.unmapped_2.fastq.gz
fi
cat <<-END_VERSIONS > versions.yml
"${task.process}":
hisat2: $VERSION
samtools: \$(echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//')
END_VERSIONS
"""
}
}