ant clean is your friend....fixed test code dependent on an interface change.

git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@2660 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
aaron 2010-01-22 20:07:46 +00:00
parent a11503819a
commit 2ea768d902
3 changed files with 18 additions and 10 deletions

View File

@ -571,17 +571,18 @@ class LocusOverflowTracker {
public boolean exceeded(GenomeLoc loc, int pileupSize) { public boolean exceeded(GenomeLoc loc, int pileupSize) {
boolean exceeded = pileupSize >= maxPileupSize; boolean exceeded = pileupSize >= maxPileupSize;
if (exceeded && warningsEmitted <= MAX_WARNINGS) { if (exceeded && warningsEmitted <= MAX_WARNINGS) {
warningInQueue = true;
if (lastLocation == null) lastLocation = loc; if (lastLocation == null) lastLocation = loc;
else if (lastLocation.contiguousP(loc)) else if (lastLocation.contiguousP(loc)) {
lastLocation = lastLocation.merge(loc); lastLocation = lastLocation.merge(loc);
}
else { else {
warnUser(); warnUser();
lastLocation = loc; lastLocation = loc;
} }
warningInQueue = true;
} else if (warningInQueue) { } else if (warningInQueue) {
lastLocation = null;
warnUser(); warnUser();
lastLocation = null;
} }
return exceeded; return exceeded;
} }

View File

@ -82,6 +82,7 @@ public class LocusIteratorByStateTest extends BaseTest {
AlignmentContext context = li.next(); AlignmentContext context = li.next();
//System.err.println(context.getLocation() + " " + context.getPileup().size()); //System.err.println(context.getLocation() + " " + context.getPileup().size());
} }
li.getLocusOverflowTracker().cleanWarningQueue();
Assert.assertEquals(2, ((LocusIteratorOverride) li.getLocusOverflowTracker()).getWarningCount()); Assert.assertEquals(2, ((LocusIteratorOverride) li.getLocusOverflowTracker()).getWarningCount());
} }
} }

View File

@ -3,6 +3,7 @@ package org.broadinstitute.sting.gatk.iterators;
import net.sf.samtools.SAMFileHeader; import net.sf.samtools.SAMFileHeader;
import net.sf.samtools.SAMRecord; import net.sf.samtools.SAMRecord;
import org.broadinstitute.sting.BaseTest; import org.broadinstitute.sting.BaseTest;
import org.broadinstitute.sting.utils.GenomeLoc;
import org.broadinstitute.sting.utils.GenomeLocParser; import org.broadinstitute.sting.utils.GenomeLocParser;
import org.broadinstitute.sting.utils.Utils; import org.broadinstitute.sting.utils.Utils;
import org.broadinstitute.sting.utils.sam.ArtificialSAMUtils; import org.broadinstitute.sting.utils.sam.ArtificialSAMUtils;
@ -40,10 +41,11 @@ public class LocusOverflowTrackerTest extends BaseTest {
@Test @Test
public void testLocusOverflow() { public void testLocusOverflow() {
SAMRecord rec = ArtificialSAMUtils.createArtificialRead(header, "readUno", 0, 1, 100); SAMRecord rec = ArtificialSAMUtils.createArtificialRead(header, "readUno", 0, 1, 100);
if (tracker.exceeded(rec, MAX_READS - 1)) GenomeLoc loc = GenomeLocParser.createGenomeLoc(rec);
if (tracker.exceeded(loc, MAX_READS - 1))
Assert.fail("We shouldn't be exceeded when MAX_READS -1 is the input"); Assert.fail("We shouldn't be exceeded when MAX_READS -1 is the input");
if (!tracker.exceeded(rec, MAX_READS)) Assert.fail("We should be exceeded when MAX_READS is the input"); if (!tracker.exceeded(loc, MAX_READS)) Assert.fail("We should be exceeded when MAX_READS is the input");
if (!tracker.exceeded(rec, MAX_READS + 1)) if (!tracker.exceeded(loc, MAX_READS + 1))
Assert.fail("We shouldn't be exceeded when MAX_READS +1 is the input"); Assert.fail("We shouldn't be exceeded when MAX_READS +1 is the input");
} }
@ -51,7 +53,8 @@ public class LocusOverflowTrackerTest extends BaseTest {
public void testContinuousLocus() { public void testContinuousLocus() {
for (int x = 1; x < 5; x++) { for (int x = 1; x < 5; x++) {
SAMRecord rec = ArtificialSAMUtils.createArtificialRead(header, "readUno", 0, x, 100); SAMRecord rec = ArtificialSAMUtils.createArtificialRead(header, "readUno", 0, x, 100);
tracker.exceeded(rec, MAX_READS + 1); GenomeLoc loc = GenomeLocParser.createGenomeLoc(rec);
tracker.exceeded(loc, MAX_READS + 1);
} }
tracker.cleanWarningQueue(); tracker.cleanWarningQueue();
Assert.assertEquals(1, ((LocusIteratorOverride) tracker).getWarningCount()); Assert.assertEquals(1, ((LocusIteratorOverride) tracker).getWarningCount());
@ -61,11 +64,13 @@ public class LocusOverflowTrackerTest extends BaseTest {
public void testTwoSeperateContinuousLoci() { public void testTwoSeperateContinuousLoci() {
for (int x = 1; x < 5; x++) { for (int x = 1; x < 5; x++) {
SAMRecord rec = ArtificialSAMUtils.createArtificialRead(header, "readUno", 0, x, 2); SAMRecord rec = ArtificialSAMUtils.createArtificialRead(header, "readUno", 0, x, 2);
tracker.exceeded(rec, MAX_READS + 1); GenomeLoc loc = GenomeLocParser.createGenomeLoc(rec);
tracker.exceeded(loc, MAX_READS + 1);
} }
for (int x = 10; x < 15; x++) { for (int x = 10; x < 15; x++) {
SAMRecord rec = ArtificialSAMUtils.createArtificialRead(header, "readUno", 0, x, 2); SAMRecord rec = ArtificialSAMUtils.createArtificialRead(header, "readUno", 0, x, 2);
tracker.exceeded(rec, MAX_READS + 1); GenomeLoc loc = GenomeLocParser.createGenomeLoc(rec);
tracker.exceeded(loc, MAX_READS + 1);
} }
tracker.cleanWarningQueue(); tracker.cleanWarningQueue();
Assert.assertEquals(2, ((LocusIteratorOverride) tracker).getWarningCount()); Assert.assertEquals(2, ((LocusIteratorOverride) tracker).getWarningCount());
@ -76,7 +81,8 @@ public class LocusOverflowTrackerTest extends BaseTest {
public void testOverflow() { public void testOverflow() {
for (int x = 1; x < (LocusOverflowTracker.warningsEmitted * 3); x += 2) { for (int x = 1; x < (LocusOverflowTracker.warningsEmitted * 3); x += 2) {
SAMRecord rec = ArtificialSAMUtils.createArtificialRead(header, "readUno", 0, x, 100); SAMRecord rec = ArtificialSAMUtils.createArtificialRead(header, "readUno", 0, x, 100);
tracker.exceeded(rec, MAX_READS + 1); GenomeLoc loc = GenomeLocParser.createGenomeLoc(rec);
tracker.exceeded(loc, MAX_READS + 1);
} }
tracker.cleanWarningQueue(); tracker.cleanWarningQueue();
Assert.assertEquals(LocusOverflowTracker.warningsEmitted, ((LocusIteratorOverride) tracker).getWarningCount()); Assert.assertEquals(LocusOverflowTracker.warningsEmitted, ((LocusIteratorOverride) tracker).getWarningCount());