Fantastic. This is what I exactly wanted. Thank you very much!
Dear Biostars,
Could I please know, If there is some way to view the reads in BAM file according to user defined Insert Size range. I would like to visualize all the reads falling between certain Insert Size ranges, not all the reads.
Your ideas and resources would help me a lot. Thanks in advance.
~Prakki Rama.
2 answers
This is a hack but it might be good enough? Parse the input bam to extract alignments within a given *template* size range, here between 0 and 200:
samtools view -h read.pe.bam \ | awk '{if (($0 ~ /^@/) || (sqrt($9^2) > 0 && sqrt($9^2) < 200)) {print $0}}' \ | samtools view -Sb - > insert.bam &&samtools index insert.bam
Now load insert.bam in your favourite browser.
But every time, we need to run the above script to see what reads mapped for different ranges in different files. Do you have any idea of any tool that by just typing in the insert size range, it will display those reads and automatically remaining reads become greyed or made invisible?
Log in to answer this question.
Check http://bioinf.scri.ac.uk/tablet/help/bam-data-visualization.shtml as well as http://bamview.sourceforge.net/
Thank you for the link. I tried the tablet, but it does not have an option of visualizing reads that I wanted.