Skip to content

Commit db5a844

Browse files
authored
chores: polish - strict syntax (#8400)
* chores: polish - strict syntax * fix meta.yml * gatk4 * no update this module * move into its own PR
1 parent c2e58b8 commit db5a844

File tree

5 files changed

+271
-287
lines changed
  • modules/nf-core
  • subworkflows/nf-core
    • fastq_fastqc_umitools_fastp
    • fastq_fastqc_umitools_trimgalore
    • fastq_qc_trim_filter_setstrandedness

5 files changed

+271
-287
lines changed

modules/nf-core/hisat2/build/main.nf

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
process HISAT2_BUILD {
2-
tag "$fasta"
2+
tag "${fasta}"
33
label 'process_high'
44
label 'process_high_memory'
55

66
conda "${moduleDir}/environment.yml"
7-
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
8-
'https://depot.galaxyproject.org/singularity/hisat2:2.2.1--h1b792b2_3' :
9-
'biocontainers/hisat2:2.2.1--h1b792b2_3' }"
7+
container "${workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container
8+
? 'https://depot.galaxyproject.org/singularity/hisat2:2.2.1--h1b792b2_3'
9+
: 'biocontainers/hisat2:2.2.1--h1b792b2_3'}"
1010

1111
input:
1212
tuple val(meta), path(fasta)
1313
tuple val(meta2), path(gtf)
1414
tuple val(meta3), path(splicesites)
1515

1616
output:
17-
tuple val(meta), path("hisat2") , emit: index
18-
path "versions.yml" , emit: versions
17+
tuple val(meta), path("hisat2"), emit: index
18+
path "versions.yml", emit: versions
1919

2020
when:
2121
task.ext.when == null || task.ext.when
@@ -24,9 +24,10 @@ process HISAT2_BUILD {
2424
def args = task.ext.args ?: ''
2525
def avail_mem = 0
2626
if (!task.memory) {
27-
log.info "[HISAT2 index build] Available memory not known - defaulting to 0. Specify process memory requirements to change this."
28-
} else {
29-
log.info "[HISAT2 index build] Available memory: ${task.memory}"
27+
log.info("[HISAT2 index build] Available memory not known - defaulting to 0. Specify process memory requirements to change this.")
28+
}
29+
else {
30+
log.info("[HISAT2 index build] Available memory: ${task.memory}")
3031
avail_mem = task.memory.toGiga()
3132
}
3233

@@ -35,23 +36,24 @@ process HISAT2_BUILD {
3536
def extract_exons = ''
3637
def hisat2_build_memory = params.hisat2_build_memory ? (params.hisat2_build_memory as MemoryUnit).toGiga() : 0
3738
if (avail_mem >= hisat2_build_memory) {
38-
log.info "[HISAT2 index build] At least ${hisat2_build_memory} GB available, so using splice sites and exons to build HISAT2 index"
39-
extract_exons = gtf ? "hisat2_extract_exons.py $gtf > ${gtf.baseName}.exons.txt" : ""
40-
ss = splicesites ? "--ss $splicesites" : ""
39+
log.info("[HISAT2 index build] At least ${hisat2_build_memory} GB available, so using splice sites and exons to build HISAT2 index")
40+
extract_exons = gtf ? "hisat2_extract_exons.py ${gtf} > ${gtf.baseName}.exons.txt" : ""
41+
ss = splicesites ? "--ss ${splicesites}" : ""
4142
exon = gtf ? "--exon ${gtf.baseName}.exons.txt" : ""
42-
} else {
43-
log.info "[HISAT2 index build] Less than ${hisat2_build_memory} GB available, so NOT using splice sites and exons to build HISAT2 index."
44-
log.info "[HISAT2 index build] Use --hisat2_build_memory [small number] to skip this check."
43+
}
44+
else {
45+
log.info("[HISAT2 index build] Less than ${hisat2_build_memory} GB available, so NOT using splice sites and exons to build HISAT2 index.")
46+
log.info("[HISAT2 index build] Use --hisat2_build_memory [small number] to skip this check.")
4547
}
4648
"""
4749
mkdir hisat2
48-
$extract_exons
50+
${extract_exons}
4951
hisat2-build \\
50-
-p $task.cpus \\
51-
$ss \\
52-
$exon \\
53-
$args \\
54-
$fasta \\
52+
-p ${task.cpus} \\
53+
${ss} \\
54+
${exon} \\
55+
${args} \\
56+
${fasta} \\
5557
hisat2/${fasta.baseName}
5658
5759
cat <<-END_VERSIONS > versions.yml

modules/nf-core/salmon/quant/main.nf

Lines changed: 53 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,79 +1,94 @@
11
process SALMON_QUANT {
2-
tag "$meta.id"
2+
tag "${meta.id}"
33
label "process_medium"
44

55
conda "${moduleDir}/environment.yml"
6-
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
7-
'https://depot.galaxyproject.org/singularity/salmon:1.10.3--h6dccd9a_2' :
8-
'biocontainers/salmon:1.10.3--h6dccd9a_2' }"
6+
container "${workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container
7+
? 'https://depot.galaxyproject.org/singularity/salmon:1.10.3--h6dccd9a_2'
8+
: 'biocontainers/salmon:1.10.3--h6dccd9a_2'}"
99

1010
input:
1111
tuple val(meta), path(reads)
12-
path index
13-
path gtf
14-
path transcript_fasta
15-
val alignment_mode
16-
val lib_type
12+
path index
13+
path gtf
14+
path transcript_fasta
15+
val alignment_mode
16+
val lib_type
1717

1818
output:
19-
tuple val(meta), path("${prefix}") , emit: results
20-
tuple val(meta), path("*info.json") , emit: json_info, optional: true
19+
tuple val(meta), path("${prefix}"), emit: results
20+
tuple val(meta), path("*info.json"), emit: json_info, optional: true
2121
tuple val(meta), path("*lib_format_counts.json"), emit: lib_format_counts, optional: true
22-
path "versions.yml" , emit: versions
22+
path "versions.yml", emit: versions
2323

2424
when:
2525
task.ext.when == null || task.ext.when
2626

2727
script:
28-
def args = task.ext.args ?: ''
29-
prefix = task.ext.prefix ?: "${meta.id}"
28+
def args = task.ext.args ?: ''
29+
prefix = task.ext.prefix ?: "${meta.id}"
3030

31-
def reference = "--index $index"
31+
def reference = "--index ${index}"
3232
def reads1 = []
3333
def reads2 = []
34-
meta.single_end ? [reads].flatten().each{reads1 << it} : reads.eachWithIndex{ v, ix -> ( ix & 1 ? reads2 : reads1) << v }
34+
meta.single_end ? [reads].flatten().each { reads1 << it } : reads.eachWithIndex { v, ix -> (ix & 1 ? reads2 : reads1) << v }
3535
def input_reads = meta.single_end ? "-r ${reads1.join(" ")}" : "-1 ${reads1.join(" ")} -2 ${reads2.join(" ")}"
3636
if (alignment_mode) {
37-
reference = "-t $transcript_fasta"
38-
input_reads = "-a $reads"
37+
reference = "-t ${transcript_fasta}"
38+
input_reads = "-a ${reads}"
3939
}
4040

4141
def strandedness_opts = [
42-
'A', 'U', 'SF', 'SR',
43-
'IS', 'IU' , 'ISF', 'ISR',
44-
'OS', 'OU' , 'OSF', 'OSR',
45-
'MS', 'MU' , 'MSF', 'MSR'
42+
'A',
43+
'U',
44+
'SF',
45+
'SR',
46+
'IS',
47+
'IU',
48+
'ISF',
49+
'ISR',
50+
'OS',
51+
'OU',
52+
'OSF',
53+
'OSR',
54+
'MS',
55+
'MU',
56+
'MSF',
57+
'MSR',
4658
]
47-
def strandedness = 'A'
59+
def strandedness = 'A'
4860
if (lib_type) {
4961
if (strandedness_opts.contains(lib_type)) {
5062
strandedness = lib_type
51-
} else {
52-
log.info "[Salmon Quant] Invalid library type specified '--libType=${lib_type}', defaulting to auto-detection with '--libType=A'."
5363
}
54-
} else {
64+
else {
65+
log.info("[Salmon Quant] Invalid library type specified '--libType=${lib_type}', defaulting to auto-detection with '--libType=A'.")
66+
}
67+
}
68+
else {
5569
strandedness = meta.single_end ? 'U' : 'IU'
5670
if (meta.strandedness == 'forward') {
5771
strandedness = meta.single_end ? 'SF' : 'ISF'
58-
} else if (meta.strandedness == 'reverse') {
72+
}
73+
else if (meta.strandedness == 'reverse') {
5974
strandedness = meta.single_end ? 'SR' : 'ISR'
6075
}
6176
}
6277
"""
6378
salmon quant \\
64-
--geneMap $gtf \\
65-
--threads $task.cpus \\
66-
--libType=$strandedness \\
67-
$reference \\
68-
$input_reads \\
69-
$args \\
70-
-o $prefix
79+
--geneMap ${gtf} \\
80+
--threads ${task.cpus} \\
81+
--libType=${strandedness} \\
82+
${reference} \\
83+
${input_reads} \\
84+
${args} \\
85+
-o ${prefix}
7186
72-
if [ -f $prefix/aux_info/meta_info.json ]; then
73-
cp $prefix/aux_info/meta_info.json "${prefix}_meta_info.json"
87+
if [ -f ${prefix}/aux_info/meta_info.json ]; then
88+
cp ${prefix}/aux_info/meta_info.json "${prefix}_meta_info.json"
7489
fi
75-
if [ -f $prefix/lib_format_counts.json ]; then
76-
cp $prefix/lib_format_counts.json "${prefix}_lib_format_counts.json"
90+
if [ -f ${prefix}/lib_format_counts.json ]; then
91+
cp ${prefix}/lib_format_counts.json "${prefix}_lib_format_counts.json"
7792
fi
7893
7994
cat <<-END_VERSIONS > versions.yml

0 commit comments

Comments
 (0)