I think OP only want the sequence from the BAM, not the REF.
Reconstruct reference sequence from SAM file?
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!
• 1,523 views
•
link
1 answer
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
• 0 views
•
link
• 0 views
•
link
I am looking for the sequence in the reference that the query aligned to
• 0 views
•
link
Log in to answer this question.