Extracting specific regions from bam file as FASTA format
0
0
Entering edit mode
2.5 years ago
zbidav ▴ 30

Hello, first time asking, so sorry in advance for beginner's mistakes. I have an indexed bam file, and I want to extract the FASTA format of all the reads that appear within the defined region (or partially appear)

for example:

samtools view file.bam chr4:100-150

However, this command is returning the whole read that was aligned to this region, and not only the requested region. Until now I parsed manually each read with python/IGV, but it is strange that there is no other much simpler way.

samtools fasta • 561 views
ADD COMMENT
2
Entering edit mode

Reasonably certain @Pierre has written something for this. He may point out the exact tool but in meantime check his javarkit repo.

Also this may help: tool for bam soft clipping reads within bed file regions

ADD REPLY

Login before adding your answer.

Traffic: 2614 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