Merge pull request #53 from drpatelh/master

Add in chipseq modules
This commit is contained in:
Harshil Patel 2020-08-05 17:46:59 +01:00 committed by GitHub
commit 1073ea47fa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
78 changed files with 875 additions and 242 deletions

View file

@ -15,12 +15,12 @@ input:
- input:
type: file
description: Input fasta file
pattern: *.{fasta,fa}
pattern: "*.{fasta,fa}"
output:
-
- index:
type: file
description: bwa indexes file
pattern: *.{fasta,fa}.{amb,ann,bwt,pac,sa}
pattern: "*.{fasta,fa}.{amb,ann,bwt,pac,sa}"
authors:
- @maxulysse
- "@maxulysse"

View file

@ -1,16 +0,0 @@
process bwa_index {
tag "$fasta"
container 'quay.io/biocontainers/bwa:0.7.17--hed695b0_7'
input:
path fasta
output:
path "${fasta}.*"
script:
"""
bwa index ${fasta}
"""
}

View file

@ -1,7 +0,0 @@
FROM nfcore/base
LABEL authors="Jeremy Guntoro" \
description="Docker image containing all requirements for nf-core/modules/bwa/mem module"
COPY environment.yml /
RUN conda env create -f /environment.yml && conda clean -a
ENV PATH /opt/conda/envs/nf-core-bwa-mem/bin:$PATH

View file

@ -1,10 +0,0 @@
# You can use this file to create a conda environment for this pipeline:
# conda env create -f environment.yml
name: nf-core-bwa-mem
channels:
- conda-forge
- bioconda
- defaults
dependencies:
- bioconda::bwa=0.7.17
- bioconda::samtools=1.9

View file

@ -1,27 +0,0 @@
params.bwa_options = "-M -B 2"
params.sequencer = "ILLUMINA"
process bwa_mem {
tag "$id"
publishDir "${params.outdir}/bwa_mem", mode: 'copy'
//TO-DO: Change container declaration, for now a test container is present in my personal docker acccount
container 'jeremy1805/bwa-mem-img'
input:
tuple val(id), path(reads)
path genomeindex
val indexprefix
output:
tuple path("*.bam"), path("*.bai")
script:
"""
bwa mem -t ${task.cpus} -R "@RG\\tID:${id}\\tLB:${id}\\tSM:${id}\\tPL:${params.sequencer}" \\
${params.bwa_options} ${indexprefix} ${reads} | samtools sort -@8 -O BAM -o ${id}.bam -
samtools index ${id}.bam
"""
}

View file

@ -1,8 +0,0 @@
FROM nfcore/base:1.7
LABEL authors="phil.ewels@scilifelab.se" \
description="Docker image for nf-core modules samtools"
# foobar
COPY environment.yml /
RUN conda env create -f /environment.yml && conda clean -a
ENV PATH /opt/conda/envs/nf-core-modules-samtools/bin:$PATH

View file

@ -1,9 +0,0 @@
# You can use this file to create a conda environment for this pipeline:
# conda env create -f environment.yml
name: nf-core-modules-samtools
channels:
- conda-forge
- bioconda
- defaults
dependencies:
- samtools=1.9

View file

@ -1,21 +0,0 @@
process samtools_index {
tag "${bam.baseName}"
container 'quay.io/biocontainers/samtools:1.9--h10a08f8_12'
input:
path bam
output:
path "*.bai"
script:
def suff_mem = ("${(task.memory.toBytes() - 6000000000) / task.cpus}" > 2000000000) ? 'true' : 'false'
def avail_mem = (task.memory && suff_mem) ? "-m" + "${(task.memory.toBytes() - 6000000000) / task.cpus}" : ''
"""
samtools index $bam \\
-@ ${task.cpus} ${avail_mem}
samtools --version &> v_samtools.txt
"""
}

View file

@ -1,18 +0,0 @@
process samtools_index {
tag "${bam.baseName}"
container 'quay.io/biocontainers/samtools:1.9--h10a08f8_12'
input:
path bam
output:
path "*.bam.bai"
script:
"""
samtools index $bam
samtools --version &> v_samtools.txt
"""
}

View file

@ -1,10 +0,0 @@
FROM nfcore/base:1.7
LABEL authors="phil.ewels@scilifelab.se" \
description="Docker image for nf-core modules trimgalore"
#### THIS IS A BUG
# foobar
COPY environment.yml /
RUN conda env create -f /environment.yml && conda clean -a
ENV PATH /opt/conda/envs/nf-core-modules-trimgalore/bin:$PATH

View file

@ -1,9 +0,0 @@
# You can use this file to create a conda environment for this pipeline:
# conda env create -f environment.yml
name: nf-core-modules-trimgalore
channels:
- conda-forge
- bioconda
- defaults
dependencies:
- trim-galore=0.6.4

View file

@ -1,102 +0,0 @@
nextflow.preview.dsl=2
params.singlecell = ''
params.rrbs = ''
params.pbat = ''
params.single_end = false
params.trim_nextseq = 0
params.clip_r1 = 0
params.clip_r2 = 0
params.three_prime_clip_r1 = 0
params.three_prime_clip_r2 = 0
process TRIM_GALORE {
// container 'quay.io/biocontainers/trim-galore:0.6.5--0' // maybe later
// tag "$sample_id"
// Trimming reports are not generated for e.g. --hardtrim5, --clock etc
// saveAs: {filename ->
// else if (filename.indexOf("trimming_report.txt") > 0) "logs/$filename"
// else filename
// }
publishDir "${outdir}/trim_galore",
mode: "copy", overwrite: true
input:
tuple val(name), path(reads)
val outdir
val trim_galore_args
val verbose
output:
tuple val(name), path ("*fq.gz"), emit: reads
path "*trimming_report.txt", optional: true, emit: report
script:
if (verbose){
println ("[MODULE] TRIM GALORE ARGS: " + trim_galore_args)
}
trim_galore_args += " --gzip " // we like small files
pairedString = 0
if (reads instanceof List) {
pairedString = 1
trim_galore_args += " --paired "
}
if (params.clip_r1 > 0){
trim_galore_args += " --clip_r1 ${params.clip_r1} "
}
if (params.clip_r2 > 0){
trim_galore_args += " --clip_r2 ${params.clip_r2} "
}
if (params.three_prime_clip_r1> 0){
trim_galore_args += " --three_prime_clip_r1 ${params.three_prime_clip_r1} "
}
if (params.three_prime_clip_r2 > 0){
trim_galore_args += " --three_prime_clip_r2 ${params.three_prime_clip_r2} "
}
if (params.trim_nextseq > 0){
trim_galore_args += " --nextseq ${params.trim_nextseq} "
}
// Pre-set parameters for certain bisulfite-seq applications
if (params.singlecell){
trim_galore_args += " --clip_r1 6 "
if (pairedString == 1){
trim_galore_args += " --clip_r2 6 "
}
}
if (params.rrbs){
trim_galore_args += " --rrbs "
}
if (params.pbat){
trim_galore_args += " --clip_r1 $params.pbat "
if (pairedString == 1){
trim_galore_args += " --clip_r2 $params.pbat "
}
}
"""
module load trim_galore
trim_galore $trim_galore_args $reads
"""
}

View file

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

View file

@ -0,0 +1,31 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions'
process BWA_INDEX {
tag "$fasta"
label 'process_high'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:options, publish_dir:getSoftwareName(task.process), publish_id:'') }
container "biocontainers/bwa:v0.7.17_cv1"
//container "https://depot.galaxyproject.org/singularity/bwa:0.7.17--hed695b0_7"
conda (params.conda ? "bioconda::bwa=0.7.17" : null)
input:
path fasta
val options
output:
path "${fasta}.*", emit: index
path "*.version.txt", emit: version
script:
def software = getSoftwareName(task.process)
def ioptions = initOptions(options)
"""
bwa index $ioptions.args $fasta
echo \$(bwa 2>&1) | sed 's/^.*Version: //; s/Contact:.*\$//' > ${software}.version.txt
"""
}

View file

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

42
software/bwa/mem/main.nf Normal file
View file

@ -0,0 +1,42 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions'
process BWA_MEM {
tag "$meta.id"
label 'process_high'
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/mulled-v2-fe8faa35dbf6dc65a0f7f5d4ea12e31a79f73e40:eabfac3657eda5818bae4090db989e3d41b01542-0"
//container "https://depot.galaxyproject.org/singularity/mulled-v2-fe8faa35dbf6dc65a0f7f5d4ea12e31a79f73e40:eabfac3657eda5818bae4090db989e3d41b01542-0"
conda (params.conda ? "bioconda::bwa=0.7.17 bioconda::samtools=1.10" : null)
input:
tuple val(meta), path(reads)
path index
path fasta
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}"
def rg = meta.read_group ? "-R ${meta.read_group}" : ""
"""
bwa mem \\
$ioptions.args \\
$rg \\
-t $task.cpus \\
$fasta \\
$reads \\
| samtools view $ioptions.args2 -@ $task.cpus -bS -o ${prefix}.bam -
echo \$(bwa 2>&1) | sed 's/^.*Version: //; s/Contact:.*\$//' > ${software}.version.txt
"""
}

View file

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

View file

@ -0,0 +1,41 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions'
process DEEPTOOLS_COMPUTEMATRIX {
tag "$meta.id"
label 'process_high'
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/deeptools:3.4.3--py_0"
//container "https://depot.galaxyproject.org/singularity/deeptools:3.4.3--py_0"
conda (params.conda ? "bioconda::deeptools=3.4.3" : null)
input:
tuple val(meta), path(bigwig)
path bed
val options
output:
tuple val(meta), path("*.mat.gz"), emit: matrix
tuple val(meta), path("*.mat.tab"), emit: table
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}"
"""
computeMatrix \\
$ioptions.args \\
--regionsFileName $bed \\
--scoreFileName $bigwig \\
--outFileName ${prefix}.computeMatrix.mat.gz \\
--outFileNameMatrix ${prefix}.computeMatrix.vals.mat.tab \\
--numberOfProcessors $task.cpus
computeMatrix --version | sed -e "s/computeMatrix //g" > ${software}.version.txt
"""
}

View file

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

View file

@ -0,0 +1,43 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions'
process DEEPTOOLS_PLOTFINGERPRINT {
tag "$meta.id"
label 'process_high'
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/deeptools:3.4.3--py_0"
//container "https://depot.galaxyproject.org/singularity/deeptools:3.4.3--py_0"
conda (params.conda ? "bioconda::deeptools=3.4.3" : null)
input:
tuple val(meta), path(bams), path(bais)
val options
output:
tuple val(meta), path("*.pdf"), emit: pdf
tuple val(meta), path("*.raw.txt"), emit: matrix
tuple val(meta), path("*.qcmetrics.txt"), emit: metrics
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}"
def extend = (meta.single_end && params.fragment_size > 0) ? "--extendReads ${params.fragment_size}" : ''
"""
plotFingerprint \\
$ioptions.args \\
$extend \\
--bamfiles ${bams.join(' ')} \\
--plotFile ${prefix}.plotFingerprint.pdf \\
--outRawCounts ${prefix}.plotFingerprint.raw.txt \\
--outQualityMetrics ${prefix}.plotFingerprint.qcmetrics.txt \\
--numberOfProcessors $task.cpus
plotFingerprint --version | sed -e "s/plotFingerprint //g" > ${software}.version.txt
"""
}

View file

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

View file

@ -0,0 +1,38 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions'
process DEEPTOOLS_PLOTHEATMAP {
tag "$meta.id"
label 'process_low'
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/deeptools:3.4.3--py_0"
//container "https://depot.galaxyproject.org/singularity/deeptools:3.4.3--py_0"
conda (params.conda ? "bioconda::deeptools=3.4.3" : null)
input:
tuple val(meta), path(matrix)
val options
output:
tuple val(meta), path("*.pdf"), emit: pdf
tuple val(meta), path("*.tab"), emit: table
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}"
"""
plotHeatmap \\
$ioptions.args \\
--matrixFile $matrix \\
--outFileName ${prefix}.plotHeatmap.pdf \\
--outFileNameMatrix ${prefix}.plotHeatmap.mat.tab
plotHeatmap --version | sed -e "s/plotHeatmap //g" > ${software}.version.txt
"""
}

View file

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

View file

@ -0,0 +1,38 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions'
process DEEPTOOLS_PLOTPROFILE {
tag "$meta.id"
label 'process_low'
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/deeptools:3.4.3--py_0"
//container "https://depot.galaxyproject.org/singularity/deeptools:3.4.3--py_0"
conda (params.conda ? "bioconda::deeptools=3.4.3" : null)
input:
tuple val(meta), path(matrix)
val options
output:
tuple val(meta), path("*.pdf"), emit: pdf
tuple val(meta), path("*.tab"), emit: table
path "*.version.txt", emit: version
script:
def software = getSoftwareName(task.process)
def ioptions = initOptions(options)
prefix = ioptions.suffix ? "${meta.id}${ioptions.suffix}" : "${meta.id}"
"""
plotProfile \\
$ioptions.args \\
--matrixFile $matrix \\
--outFileName ${prefix}.plotProfile.pdf \\
--outFileNameData ${prefix}.plotProfile.tab
plotProfile --version | sed -e "s/plotProfile //g" > ${software}.version.txt
"""
}

View file

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

View file

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

View file

@ -1,5 +1,5 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './lib/functions'
include { initOptions; saveFiles; getSoftwareName } from './functions'
process FASTQC {
tag "$meta.id"

View file

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

View file

@ -0,0 +1,43 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions'
def VERSION = '4.11'
process HOMER_ANNOTATEPEAKS {
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/homer:4.11--pl526h9a982cc_2"
//container "https://depot.galaxyproject.org/singularity/homer:4.11--pl526h9a982cc_2"
conda (params.conda ? "bioconda::homer=4.11" : null)
input:
tuple val(meta), path(peak)
path fasta
path gtf
val options
output:
tuple val(meta), path("*annotatePeaks.txt"), emit: txt
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}"
"""
annotatePeaks.pl \\
$peak \\
$fasta \\
$ioptions.args \\
-gtf $gtf \\
-cpu $task.cpus \\
> ${prefix}.annotatePeaks.txt
echo $VERSION > ${software}.version.txt
"""
}

View file

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

View file

@ -0,0 +1,47 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions'
process MACS2_CALLPEAK {
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/macs2:2.2.7.1--py37h516909a_0"
//container "https://depot.galaxyproject.org/singularity/macs2:2.2.7.1--py37h516909a_0"
conda (params.conda ? "bioconda::macs2=2.2.7.1" : null)
input:
tuple val(meta), path(ipbam), path(controlbam)
val macs2_gsize
val options
output:
tuple val(meta), path("*.{narrowPeak,broadPeak}"), emit: peak
tuple val(meta), path("*.xls"), emit: xls
tuple val(meta), path("*.gappedPeak"), emit: gapped optional true
tuple val(meta), path("*.bed"), emit: bed optional true
tuple val(meta), path("*.bdg"), emit: bdg optional true
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}"
def format = meta.single_end ? 'BAM' : 'BAMPE'
def control = controlbam ? "--control $controlbam" : ''
"""
macs2 \\
callpeak \\
$ioptions.args \\
--gsize $macs2_gsize \\
--format $format \\
--name $prefix \\
--treatment $ipbam \\
$control
macs2 --version | sed -e "s/macs2 //g" > ${software}.version.txt
"""
}

View file

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

View file

@ -0,0 +1,37 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions'
def VERSION = '1.2.2'
process PHANTOMPEAKQUALTOOLS {
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/phantompeakqualtools:1.2.2--0"
//container "https://depot.galaxyproject.org/singularity/phantompeakqualtools:1.2.2--0"
conda (params.conda ? "bioconda::phantompeakqualtools=1.2.2" : null)
input:
tuple val(meta), path(bam)
val options
output:
tuple val(meta), path("*.out"), emit: spp
tuple val(meta), path("*.pdf"), emit: pdf
tuple val(meta), path("*.Rdata"), emit: rdata
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}"
"""
RUN_SPP=`which run_spp.R`
Rscript -e "library(caTools); source(\\"\$RUN_SPP\\")" -c="$bam" -savp="${prefix}.spp.pdf" -savd="${prefix}.spp.Rdata" -out="${prefix}.spp.out" -p=$task.cpus
echo $VERSION > ${software}.version.txt
"""
}

View file

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

View file

@ -0,0 +1,47 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions'
process PICARD_COLLECTMULTIPLEMETRICS {
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/picard:2.23.2--0"
//container "https://depot.galaxyproject.org/singularity/picard:2.23.2--0"
conda (params.conda ? "bioconda::picard=2.23.2" : null)
input:
tuple val(meta), path(bam)
path fasta
val options
output:
tuple val(meta), path("*_metrics"), emit: metrics
tuple val(meta), path("*.pdf"), emit: pdf
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}"
def avail_mem = 3
if (!task.memory) {
log.info '[Picard CollectMultipleMetrics] Available memory not known - defaulting to 3GB. Specify process memory requirements to change this.'
} else {
avail_mem = task.memory.giga
}
"""
picard \\
-Xmx${avail_mem}g \\
CollectMultipleMetrics \\
$ioptions.args \\
INPUT=$bam \\
OUTPUT=${prefix}.CollectMultipleMetrics \\
REFERENCE_SEQUENCE=$fasta
echo \$(picard CollectMultipleMetrics --version 2>&1) | awk -F' ' '{print \$NF}' > ${software}.version.txt
"""
}

View file

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

View file

@ -0,0 +1,46 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions'
process PICARD_MARKDUPLICATES {
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/picard:2.23.2--0"
//container "https://depot.galaxyproject.org/singularity/picard:2.23.2--0"
conda (params.conda ? "bioconda::picard=2.23.2" : null)
input:
tuple val(meta), path(bam)
val options
output:
tuple val(meta), path("*.bam"), emit: bam
tuple val(meta), path("*.metrics.txt"), emit: metrics
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}"
def avail_mem = 3
if (!task.memory) {
log.info '[Picard MarkDuplicates] Available memory not known - defaulting to 3GB. Specify process memory requirements to change this.'
} else {
avail_mem = task.memory.giga
}
"""
picard \\
-Xmx${avail_mem}g \\
MarkDuplicates \\
$ioptions.args \\
INPUT=$bam \\
OUTPUT=${prefix}.bam \\
METRICS_FILE=${prefix}.MarkDuplicates.metrics.txt
echo \$(picard MarkDuplicates --version 2>&1) | awk -F' ' '{print \$NF}' > ${software}.version.txt
"""
}

View file

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

View file

@ -0,0 +1,51 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions'
process PICARD_MERGESAMFILES {
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/picard:2.23.2--0"
//container "https://depot.galaxyproject.org/singularity/picard:2.23.2--0"
conda (params.conda ? "bioconda::picard=2.23.2" : null)
input:
tuple val(meta), path(bams)
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}"
def bam_files = bams.sort()
def avail_mem = 3
if (!task.memory) {
log.info '[Picard MergeSamFiles] Available memory not known - defaulting to 3GB. Specify process memory requirements to change this.'
} else {
avail_mem = task.memory.giga
}
if (bam_files.size() > 1) {
"""
picard \\
-Xmx${avail_mem}g \\
MergeSamFiles \\
$ioptions.args \\
${'INPUT='+bam_files.join(' INPUT=')} \\
OUTPUT=${prefix}.bam
echo \$(picard MergeSamFiles --version 2>&1) | awk -F' ' '{print \$NF}' > ${software}.version.txt
"""
} else {
"""
ln -s ${bam_files[0]} ${prefix}.bam
echo \$(picard MergeSamFiles --version 2>&1) | awk -F' ' '{print \$NF}' > ${software}.version.txt
"""
}
}

View file

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

View file

@ -0,0 +1,42 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions'
process PRESEQ_LCEXTRAP {
tag "$meta.id"
label 'process_medium'
label 'error_ignore'
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/preseq:2.0.3--hf53bd2b_3"
//container "https://depot.galaxyproject.org/singularity/preseq:2.0.3--hf53bd2b_3"
conda (params.conda ? "bioconda::preseq=2.0.3" : null)
input:
tuple val(meta), path(bam)
val options
output:
tuple val(meta), path("*.ccurve.txt"), emit: ccurve
tuple val(meta), path("*.log"), emit: log
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}"
def pe = meta.single_end ? '' : '-pe'
"""
preseq \\
lc_extrap \\
$ioptions.args \\
$pe \\
-output ${prefix}.ccurve.txt \\
$bam
cp .command.err ${prefix}.command.log
echo \$(preseq 2>&1) | sed 's/^.*Version: //; s/Usage:.*\$//' > ${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_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
"""
}

View file

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

View file

@ -0,0 +1,41 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions'
process SUBREAD_FEATURECOUNTS {
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/subread:2.0.1--hed695b0_0"
//container "https://depot.galaxyproject.org/singularity/subread:2.0.1--hed695b0_0"
conda (params.conda ? "bioconda::subread=2.0.1" : null)
input:
tuple val(meta), path(bams), path(annotation)
val options
output:
tuple val(meta), path("*featureCounts.txt"), emit: txt
tuple val(meta), path("*featureCounts.txt.summary"), emit: summary
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}"
def pe = meta.single_end ? '' : '-p'
"""
featureCounts \\
$ioptions.args \\
$pe \\
-T $task.cpus \\
-a $annotation \\
-o ${prefix}.featureCounts.txt \\
${bams.join(' ')}
echo \$(featureCounts -v 2>&1) | sed -e "s/featureCounts v//g" > ${software}.version.txt
"""
}

View file

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

View file

@ -0,0 +1,79 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions'
process TRIMGALORE {
tag "$meta.id"
label 'process_high'
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/trim-galore:0.6.5--0"
//container "https://depot.galaxyproject.org/singularity/trim-galore:0.6.5--0"
conda (params.conda ? "bioconda::trim-galore=0.6.5" : null)
input:
tuple val(meta), path(reads)
val options
output:
tuple val(meta), path("*.fq.gz"), emit: reads
tuple val(meta), path("*.html"), emit: html optional true
tuple val(meta), path("*.zip"), emit: zip optional true
tuple val(meta), path("*report.txt"), emit: log
path "*.version.txt", emit: version
script:
// Calculate number of --cores for TrimGalore based on value of task.cpus
// See: https://github.com/FelixKrueger/TrimGalore/blob/master/Changelog.md#version-060-release-on-1-mar-2019
// See: https://github.com/nf-core/atacseq/pull/65
def cores = 1
if (task.cpus) {
cores = (task.cpus as int) - 4
if (meta.single_end) cores = (task.cpus as int) - 3
if (cores < 1) cores = 1
if (cores > 4) cores = 4
}
// Clipping presets have to be evaluated in the context of SE/PE
def c_r1 = params.clip_r1 > 0 ? "--clip_r1 ${params.clip_r1}" : ''
def c_r2 = params.clip_r2 > 0 ? "--clip_r2 ${params.clip_r2}" : ''
def tpc_r1 = params.three_prime_clip_r1 > 0 ? "--three_prime_clip_r1 ${params.three_prime_clip_r1}" : ''
def tpc_r2 = params.three_prime_clip_r2 > 0 ? "--three_prime_clip_r2 ${params.three_prime_clip_r2}" : ''
// Added soft-links to original fastqs for consistent naming in MultiQC
def software = getSoftwareName(task.process)
def ioptions = initOptions(options)
def prefix = ioptions.suffix ? "${meta.id}${ioptions.suffix}" : "${meta.id}"
if (meta.single_end) {
"""
[ ! -f ${prefix}.fastq.gz ] && ln -s $reads ${prefix}.fastq.gz
trim_galore \\
$ioptions.args \\
--cores $cores \\
--gzip \\
$c_r1 \\
$tpc_r1 \\
${prefix}.fastq.gz
echo \$(trim_galore --version 2>&1) | sed 's/^.*version //; s/Last.*\$//' > ${software}.version.txt
"""
} else {
"""
[ ! -f ${prefix}_1.fastq.gz ] && ln -s ${reads[0]} ${prefix}_1.fastq.gz
[ ! -f ${prefix}_2.fastq.gz ] && ln -s ${reads[1]} ${prefix}_2.fastq.gz
trim_galore \\
$ioptions.args \\
--cores $cores \\
--paired \\
--gzip \\
$c_r1 \\
$c_r2 \\
$tpc_r1 \\
$tpc_r2 \\
${prefix}_1.fastq.gz \\
${prefix}_2.fastq.gz
echo \$(trim_galore --version 2>&1) | sed 's/^.*version //; s/Last.*\$//' > ${software}.version.txt
"""
}
}

View file

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

View file

@ -0,0 +1,35 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions'
def VERSION = '377'
process UCSC_BEDRAPHTOBIGWIG {
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/ucsc-bedgraphtobigwig:377--h446ed27_1"
//container "https://depot.galaxyproject.org/singularity/ucsc-bedgraphtobigwig:377--h446ed27_1"
conda (params.conda ? "bioconda::ucsc-bedgraphtobigwig=377" : null)
input:
tuple val(meta), path(bedgraph)
path sizes
val options
output:
tuple val(meta), path("*.bigWig"), emit: bigwig
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}"
"""
bedGraphToBigWig $bedgraph $sizes ${prefix}.bigWig
echo $VERSION > ${software}.version.txt
"""
}