Snp Calling - Filter Reads According To Quality Of 5 Flanking Bases
1
1
Entering edit mode
11.5 years ago
bob ▴ 10

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!

variant snp • 2.5k views
ADD COMMENT
5
Entering edit mode
11.5 years ago

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();
ADD COMMENT

Login before adding your answer.

Traffic: 2543 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6