This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Filter reads by SNP by genotype

I am trying to filter files by the specific genotype at a specific SNP. Example: I want all the reads with a "T" in position chr1:181188090. Everything I've seen so far is looking at the quality of the reads, but that's already been addressed.

This can't be that difficult, clearly I'm missing something, but I don't know what. Any help would be greatly appreciated.

filter genotype snp

I have a bam file that has all the reads that overlap the interval in question, the part I can't figure out is how to filter for only the reads that have a T at that position.

To elaborate: I'm looking at a maternal plasma sample, and am trying to isolate the fetal fraction. I have SNPs where I know what the genotype is, and the fetus has one allele different from the mother. I'm trying to isolate the fetal reads, to then determine the read length.

The filtration examples I've seen have been for quality or some other metric, I'm struggling to find a way to get a stream of nucleotides from that one position to filter.

1 answer

How about @Pierre's solution here: How to extract reads with a known variant form a bam file

This looks great! I will try that. Thank you very much!

Log in to answer this question.