-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20 from karl616/optimizeContigProcessing
Decreasing disk stress and processing time of the contig step by repl…
- Loading branch information
Showing
5 changed files
with
50 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,16 @@ | ||
#!/bin/bash -eu | ||
samtools view -h -@ ${cpus} ${bam} | \ | ||
awk 'BEGIN {OFS="\\t"} {if (\$1!~/^@/) {\$2=xor(\$2,0x10)}; print}' | \ | ||
samtools view -@ ${cpus} -Sb - > tmp.bam | ||
|
||
bamtools filter -tag NH:1 -in tmp.bam -out tmp_unique.bam && rm tmp.bam | ||
genomeCoverageBed -strand + -split -bg -ibam tmp_unique.bam > ${prefix}.plusRaw.bedgraph | ||
genomeCoverageBed -strand - -split -bg -ibam tmp_unique.bam > ${prefix}.minusRaw.bedgraph | ||
rm tmp_unique.bam | ||
samtools view -h -@ ${cpus} ${bam} \ | ||
| awk 'BEGIN {OFS="\\t"} {if (\$1!~/^@/) {\$2=xor(\$2,0x10)}; print}' \ | ||
| samtools view -Sbu - \ | ||
| tee >( | ||
genomeCoverageBed -strand + -split -bg -ibam - \ | ||
> ${prefix}.contigs.plusRaw.bedgraph | ||
) \ | ||
| genomeCoverageBed -strand - -split -bg -ibam - \ | ||
> ${prefix}.contigs.minusRaw.bedgraph | ||
|
||
contigsNew.py --chrFile ${genomeFai} \ | ||
--fileP ${prefix}.plusRaw.bedgraph \ | ||
--fileM ${prefix}.minusRaw.bedgraph \ | ||
--sortOut \ | ||
> ${prefix}.bed | ||
> ${prefix}.bed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,20 @@ | ||
#!/bin/bash -eu | ||
samtools view -h -@ ${cpus} ${bam} | \ | ||
awk 'BEGIN {OFS="\\t"} {if (\$1!~/^@/ && and(\$2,128)>0) {\$2=xor(\$2,0x10)}; print}' | \ | ||
samtools view -@ ${cpus} -Sb - > tmp.bam | ||
|
||
bamtools filter -tag NH:1 -in tmp.bam -out tmp_unique.bam && rm tmp.bam | ||
genomeCoverageBed -strand + -split -bg -ibam tmp_unique.bam > ${prefix}.plusRaw.bedgraph | ||
genomeCoverageBed -strand - -split -bg -ibam tmp_unique.bam > ${prefix}.minusRaw.bedgraph | ||
rm tmp_unique.bam | ||
samtools view -h -@ ${cpus} ${bam} \ | ||
| awk ' | ||
BEGIN {OFS="\\t"} | ||
{if (\$1!~/^@/ && and(\$2,128)>0) {\$2=xor(\$2,0x10)}; print} | ||
' \ | ||
| samtools view -Sbu - \ | ||
| bamtools filter -tag NH:1 \ | ||
| tee >( | ||
genomeCoverageBed -strand + -split -bg -ibam - \ | ||
> ${prefix}.plusRaw.bedgraph | ||
) \ | ||
| genomeCoverageBed -strand - -split -bg -ibam - \ | ||
> ${prefix}.minusRaw.bedgraph | ||
|
||
contigsNew.py --chrFile ${genomeFai} \ | ||
--fileP ${prefix}.plusRaw.bedgraph \ | ||
--fileM ${prefix}.minusRaw.bedgraph \ | ||
--sortOut \ | ||
> ${prefix}.bed | ||
> ${prefix}.bed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
#!/bin/bash -eu | ||
bamtools filter -tag NH:1 -in ${bam} -out tmp_unique.bam | ||
bamToBed -i tmp_unique.bam | sort -T. -k1,1 -k2,2n | mergeBed > ${prefix}.bed | ||
rm tmp_unique.bam | ||
bamtools filter -tag NH:1 -in ${bam} \ | ||
| bamToBed -i - \ | ||
| sort -T. -k1,1 -k2,2n \ | ||
| mergeBed \ | ||
> ${prefix}.bed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,14 @@ | ||
#!/bin/bash -eu | ||
bamtools filter -tag NH:1 -in ${bam} -out tmp_unique.bam | ||
genomeCoverageBed -strand + -split -bg -ibam tmp_unique.bam > ${prefix}.plusRaw.bedgraph | ||
genomeCoverageBed -strand - -split -bg -ibam tmp_unique.bam > ${prefix}.minusRaw.bedgraph | ||
rm tmp_unique.bam | ||
bamtools filter -tag NH:1 -in ${bam} \ | ||
| tee >( | ||
genomeCoverageBed -strand + -split -bg -ibam - \ | ||
> ${prefix}.plusRaw.bedgraph | ||
) \ | ||
| genomeCoverageBed -strand - -split -bg -ibam - \ | ||
> ${prefix}.minusRaw.bedgraph | ||
|
||
contigsNew.py --chrFile ${genomeFai} \ | ||
--fileP ${prefix}.plusRaw.bedgraph \ | ||
--fileM ${prefix}.minusRaw.bedgraph \ | ||
--sortOut \ | ||
> ${prefix}.bed | ||
> ${prefix}.bed |