This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How to extract exon from bam file

Hi,

i have a bam file which is genome data(DNA sequencing). it has 'exonic', 'intergenic' 'intronic' UTR3 ... positions.

However i want to use the tool 'VarScan 2' which is appropriate to exon sequencing.

So, anyone know? how to extract only exon position from Bamfile???

snp genome sequencing sequence

Why wouldn't Varscan 2 be an option for whole genome sequencing? Where did you read that?

You probably shouldn't start extracting positions from your bam file. If you absolutely want to filter you could do that afterwards as well.

Get an annotation file for exons (please use google and the search function, make a bed file out of it and then use the -L option of samtools view).

1 answer

To see reads mapped to specific location:

samtools view file.bam "chr:coordinate1-coordinate2"

To see reads mapped to specific location and save them as bam:

samtools view -b file.bam "chr:coordinate1-coordinate2"  > my_new_bam.bam

Log in to answer this question.