comparison 0.5.0/modules/salmon/quant/main.nf @ 1:365849f031fd

"planemo upload"
author kkonganti
date Mon, 05 Jun 2023 18:48:51 -0400
parents
children a492d1511fb6
comparison
equal deleted inserted replaced
0:a4b1ee4b68b1 1:365849f031fd
1 process SALMON_QUANT {
2 tag "$meta.id"
3 label "process_medium"
4
5 module (params.enable_module ? "${params.swmodulepath}${params.fs}salmon${params.fs}1.9.0" : null)
6 conda (params.enable_conda ? 'conda-forge::libgcc-ng bioconda::salmon=1.9.0' : null)
7 container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
8 'https://depot.galaxyproject.org/singularity/salmon:1.9.0--h7e5ed60_1' :
9 'quay.io/biocontainers/salmon:1.9.0--h7e5ed60_1' }"
10 input:
11 tuple val(meta), path(reads_or_bam), path(index_or_tr_fasta)
12
13 output:
14 tuple val(meta), path("${meta.id}_salmon_res"), emit: results
15 path "versions.yml" , emit: versions
16
17 when:
18 task.ext.when == null || task.ext.when
19
20 script:
21 def args = task.ext.args ?: ''
22 def prefix = task.ext.prefix ?: "${meta.id}_salmon_res"
23 def reference = "--index $index_or_tr_fasta"
24 def lib_type = (meta.salmon_lib_type ?: '')
25 def alignment_mode = (meta.salmon_alignment_mode ?: '')
26 def gtf = (meta.salmon_gtf ? "--geneMap ${meta.salmon_gtf}" : '')
27 def input_reads =(meta.single_end ? "-r $reads_or_bam" : "-1 ${reads_or_bam[0]} -2 ${reads_or_bam[1]}")
28
29 // Use path(reads_or_bam) to point to BAM and path(index_or_tr_fasta) to point to transcript fasta
30 // if using salmon DSL2 module in alignment-based mode.
31 // By default, this module will be run in selective-alignment-based mode of salmon.
32 if (alignment_mode) {
33 reference = "-t $index_or_tr_fasta"
34 input_reads = "-a $reads_or_bam"
35 }
36
37 def strandedness_opts = [
38 'A', 'U', 'SF', 'SR',
39 'IS', 'IU' , 'ISF', 'ISR',
40 'OS', 'OU' , 'OSF', 'OSR',
41 'MS', 'MU' , 'MSF', 'MSR'
42 ]
43
44 def strandedness = 'A'
45
46 if (lib_type) {
47 if (strandedness_opts.contains(lib_type)) {
48 strandedness = lib_type
49 } else {
50 log.info "[Salmon Quant] Invalid library type specified '--libType=${lib_type}', defaulting to auto-detection with '--libType=A'."
51 }
52 } else {
53 strandedness = meta.single_end ? 'U' : 'IU'
54 if (meta.strandedness == 'forward') {
55 strandedness = meta.single_end ? 'SF' : 'ISF'
56 } else if (meta.strandedness == 'reverse') {
57 strandedness = meta.single_end ? 'SR' : 'ISR'
58 }
59 }
60 """
61 salmon quant \\
62 --threads $task.cpus \\
63 --libType=$strandedness \\
64 $gtf \\
65 $args \\
66 -o $prefix \\
67 $reference \\
68 $input_reads
69
70 cat <<-END_VERSIONS > versions.yml
71 "${task.process}":
72 salmon: \$(echo \$(salmon --version) | sed -e "s/salmon //g")
73 END_VERSIONS
74 """
75 }