I am trying to find a way to display the presence of a single mismatch at position chr7:17375390 on the reverse strand of an overlapping read in a bam file using only samtools. I sliced the section of the chromosome, and I can see that there is a C aligning to T in the reference at this position in IGV. But when I use samtools view and look at the cigar files, it only says 55M for this read (no information about the mismatch). I realize that M stands for matches and mismatches but how can I get around this. I think I might need to make a BED file and pass it to this bam file with -L and look directly at the sequences of this position but can't seem to get this to work.
$ samtools view -L bedfile.bed -h subset2.bam > out.sam
This seems to have correctly made the bed file, there is a blue line under my region of interest in IGV, the coverage says 34 and :
$ samtools view -c out.sam
34
So now I can look at just the sections of the reads that are in this region: How do I line these up and visualize single mismatch that I am seeing in IGV?
THANK YOU!
Now I just need to learn how to interpret a vcf file!
In recent versions, mpileup has been moved from samtools to bcftools, and you don't need the grep, you can use
-r
:The resulting file is a pileup file, not a vcf file.