Skip to content

Commit

Permalink
Moved out genebody_coverage into its own process
Browse files Browse the repository at this point in the history
  • Loading branch information
Hammarn committed Aug 28, 2017
1 parent 9b6342b commit f6f6669
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 10 deletions.
14 changes: 10 additions & 4 deletions conf/uppmax.config
Original file line number Diff line number Diff line change
Expand Up @@ -60,16 +60,22 @@ process {
$hisat2_sortOutput {
module = ['bioinfo-tools', 'samtools/1.3']
cpus = { 4 * task.attempt }
memory = { 32.GB * task.attempt }
memory = { 24.GB * task.attempt }
time = { 8.h * task.attempt }
}
$rseqc {
module = ['bioinfo-tools', 'rseqc/2.6.1', 'samtools/1.3']
cpus = { 8 * task.attempt }
memory = { 32.GB * task.attempt }
time = { 7.h * task.attempt }
cpus = { 1 * task.attempt }
memory = { 24.GB * task.attempt }
time = { 4.h * task.attempt }
errorStrategy = { task.exitStatus == 143 ? 'retry' : 'ignore' }
}
$genebody_coverage {
module = ['bioinfo-tools', 'rseqc/2.6.1', 'samtools/1.3']
cpus = { 1 * task.attempt }
memory = { 32.GB * task.attempt }
time = { 8.h * task.attempt }
}
$preseq {
module = ['bioinfo-tools', 'preseq/0.1.0']
errorStrategy = { task.exitStatus == 143 ? 'retry' : 'ignore' }
Expand Down
38 changes: 32 additions & 6 deletions main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,7 @@ if(params.aligner == 'star'){
star_aligned
.filter { logs, bams -> check_log(logs) }
.flatMap { logs, bams -> bams }
.into { bam_count; bam_rseqc; bam_preseq; bam_markduplicates; bam_featurecounts; bam_stringtieFPKM }
.into { bam_count; bam_rseqc; bam_preseq; bam_markduplicates; bam_featurecounts; bam_stringtieFPKM; bam_geneBodyCoverage }
}


Expand Down Expand Up @@ -656,7 +656,7 @@ if(params.aligner == 'hisat2'){
file hisat2_bam

output:
file "${hisat2_bam.baseName}.sorted.bam" into bam_count, bam_rseqc, bam_preseq, bam_markduplicates, bam_featurecounts, bam_stringtieFPKM
file "${hisat2_bam.baseName}.sorted.bam" into bam_count, bam_rseqc, bam_preseq, bam_markduplicates, bam_featurecounts, bam_stringtieFPKM, bam_geneBodyCoverage

script:
def avail_mem = task.memory == null ? '' : "-m ${task.memory.toBytes() / task.cpus}"
Expand All @@ -669,7 +669,8 @@ if(params.aligner == 'hisat2'){
}
}


bed12
.into { bed_rseqc; bed_genebody_coverage }
/*
* STEP 4 - RSeQC analysis
*/
Expand Down Expand Up @@ -707,7 +708,7 @@ process rseqc {

input:
file bam_rseqc
file bed12 from bed12.collect()
file bed12 from bed_rseqc.collect()

output:
file "*.{txt,pdf,r,xls}" into rseqc_results
Expand All @@ -722,18 +723,42 @@ process rseqc {
"""
samtools index $bam_rseqc
infer_experiment.py -i $bam_rseqc -r $bed12 > ${bam_rseqc.baseName}.infer_experiment.txt
RPKM_saturation.py -i $bam_rseqc -r $bed12 $strandRule -o ${bam_rseqc.baseName}.RPKM_saturation
junction_annotation.py -i $bam_rseqc -o ${bam_rseqc.baseName}.rseqc -r $bed12
bam_stat.py -i $bam_rseqc 2> ${bam_rseqc.baseName}.bam_stat.txt
junction_saturation.py -i $bam_rseqc -o ${bam_rseqc.baseName}.rseqc -r $bed12 2> ${bam_rseqc.baseName}.junction_annotation_log.txt
inner_distance.py -i $bam_rseqc -o ${bam_rseqc.baseName}.rseqc -r $bed12
geneBody_coverage.py -i $bam_rseqc -o ${bam_rseqc.baseName}.rseqc -r $bed12
read_distribution.py -i $bam_rseqc -r $bed12 > ${bam_rseqc.baseName}.read_distribution.txt
read_duplication.py -i $bam_rseqc -o ${bam_rseqc.baseName}.read_duplication
echo "Filename $bam_rseqc RseQC version: "\$(read_duplication.py --version)
"""
}

/*
* Step 4.1 Rseqc genebody_coverage
*/
process genebody_coverage {
tag "${bam_geneBodyCoverage.baseName - '.sorted'}"
publishDir "${params.outdir}/rseqc" , mode: 'copy',
saveAs: {filename ->
else if (filename.indexOf("geneBodyCoverage.curves.pdf") > 0) "geneBodyCoverage/$filename"
else if (filename.indexOf("geneBodyCoverage.r") > 0) "geneBodyCoverage/rscripts/$filename"
else if (filename.indexOf("geneBodyCoverage.txt") > 0) "geneBodyCoverage/data/$filename"
else "$filename"
}

input:
file bam_geneBodyCoverage
file bed12 from bed_genebody_coverage.collect()

output:

file "*.{txt,pdf,r,xls}" into genebody_coverage_results
script:
"""
samtools index $bam_geneBodyCoverage
geneBody_coverage.py -i $bam_geneBodyCoverage -o ${bam_geneBodyCoverage.baseName}.rseqc -r $bed12
"""
}

/*
* STEP 5 - preseq analysis
Expand Down Expand Up @@ -974,6 +999,7 @@ process multiqc {
file ('trimgalore/*') from trimgalore_results.collect()
file ('alignment/*') from alignment_logs.collect()
file ('rseqc/*') from rseqc_results.collect()
file ('rseqc/*') from genebody_coverage_results.collect()
file ('preseq/*') from preseq_results.collect()
file ('dupradar/*') from dupradar_results.collect()
file ('featureCounts/*') from featureCounts_logs.collect()
Expand Down

0 comments on commit f6f6669

Please sign in to comment.