2021-07-20 20:31:31 +00:00
|
|
|
process SAMTOOLS_AMPLICONCLIP {
|
|
|
|
tag "$meta.id"
|
|
|
|
label 'process_medium'
|
|
|
|
|
2022-04-11 12:26:28 +00:00
|
|
|
conda (params.enable_conda ? "bioconda::samtools=1.15.1" : null)
|
2021-11-26 07:58:40 +00:00
|
|
|
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
|
2022-04-11 12:26:28 +00:00
|
|
|
'https://depot.galaxyproject.org/singularity/samtools:1.15.1--h1170115_0' :
|
|
|
|
'quay.io/biocontainers/samtools:1.15.1--h1170115_0' }"
|
2021-07-20 20:31:31 +00:00
|
|
|
|
|
|
|
input:
|
|
|
|
tuple val(meta), path(bam)
|
|
|
|
path bed
|
|
|
|
val save_cliprejects
|
|
|
|
val save_clipstats
|
|
|
|
|
|
|
|
output:
|
|
|
|
tuple val(meta), path("*.bam") , emit: bam
|
|
|
|
tuple val(meta), path("*.clipstats.txt") , optional:true, emit: stats
|
|
|
|
tuple val(meta), path("*.cliprejects.bam"), optional:true, emit: rejects_bam
|
2021-10-01 13:04:56 +00:00
|
|
|
path "versions.yml" , emit: versions
|
2021-07-20 20:31:31 +00:00
|
|
|
|
2022-02-04 08:53:32 +00:00
|
|
|
when:
|
|
|
|
task.ext.when == null || task.ext.when
|
|
|
|
|
2021-07-20 20:31:31 +00:00
|
|
|
script:
|
2021-11-26 07:58:40 +00:00
|
|
|
def args = task.ext.args ?: ''
|
2021-12-02 12:39:55 +00:00
|
|
|
def prefix = task.ext.prefix ?: "${meta.id}"
|
2022-01-07 17:52:39 +00:00
|
|
|
def rejects = save_cliprejects ? "--rejects-file ${prefix}.cliprejects.bam" : ""
|
|
|
|
def stats = save_clipstats ? "-f ${prefix}.clipstats.txt" : ""
|
|
|
|
if ("$bam" == "${prefix}.bam") error "Input and output names are the same, use \"task.ext.prefix\" to disambiguate!"
|
2021-07-20 20:31:31 +00:00
|
|
|
"""
|
|
|
|
samtools \\
|
|
|
|
ampliconclip \\
|
2021-11-26 07:58:40 +00:00
|
|
|
$args \\
|
2021-07-20 20:31:31 +00:00
|
|
|
$rejects \\
|
|
|
|
$stats \\
|
|
|
|
-b $bed \\
|
|
|
|
-o ${prefix}.bam \\
|
|
|
|
$bam
|
|
|
|
|
2021-09-27 08:41:24 +00:00
|
|
|
cat <<-END_VERSIONS > versions.yml
|
2021-11-26 07:58:40 +00:00
|
|
|
"${task.process}":
|
|
|
|
samtools: \$(echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//')
|
2021-09-27 08:41:24 +00:00
|
|
|
END_VERSIONS
|
2021-07-20 20:31:31 +00:00
|
|
|
"""
|
|
|
|
}
|