This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Search A Dna Sequence Motif In Bam File?

I need to find a short DNA sequence motif from a BAM file, because the wet biologist found a potential mutation from Sanger sequencing. I need to double check if this finding is also present in the RNA-Seq reads aligned to human hg19 reference genome (in a BAM). Is there any way to do this effectively?

I tried to use IGV and used the motif search (in Tools menu), but have no luck locating the sequenc (15 bp long). Any other approaches available?

Thanks

motif dna bam

1 answer

You can pull out the reads matching your motif using perl or grep, just remember to do in both directions:

samtools view *file.bam* | grep *motif* > sequences.sam
samtools view *file.bam* | grep *reverse_complement_motif* >> sequences.sam

But it's better if your wet-biologist gives you the expected coordinates, the you can extract the reads mapped to that location or view in IGV or other browser.

samtools view *file.bam* chr:start-end

thanks JC. If they could tell me the coordinates, I would be able to just view it in IGV :)

Log in to answer this question.