Merge branch 'master' of github.com:broadinstitute/gsa-unstable
This commit is contained in:
commit
03294ae1c8
|
|
@ -287,6 +287,11 @@ public final class GenomeLocParser {
|
|||
return new GenomeLoc(contig, index, start, stop);
|
||||
}
|
||||
|
||||
public GenomeLoc createGenomeLocOnContig(final String contig, final int start, final int stop) {
|
||||
GenomeLoc contigLoc = createOverEntireContig(contig);
|
||||
return new GenomeLoc(contig, getContigIndex(contig), start, stop).intersect(contigLoc);
|
||||
}
|
||||
|
||||
/**
|
||||
* validate a position or interval on the genome as valid
|
||||
*
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ public class ActiveRegion implements HasGenomeLocation {
|
|||
this.isActive = isActive;
|
||||
this.genomeLocParser = genomeLocParser;
|
||||
this.extension = extension;
|
||||
extendedLoc = genomeLocParser.createGenomeLoc(activeRegionLoc.getContig(), activeRegionLoc.getStart() - extension, activeRegionLoc.getStop() + extension);
|
||||
extendedLoc = genomeLocParser.createGenomeLocOnContig(activeRegionLoc.getContig(), activeRegionLoc.getStart() - extension, activeRegionLoc.getStop() + extension);
|
||||
fullExtentReferenceLoc = extendedLoc;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -241,6 +241,21 @@ public class TraverseActiveRegionsUnitTest extends BaseTest {
|
|||
Assert.assertEquals(intervalStops.size(), 0, "Interval stop location does not match an active region stop location");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testActiveRegionExtensionOnContig() {
|
||||
DummyActiveRegionWalker walker = new DummyActiveRegionWalker();
|
||||
|
||||
Collection<ActiveRegion> activeRegions = getActiveRegions(walker, intervals).values();
|
||||
for (ActiveRegion activeRegion : activeRegions) {
|
||||
GenomeLoc loc = activeRegion.getExtendedLoc();
|
||||
|
||||
// Contract: active region extensions must stay on the contig
|
||||
Assert.assertTrue(loc.getStart() > 0, "Active region extension begins at location " + loc.getStart() + ", past the left end of the contig");
|
||||
int refLen = dictionary.getSequence(loc.getContigIndex()).getSequenceLength();
|
||||
Assert.assertTrue(loc.getStop() <= refLen, "Active region extension ends at location " + loc.getStop() + ", past the right end of the contig");
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPrimaryReadMapping() {
|
||||
DummyActiveRegionWalker walker = new DummyActiveRegionWalker();
|
||||
|
|
|
|||
Loading…
Reference in New Issue