Skip to content
Snippets Groups Projects
Commit f70a43f9 authored by elabaron's avatar elabaron
Browse files

add nextflow scripts for umi_tools dedup

parent 135a57b6
No related branches found
No related tags found
No related merge requests found
profiles {
docker {
docker.temp = 'auto'
docker.enabled = true
process {
withName: sort_bam {
container = "lbmc/samtools:1.7"
cpus = 1
}
withName: counting {
container = "lbmc/umi_tools:1.0.0"
cpus = 1
}
}
}
singularity {
singularity.enabled = true
singularity.cacheDir = "./bin/"
process {
withName: sort_bam {
container = "lbmc/samtools:1.7"
cpus = 1
}
withName: counting {
container = "lbmc/umi_tools:1.0.0"
cpus = 1
}
}
}
psmn{
process{
withName: sort_bam {
beforeScript = "source $baseDir/.conda_psmn.sh"
conda = "$baseDir/.conda_envs/samtools_1.7"
executor = "sge"
clusterOptions = "-cwd -V"
cpus = 1
memory = "20GB"
time = "12h"
queue = 'monointeldeb128,monointeldeb48,h48-E5-2670deb128,h6-E5-2667v4deb128'
}
withName: counting {
beforeScript = "source /usr/share/lmod/lmod/init/bash; module use ~/privatemodules"
module = "umi_tools/1.0.0"
executor = "sge"
clusterOptions = "-cwd -V"
cpus = 1
memory = "20GB"
time = "12h"
queue = 'monointeldeb128,monointeldeb48,h48-E5-2670deb128,h6-E5-2667v4deb128'
}
}
}
}
params.bam = "$baseDir/data/bam/*.bam"
params.dedup_options = ""
log.info "bam files : ${params.bam}"
log.info "aditionnal option for umi_tools dedup : ${params.options}"
Channel
.fromPath( params.bam )
.ifEmpty { error "Cannot find any fastq files matching: ${params.bam}" }
.map { it -> [(it.baseName =~ /([^\.]*)/)[0][1], it]}
.set { bam_files }
process sort_bam {
tag "$file_id"
cpus 4
input:
set file_id, file(bam) from bam_files
output:
set file_id, "*_sorted.bam{,.bai}" into sorted_bam_files
script:
"""
# sort bam
samtools sort -@ ${task.cpus} -o ${file_id}_sorted.bam ${bam}
samtools index ${file_id}_sorted.bam
"""
}
process dedup {
tag "$file_id"
publishDir "results/dedup/", mode: 'copy'
input:
set file_id, file(bam) from sorted_bam_files
output:
file "*dedup.bam" into dedup_bam
file "*.txt" into dedup_report
script:
"""
umi_tools dedup -I ${bam[0]} \
${params.options} \
-S ${file_id}_dedup.bam > report.txt
"""
}
./nextflow src/nf_modules/umi_tools/dedup.nf \
-c src/nf_modules/umi_tools/dedup.config \
-profile docker \
--bam "data/tiny_dataset/map/tiny_v2.bam" \
-resume
if [ -x "$(command -v singularity)" ]; then
./nextflow src/nf_modules/umi_tools/dedup.nf \
-c src/nf_modules/umi_tools/dedup.config \
-profile singularity \
--bam "data/tiny_dataset/map/tiny_v2.bam" \
-resume
fi
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment