Skip to content

Commit

Permalink
multithread samtools and bigwig
Browse files Browse the repository at this point in the history
  • Loading branch information
MateuszChilinski committed Jul 30, 2024
1 parent 510b990 commit 8c3f12d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,6 @@ RUN pip3 install plumbum

RUN curl -s https://get.nextflow.io | bash && mv nextflow /opt/

RUN wget https://github.com/SFGLab/nf-hichip/archive/refs/tags/1.6.tar.gz && tar -xvzf 1.6.tar.gz && mv nf-hichip-1.6/* . && rm 1.6.tar.gz && rm -r nf-hichip-1.6
RUN wget https://github.com/SFGLab/nf-hichip/archive/refs/tags/1.7.tar.gz && tar -xvzf 1.7.tar.gz && mv nf-hichip-1.7/* . && rm 1.7.tar.gz && rm -r nf-hichip-1.7

RUN /opt/nextflow
8 changes: 4 additions & 4 deletions main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ process FilterQuality {
script:
"""
samtools view -F 0x04 -b ${mapped_bam} > ${sample}_output_removed_not_aligned.bam
samtools view -q ${params.mapq} -t ${params.threads} -b ${sample}_output_removed_not_aligned.bam > ${sample}_output_filtered.bam
samtools view -q ${params.mapq} -@ ${params.threads} -b ${sample}_output_removed_not_aligned.bam > ${sample}_output_filtered.bam
"""
}

Expand All @@ -110,7 +110,7 @@ process RemoveDuplicates {

script:
"""
samtools sort -n -t ${params.threads} -m 1G ${bam} -o - | samtools fixmate --threads ${params.threads} - - | samtools rmdup -S - ${sample}_dedup.bam
samtools sort -n -@ ${params.threads} -m 1G ${bam} -o - | samtools fixmate -@ ${params.threads} - - | samtools rmdup -S - ${sample}_dedup.bam
"""
}

Expand All @@ -126,9 +126,9 @@ process CreateBigwig {

script:
"""
samtools sort -t ${params.threads} -m ${params.mem}G ${final_bam} -o ${sample}_output_final_sorted.bam
samtools sort -@ ${params.threads} -m ${params.mem}G ${final_bam} -o ${sample}_output_final_sorted.bam
samtools index ${sample}_output_final_sorted.bam
bamCoverage -b ${sample}_output_final_sorted.bam -o ${sample}_output.bigWig -p ${params.threads}
bamCoverage -p ${params.threads} -b ${sample}_output_final_sorted.bam -o ${sample}_output.bigWig -p ${params.threads}
"""
}

Expand Down
16 changes: 8 additions & 8 deletions main_chipseq.nf
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ process FilterQuality {
"""
samtools view -F 0x04 -b ${mapped_bam} > ${sample}_output_removed_not_aligned.bam
samtools view -F 0x04 -b ${bam_input} > ${sample}_input_output_removed_not_aligned.bam
samtools view -q ${params.mapq} -t ${params.threads} -b ${sample}_output_removed_not_aligned.bam > ${sample}_output_filtered.bam
samtools view -q ${params.mapq} -t ${params.threads} -b ${sample}_input_output_removed_not_aligned.bam > ${sample}_input_output_filtered.bam
samtools view -q ${params.mapq} -@ ${params.threads} -b ${sample}_output_removed_not_aligned.bam > ${sample}_output_filtered.bam
samtools view -q ${params.mapq} -@ ${params.threads} -b ${sample}_input_output_removed_not_aligned.bam > ${sample}_input_output_filtered.bam
"""
}

Expand All @@ -124,8 +124,8 @@ process RemoveDuplicates {

script:
"""
samtools sort -n -t ${params.threads} -m 1G ${bam} -o - | samtools fixmate --threads ${params.threads} - - | samtools rmdup -S - ${sample}_dedup.bam
samtools sort -n -t ${params.threads} -m 1G ${input_bam} -o - | samtools fixmate --threads ${params.threads} - - | samtools rmdup -S - ${sample}_input_dedup.bam
samtools sort -n -@ ${params.threads} -m 1G ${bam} -o - | samtools fixmate -@ ${params.threads} - - | samtools rmdup -S - ${sample}_dedup.bam
samtools sort -n -@ ${params.threads} -m 1G ${input_bam} -o - | samtools fixmate -@ ${params.threads} - - | samtools rmdup -S - ${sample}_input_dedup.bam
"""
}

Expand All @@ -143,12 +143,12 @@ process CreateBigwig {

script:
"""
samtools sort -t ${params.threads} -m ${params.mem}G ${final_bam} -o ${sample}_output_final_sorted.bam
samtools sort -@ ${params.threads} -m ${params.mem}G ${final_bam} -o ${sample}_output_final_sorted.bam
samtools index ${sample}_output_final_sorted.bam
bamCoverage -b ${sample}_output_final_sorted.bam -o ${sample}_output.bigWig -p ${params.threads}
samtools sort -t ${params.threads} -m ${params.mem}G ${input_final_bam} -o ${sample}_input_output_final_sorted.bam
bamCoverage -p ${params.threads} -b ${sample}_output_final_sorted.bam -o ${sample}_output.bigWig -p ${params.threads}
samtools sort -@ ${params.threads} -m ${params.mem}G ${input_final_bam} -o ${sample}_input_output_final_sorted.bam
samtools index ${sample}_input_output_final_sorted.bam
bamCoverage -b ${sample}_input_output_final_sorted.bam -o ${sample}_input_output.bigWig -p ${params.threads}
bamCoverage -p ${params.threads} -b ${sample}_input_output_final_sorted.bam -o ${sample}_input_output.bigWig -p ${params.threads}
"""
}

Expand Down

0 comments on commit 8c3f12d

Please sign in to comment.