Any other solution by using samtools?
Hi Everyone,
I am trying to list the tags within my BAM file using following command:
samtools view input.bam | cut -f 12- | tr '\t' '\n' | cut -d ':' -f 1 | awk '{ if(!x[$1]++) { print }}'
But it's taking so long for larger BAMs to output the tag names. I have more than 30 BAMs for different WGS samples. Is there any way to optimize my command-line to run it faster?
I have cluster available and we use PBS as job scheduler software.
I want my command to run fast. please help!
Thanks!
2 answers
I/O is generally not able to be parallelized; unless you're using an SSD, your hard drive can only read in data so fast due to mechanical limitations in the hardware. Sambamba achieves speed-ups over Samtools by optimizing caching methods, but it is still I/O bound.
Any other solution? by using samtools?
You just want to list the different possible tag names? Like this: A: RGID mismatch after using MergeBamAlignment
If so, you can do this in SeQC pretty quick. The reading of a single BAM file is not parallelized, but processing multiple BAMs at once is (because disk IO is always the bottleneck here).
Log in to answer this question.
for i in *.bam ; do echo "samtools view $i | cut -f 12- | tr '\t' '\n' | cut -d ':' -f 1 | awk '{ if(!x[$1]++) { print }} > $i.out'" | qsub ; done ;