Hi,
I am trying to detect low level variants (minor allele present at min 10%). I am using several criteria to define such variants.
One of the criteria is to use only reads with a min quality score at the variant position of 20 and a min score of 15 for the 5 flanking bases. It was easy to check the quality at the said position from the pileup format.
Does anyone have an easy solution to check quality of the flanking bases? Is it possible from the pileup format? Does a tool exist that will filter reads from bam with such a condition?
Thanks in advance for your help!
1 answer
I don't have the time to code this but I would use the picard API: Open a bam:
SAMFileReader sf=new SAMFileReader(bamfile);
sf.setValidationStringency(SAMFileReader.ValidationStringency.LENIENT);
create an iterator scanning a region overlaping the SNP:
IntervalList iL=new IntervalList(sf.getFileHeader());
iL.add(interval);
SamLocusIterator sli=new SamLocusIterator(sf,iL,true);
loop over the iterator. Get the reads overlapping the SNPs:
SamLocusIterator sli=new SamLocusIterator(sf,iL,true);
sli.setMappingQualityScoreCutoff(this.minQual);
for(Iterator<SamLocusIterator.LocusInfo> iter=sli.iterator();
iter.hasNext();
)
{
SamLocusIterator.LocusInfo locusInfo=iter.next();
int position=locusInfo.getPosition();
for(SamLocusIterator.RecordAndOffset aro: locusinfo.getRecordAndPositions())
{
/* implement the logic here .... record the quality for each base/samRecord/position*/
}
}
sf.close();
Log in to answer this question.