diff --git a/workflow/nextflow.config b/workflow/nextflow.config index 02c71af5c58998839c270f78aadfdfd84696dfa3..eee32fa6f754c55b6b8051eedee646eebf4066c2 100644 --- a/workflow/nextflow.config +++ b/workflow/nextflow.config @@ -30,11 +30,14 @@ process { container = 'bicf/gudmaprbkaligner:2.0.0' } withName: dedupData { - container = 'bicf/picard2.21.7:2.0.0' + container = 'bicf/gudmaprbkdedup:2.0.0' } withName: fastqc { container = 'bicf/fastqc:2.0.0' } + withName: makeBigWig { + container = 'bicf/deeptools3.3:2.0.0' + } } trace { @@ -64,4 +67,4 @@ manifest { mainScript = 'rna-seq.nf' version = 'v0.0.1_indev' nextflowVersion = '>=19.09.0' -} \ No newline at end of file +} diff --git a/workflow/rna-seq.nf b/workflow/rna-seq.nf index 0fd3ee0d872768d1d7d80c0be6bcc0cbafd105e0..06e867c4413413dc94704a11fc1b3c94f353cc9b 100755 --- a/workflow/rna-seq.nf +++ b/workflow/rna-seq.nf @@ -320,7 +320,7 @@ process dedupData { path rawBam output: - path ("${repRID}.deduped.bam") into dedupBam + tuple val ("${repRID}"), path ("${repRID}.sorted.deduped.bam"), path ("${repRID}.sorted.deduped.bai") into dedupBam path ("${repRID}.dedup.out") path ("${repRID}.dedup.err") @@ -331,6 +331,8 @@ process dedupData { # remove duplicated reads java -jar /picard/build/libs/picard.jar MarkDuplicates I=${rawBam} O=${repRID}.deduped.bam M=${repRID}.deduped.Metrics.txt REMOVE_DUPLICATES=true 1>>${repRID}.dedup.out 2>> ${repRID}.dedup.err + samtools sort -@ `nproc` -O BAM -o ${repRID}.sorted.deduped.bam ${repRID}.deduped.bam 1>>${repRID}.dedup.out 2>> ${repRID}.dedup.err + samtools index -@ `nproc` -b ${repRID}.sorted.deduped.bam ${repRID}.sorted.deduped.bai 1>>${repRID}.dedup.out 2>> ${repRID}.dedup.err """ } @@ -356,4 +358,23 @@ process fastqc { # run fastqc fastqc *.fastq.gz -o . >>${repRID}.fastqc.err """ -} \ No newline at end of file +} + +/* + *Make BigWig files for later processes +*/ +process makeBigWig { + tag "${repRID}" + publishDir "${logsDir}", mode: 'copy', pattern: "*.makeBigWig.err" + + input: + set val (repRID), path (inBam), path (inBai) from dedupBam + + output: + path ("${repRID}.bw") + + script: + """ + bamCoverage -p `nproc` -b ${inBam} -o ${repRID}.bw + """ +} diff --git a/workflow/tests/test_makeBigWig.py b/workflow/tests/test_makeBigWig.py new file mode 100644 index 0000000000000000000000000000000000000000..198b5d2d4cdecd9013e08fbe3eae9c9b7303ef1a --- /dev/null +++ b/workflow/tests/test_makeBigWig.py @@ -0,0 +1,14 @@ +#!/usr/bin/env python3 + +import pytest +import pandas as pd +import os +import utils + +data_output_path = os.path.dirname(os.path.abspath(__file__)) + \ + '/../../' + + +@pytest.mark.makeBigWig +def test_makeBigWig(): + assert os.path.exists(os.path.join(data_output_path, 'Q-Y5JA_1M.se.bw'))