Visualize reads in BAM file
2
1
Entering edit mode
9.8 years ago
Prakki Rama ★ 2.7k

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.

genome bam visualize • 3.8k views
ADD COMMENT
0
Entering edit mode
ADD REPLY
0
Entering edit mode

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

ADD REPLY
3
Entering edit mode
9.8 years ago

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 COMMENT
0
Entering edit mode

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

ADD REPLY
0
Entering edit mode

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 REPLY
0
Entering edit mode
9.8 years ago
Ming Tommy Tang ★ 3.9k

How about this pybamview

ADD COMMENT
0
Entering edit mode

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

ADD REPLY

Login before adding your answer.

Traffic: 2054 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6