Add samtools

This commit is contained in:
drpatelh 2020-08-05 17:17:47 +01:00
parent 993d0d5743
commit 137db462a7
10 changed files with 153 additions and 0 deletions

View file

@ -0,0 +1 @@
../../lib/functions.nf

View file

@ -0,0 +1,29 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions'
process SAMTOOLS_FLAGSTAT {
tag "$meta.id"
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:options, publish_dir:getSoftwareName(task.process), publish_id:meta.id) }
container "quay.io/biocontainers/samtools:1.10--h9402c20_2"
//container " https://depot.galaxyproject.org/singularity/samtools:1.10--h9402c20_2"
conda (params.conda ? "bioconda::samtools=1.10" : null)
input:
tuple val(meta), path(bam), path(bai)
val options
output:
tuple val(meta), path("*.flagstat"), emit: flagstat
path "*.version.txt", emit: version
script:
def software = getSoftwareName(task.process)
"""
samtools flagstat $bam > ${bam}.flagstat
echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//' > ${software}.version.txt
"""
}

View file

@ -0,0 +1 @@
../../lib/functions.nf

View file

@ -0,0 +1,29 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions'
process SAMTOOLS_IDXSTATS {
tag "$meta.id"
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:options, publish_dir:getSoftwareName(task.process), publish_id:meta.id) }
container "quay.io/biocontainers/samtools:1.10--h9402c20_2"
//container " https://depot.galaxyproject.org/singularity/samtools:1.10--h9402c20_2"
conda (params.conda ? "bioconda::samtools=1.10" : null)
input:
tuple val(meta), path(bam), path(bai)
val options
output:
tuple val(meta), path("*.idxstats"), emit: idxstats
path "*.version.txt", emit: version
script:
def software = getSoftwareName(task.process)
"""
samtools idxstats $bam > ${bam}.idxstats
echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//' > ${software}.version.txt
"""
}

View file

@ -0,0 +1 @@
../../lib/functions.nf

View file

@ -0,0 +1,29 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions'
process SAMTOOLS_INDEX {
tag "$meta.id"
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:options, publish_dir:getSoftwareName(task.process), publish_id:meta.id) }
container "quay.io/biocontainers/samtools:1.10--h9402c20_2"
//container " https://depot.galaxyproject.org/singularity/samtools:1.10--h9402c20_2"
conda (params.conda ? "bioconda::samtools=1.10" : null)
input:
tuple val(meta), path(bam)
val options
output:
tuple val(meta), path("*.bai"), emit: bai
path "*.version.txt", emit: version
script:
def software = getSoftwareName(task.process)
"""
samtools index $bam
echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//' > ${software}.version.txt
"""
}

View file

@ -0,0 +1 @@
../../lib/functions.nf

View file

@ -0,0 +1,32 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions'
process SAMTOOLS_SORT {
tag "$meta.id"
label 'process_medium'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:options, publish_dir:getSoftwareName(task.process), publish_id:meta.id) }
container "quay.io/biocontainers/samtools:1.10--h9402c20_2"
//container " https://depot.galaxyproject.org/singularity/samtools:1.10--h9402c20_2"
conda (params.conda ? "bioconda::samtools=1.10" : null)
input:
tuple val(meta), path(bam)
val options
output:
tuple val(meta), path("*.bam"), emit: bam
path "*.version.txt", emit: version
script:
def software = getSoftwareName(task.process)
def ioptions = initOptions(options)
def prefix = ioptions.suffix ? "${meta.id}${ioptions.suffix}" : "${meta.id}"
"""
samtools sort $ioptions.args -@ $task.cpus -o ${prefix}.bam -T $prefix $bam
echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//' > ${software}.version.txt
"""
}

View file

@ -0,0 +1 @@
../../lib/functions.nf

View file

@ -0,0 +1,29 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions'
process SAMTOOLS_STATS {
tag "$meta.id"
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:options, publish_dir:getSoftwareName(task.process), publish_id:meta.id) }
container "quay.io/biocontainers/samtools:1.10--h9402c20_2"
//container " https://depot.galaxyproject.org/singularity/samtools:1.10--h9402c20_2"
conda (params.conda ? "bioconda::samtools=1.10" : null)
input:
tuple val(meta), path(bam), path(bai)
val options
output:
tuple val(meta), path("*.stats"), emit: stats
path "*.version.txt", emit: version
script:
def software = getSoftwareName(task.process)
"""
samtools stats $bam > ${bam}.stats
echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//' > ${software}.version.txt
"""
}