Reconstruct reference sequence from SAM file?
1
0
Entering edit mode
4.6 years ago
eholleman • 0

I am aligning a consensus sequence to a reference genome using Bowtie2 and I am interested in the nucleotide sequence of the reference where the consensus sequence aligned. Is it possible to infer the reference sequence using only information in the SAM file such as the CIGAR and MD strings? Thanks!

SAM • 947 views
ADD COMMENT
1
Entering edit mode
4.6 years ago

Based on your alignment you can get the chromosome, start and end of where your consensus sequence aligns. You can use these coordinates with samtools faidx

samtools faidx yourgenome.fa chr1:123456-789101
ADD COMMENT
0
Entering edit mode

I think OP only want the sequence from the BAM, not the REF.

ADD REPLY
0
Entering edit mode

I am looking for the sequence in the reference that the query aligned to

ADD REPLY
0
Entering edit mode

Thank you, this is what I am looking for. Would this be faster than building an indexed BLAST database and then using blastdbcmd to accomplish the same task?

ADD REPLY
0
Entering edit mode

Yes I would assume so

ADD REPLY

Login before adding your answer.

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