comparison 0.5.0/modules/samtools/fastq/main.nf @ 0:97cd2f532efe

planemo upload
author kkonganti
date Mon, 31 Mar 2025 14:50:40 -0400
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:97cd2f532efe
1 process SAMTOOLS_FASTQ {
2 tag "$meta.id"
3 label 'process_micro'
4
5 module (params.enable_module ? "${params.swmodulepath}${params.fs}samtools${params.fs}1.13" : null)
6 conda (params.enable_conda ? "bioconda::samtools=1.18 bioconda::htslib=1.18 conda-forge::bzip2" : null)
7 container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
8 'https://depot.galaxyproject.org/singularity/samtools:1.18--h50ea8bc_1' :
9 'quay.io/biocontainers/samtools:1.18--h50ea8bc_1' }"
10
11 input:
12 tuple val(meta), path(input)
13 val(interleave)
14
15 output:
16 tuple val(meta), path("*_{1,2}.fastq.gz") , optional:true, emit: fastq
17 tuple val(meta), path("*_{1,2}.fastq.gz") , optional:true, emit: mapped_refs
18 tuple val(meta), path("*_interleaved.fastq") , optional:true, emit: interleaved
19 tuple val(meta), path("*_singleton.fastq.gz") , optional:true, emit: singleton
20 tuple val(meta), path("*_other.fastq.gz") , optional:true, emit: other
21 path "versions.yml" , emit: versions
22
23 when:
24 task.ext.when == null || task.ext.when
25
26 script:
27 def args = task.ext.args ?: ''
28 def prefix = task.ext.prefix ?: "${meta.id}"
29 def output = ( interleave && ! meta.single_end ) ? "> ${prefix}_interleaved.fastq" :
30 meta.single_end ? "-1 ${prefix}_1.fastq.gz -s ${prefix}_singleton.fastq.gz" :
31 "-1 ${prefix}_1.fastq.gz -2 ${prefix}_2.fastq.gz -s ${prefix}_singleton.fastq.gz"
32 """
33 samtools \\
34 fastq \\
35 $args \\
36 --threads ${task.cpus-1} \\
37 -0 ${prefix}_other.fastq.gz \\
38 $input \\
39 $output
40
41 samtools \\
42 view \\
43 $args2 \\
44 --threads ${task.cpus-1} \\
45 $input \\
46 | grep -v '*' | cut -f3 | sort -u > mapped_refs.txt
47
48 cat <<-END_VERSIONS > versions.yml
49 "${task.process}":
50 samtools: \$(echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//')
51 END_VERSIONS
52 """
53 }