How to annotate a bam file?
1
0
Entering edit mode
3.4 years ago
Assa Yeroslaviz ★ 1.8k

Hi,

I'm looking for a method/tool for annotating a bam file.

After running the mapping with STAR, I have filtered my bam file for specific reads, I am interested in. I would now like to assign a gene (nearest gene) or any other genomic structure, if possible to each of the reads.

Best case scenario, I would like to get as an output a table of the reads and the annotation as a table.

Is there something like that out there?

thanks

bam annotations • 1.8k views
ADD COMMENT
0
Entering edit mode

output a table of the reads

You can complement @ATPoint's solution by pulling reads out with samtools view region.

ADD REPLY
3
Entering edit mode
3.4 years ago
ATpoint 81k

You can transform the BAM to BED with bamtobed from bedtools and then use bedtools closest to get the closest match for that newly generated BED file, given that the annotation file you have is in a compatible format, e.g. GTF or BED itself.

ADD COMMENT
0
Entering edit mode

thanks, does closest also works with a gtf file?

ADD REPLY
1
Entering edit mode

Not sure, many bedtools commanfs do, check the manual. Alternatively load things into R and use the intersection/nearest functions from GenomicRanges.

ADD REPLY

Login before adding your answer.

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