annotate 0.5.0/modules/samtools/fastq/main.nf @ 8:3539fbeb4230

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