Question: Visualize reads in BAM file
1
gravatar for Prakki Rama
5.9 years ago by
Prakki Rama2.4k
Singapore
Prakki Rama2.4k wrote:

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.

 

bam visualize genome • 1.7k views
ADD COMMENTlink modified 5.9 years ago by Ming Tang2.6k • written 5.9 years ago by Prakki Rama2.4k

Check http://bioinf.scri.ac.uk/tablet/help/bam-data-visualization.shtml as well as http://bamview.sourceforge.net/

ADD REPLYlink modified 7 months ago by RamRS27k • written 5.9 years ago by ancient_learner620

Thank you for the link. I tried the tablet, but it does not have an option of visualizing reads that I wanted.

ADD REPLYlink written 5.9 years ago by Prakki Rama2.4k
3
gravatar for dariober
5.9 years ago by
dariober11k
WCIP | Glasgow | UK
dariober11k wrote:

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.

ADD COMMENTlink modified 5.9 years ago • written 5.9 years ago by dariober11k

Fantastic. This is what I exactly wanted. Thank you very much!

ADD REPLYlink written 5.9 years ago by Prakki Rama2.4k

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?

ADD REPLYlink written 5.9 years ago by Prakki Rama2.4k
0
gravatar for Ming Tang
5.9 years ago by
Ming Tang2.6k
Houston/MD Anderson Cancer Center
Ming Tang2.6k wrote:

How about this pybamview http://melissagymrek.com/pybamview/

ADD COMMENTlink written 5.9 years ago by Ming Tang2.6k

Hi, thank you for the tool. But, the above script from dariober was catering my need more closely. Thanks.

ADD REPLYlink written 5.9 years ago by Prakki Rama2.4k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1462 users visited in the last hour