Skip to content

Commit b1e9b57

Browse files
committed
style: Touch a module that works with arm
1 parent a3ced83 commit b1e9b57

File tree

1 file changed

+35
-29
lines changed
  • modules/nf-core/bowtie2/align

1 file changed

+35
-29
lines changed

modules/nf-core/bowtie2/align/main.nf

Lines changed: 35 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
11
process BOWTIE2_ALIGN {
2-
tag "$meta.id"
2+
tag "${meta.id}"
33
label 'process_high'
44

55
conda "${moduleDir}/environment.yml"
6-
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
7-
'https://community-cr-prod.seqera.io/docker/registry/v2/blobs/sha256/b4/b41b403e81883126c3227fc45840015538e8e2212f13abc9ae84e4b98891d51c/data' :
8-
'community.wave.seqera.io/library/bowtie2_htslib_samtools_pigz:edeb13799090a2a6' }"
6+
container "${workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container
7+
? 'https://community-cr-prod.seqera.io/docker/registry/v2/blobs/sha256/b4/b41b403e81883126c3227fc45840015538e8e2212f13abc9ae84e4b98891d51c/data'
8+
: 'community.wave.seqera.io/library/bowtie2_htslib_samtools_pigz:edeb13799090a2a6'}"
99

1010
input:
11-
tuple val(meta) , path(reads)
11+
tuple val(meta), path(reads)
1212
tuple val(meta2), path(index)
1313
tuple val(meta3), path(fasta)
14-
val save_unaligned
15-
val sort_bam
14+
val save_unaligned
15+
val sort_bam
1616

1717
output:
18-
tuple val(meta), path("*.sam") , emit: sam , optional:true
19-
tuple val(meta), path("*.bam") , emit: bam , optional:true
20-
tuple val(meta), path("*.cram") , emit: cram , optional:true
21-
tuple val(meta), path("*.csi") , emit: csi , optional:true
22-
tuple val(meta), path("*.crai") , emit: crai , optional:true
23-
tuple val(meta), path("*.log") , emit: log
24-
tuple val(meta), path("*fastq.gz") , emit: fastq , optional:true
25-
path "versions.yml" , emit: versions
18+
tuple val(meta), path("*.sam"), emit: sam, optional: true
19+
tuple val(meta), path("*.bam"), emit: bam, optional: true
20+
tuple val(meta), path("*.cram"), emit: cram, optional: true
21+
tuple val(meta), path("*.csi"), emit: csi, optional: true
22+
tuple val(meta), path("*.crai"), emit: crai, optional: true
23+
tuple val(meta), path("*.log"), emit: log
24+
tuple val(meta), path("*fastq.gz"), emit: fastq, optional: true
25+
path "versions.yml", emit: versions
2626

2727
when:
2828
task.ext.when == null || task.ext.when
@@ -37,17 +37,20 @@ process BOWTIE2_ALIGN {
3737
if (meta.single_end) {
3838
unaligned = save_unaligned ? "--un-gz ${prefix}.unmapped.fastq.gz" : ""
3939
reads_args = "-U ${reads}"
40-
} else {
40+
}
41+
else {
4142
unaligned = save_unaligned ? "--un-conc-gz ${prefix}.unmapped.fastq.gz" : ""
4243
reads_args = "-1 ${reads[0]} -2 ${reads[1]}"
4344
}
4445

4546
def samtools_command = sort_bam ? 'sort' : 'view'
4647
def extension_pattern = /(--output-fmt|-O)+\s+(\S+)/
47-
def extension_matcher = (args2 =~ extension_pattern)
48+
def extension_matcher = (args2 =~ extension_pattern)
4849
def extension = extension_matcher.getCount() > 0 ? extension_matcher[0][2].toLowerCase() : "bam"
49-
def reference = fasta && extension=="cram" ? "--reference ${fasta}" : ""
50-
if (!fasta && extension=="cram") error "Fasta reference is required for CRAM output"
50+
def reference = fasta && extension == "cram" ? "--reference ${fasta}" : ""
51+
if (!fasta && extension == "cram") {
52+
error("Fasta reference is required for CRAM output")
53+
}
5154

5255
"""
5356
INDEX=`find -L ./ -name "*.rev.1.bt2" | sed "s/\\.rev.1.bt2\$//"`
@@ -56,12 +59,12 @@ process BOWTIE2_ALIGN {
5659
5760
bowtie2 \\
5861
-x \$INDEX \\
59-
$reads_args \\
60-
--threads $task.cpus \\
61-
$unaligned \\
62-
$args \\
62+
${reads_args} \\
63+
--threads ${task.cpus} \\
64+
${unaligned} \\
65+
${args} \\
6366
2>| >(tee ${prefix}.bowtie2.log >&2) \\
64-
| samtools $samtools_command $args2 --threads $task.cpus ${reference} -o ${prefix}.${extension} -
67+
| samtools ${samtools_command} ${args2} --threads ${task.cpus} ${reference} -o ${prefix}.${extension} -
6568
6669
if [ -f ${prefix}.unmapped.fastq.1.gz ]; then
6770
mv ${prefix}.unmapped.fastq.1.gz ${prefix}.unmapped_1.fastq.gz
@@ -83,19 +86,23 @@ process BOWTIE2_ALIGN {
8386
def args2 = task.ext.args2 ?: ""
8487
def prefix = task.ext.prefix ?: "${meta.id}"
8588
def extension_pattern = /(--output-fmt|-O)+\s+(\S+)/
86-
def extension = (args2 ==~ extension_pattern) ? (args2 =~ extension_pattern)[0][2].toLowerCase() : "bam"
89+
def extension = args2 ==~ extension_pattern ? (args2 =~ extension_pattern)[0][2].toLowerCase() : "bam"
8790
def create_unmapped = ""
8891
if (meta.single_end) {
8992
create_unmapped = save_unaligned ? "touch ${prefix}.unmapped.fastq.gz" : ""
90-
} else {
93+
}
94+
else {
9195
create_unmapped = save_unaligned ? "touch ${prefix}.unmapped_1.fastq.gz && touch ${prefix}.unmapped_2.fastq.gz" : ""
9296
}
93-
if (!fasta && extension=="cram") error "Fasta reference is required for CRAM output"
97+
if (!fasta && extension == "cram") {
98+
error("Fasta reference is required for CRAM output")
99+
}
94100

95101
def create_index = ""
96102
if (extension == "cram") {
97103
create_index = "touch ${prefix}.crai"
98-
} else if (extension == "bam") {
104+
}
105+
else if (extension == "bam") {
99106
create_index = "touch ${prefix}.csi"
100107
}
101108

@@ -112,5 +119,4 @@ process BOWTIE2_ALIGN {
112119
pigz: \$( pigz --version 2>&1 | sed 's/pigz //g' )
113120
END_VERSIONS
114121
"""
115-
116122
}

0 commit comments

Comments
 (0)