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:
parent
3330666780
commit
babb9fb825
|
|
@ -17,12 +17,32 @@ public class ClusteredSnps {
|
||||||
|
|
||||||
FiltrationContext[] variants = contextWindow.getWindow(snpThreshold-1, snpThreshold-1);
|
FiltrationContext[] variants = contextWindow.getWindow(snpThreshold-1, snpThreshold-1);
|
||||||
for (int i = 0; i < snpThreshold; i++) {
|
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 )
|
if ( variants[i] == null || variants[i+snpThreshold-1] == null )
|
||||||
continue;
|
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 left = variants[i].getVariantContext().getLocation();
|
||||||
GenomeLoc right = variants[i+snpThreshold-1].getVariantContext().getLocation();
|
GenomeLoc right = null;
|
||||||
if ( left.getContigIndex() == right.getContigIndex() &&
|
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 )
|
Math.abs(right.getStart() - left.getStart()) <= window )
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue