snp cluster filter should ignore ref calls when determining the clusters

git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@3093 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
ebanks 2010-03-29 17:57:33 +00:00
parent 3330666780
commit babb9fb825
1 changed files with 22 additions and 2 deletions

View File

@ -17,12 +17,32 @@ public class ClusteredSnps {
FiltrationContext[] variants = contextWindow.getWindow(snpThreshold-1, snpThreshold-1);
for (int i = 0; i < snpThreshold; i++) {
// ignore positions at the beginning or end of the overall interval (where there aren't enough records)
if ( variants[i] == null || variants[i+snpThreshold-1] == null )
continue;
// note: not all calls are variant, so we need to be careful.
// if we don't start with a variant, skip to the next one
if ( !variants[i].getVariantContext().isVariant() )
continue;
// find the nth variant
GenomeLoc left = variants[i].getVariantContext().getLocation();
GenomeLoc right = variants[i+snpThreshold-1].getVariantContext().getLocation();
if ( left.getContigIndex() == right.getContigIndex() &&
GenomeLoc right = null;
int snpsSeen = 1;
int currentIndex = i;
while ( ++currentIndex < variants.length ) {
if ( variants[currentIndex].getVariantContext().isVariant() ) {
if ( ++snpsSeen == snpThreshold ) {
right = variants[currentIndex].getVariantContext().getLocation();
break;
}
}
}
if ( right != null &&
left.getContigIndex() == right.getContigIndex() &&
Math.abs(right.getStart() - left.getStart()) <= window )
return true;
}