removed the dependence on removeRegion() in GenomeLocSortedSet
git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@2993 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
parent
196bca6819
commit
88a48821ea
|
|
@ -94,7 +94,7 @@ public class IntervalShardStrategy implements ShardStrategy {
|
|||
// get the first region in the list
|
||||
GenomeLoc loc = regions.iterator().next();
|
||||
|
||||
regions.removeRegion(loc);
|
||||
regions.remove(loc);
|
||||
return new IntervalShard(loc,type);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -152,7 +152,7 @@ public abstract class LocusShardStrategy implements ShardStrategy {
|
|||
if (this.intervals == null) {
|
||||
return nonIntervaledNext(length, proposedSize, nextStart);
|
||||
} else {
|
||||
return intervaledNext(proposedSize);
|
||||
return intervaledNext();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -160,11 +160,10 @@ public abstract class LocusShardStrategy implements ShardStrategy {
|
|||
/**
|
||||
* Interval based next processing
|
||||
*
|
||||
* @param proposedSize the proposed size
|
||||
*
|
||||
* @return the shard that represents this data
|
||||
*/
|
||||
private Shard intervaledNext( long proposedSize ) {
|
||||
private Shard intervaledNext() {
|
||||
if ((this.intervals == null) || (intervals.isEmpty())) {
|
||||
throw new StingException("LocusShardStrategy: genomic regions list is empty in next() function.");
|
||||
}
|
||||
|
|
@ -172,14 +171,9 @@ public abstract class LocusShardStrategy implements ShardStrategy {
|
|||
// get the first region in the list
|
||||
GenomeLoc loc = intervals.iterator().next();
|
||||
|
||||
if (loc.getStop() - loc.getStart() <= proposedSize) {
|
||||
intervals.removeRegion(loc);
|
||||
intervals.remove(loc);
|
||||
return new IntervalShard(loc, Shard.ShardType.LOCUS_INTERVAL);
|
||||
} else {
|
||||
GenomeLoc subLoc = GenomeLocParser.createGenomeLoc(loc.getContigIndex(), loc.getStart(), loc.getStart() + proposedSize - 1);
|
||||
intervals.removeRegion(subLoc);
|
||||
return new IntervalShard(subLoc,Shard.ShardType.LOCUS_INTERVAL);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -223,6 +223,15 @@ public class GenomeLocSortedSet extends AbstractSet<GenomeLoc> {
|
|||
return returnValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* a simple removal of an interval contained in this list. The interval must be identical to one in the list (no partial locations or overlapping)
|
||||
* @param location the GenomeLoc to remove
|
||||
*/
|
||||
public void remove(GenomeLoc location) {
|
||||
if (!mArray.contains(location)) throw new IllegalArgumentException("Unable to remove location: " + location + ", not in the list");
|
||||
mArray.remove(location);
|
||||
}
|
||||
|
||||
/**
|
||||
* create a list of genomic locations, given a reference sequence
|
||||
*
|
||||
|
|
|
|||
|
|
@ -113,7 +113,7 @@ public class LinearLocusShardStrategyTest extends BaseTest {
|
|||
Shard d = strat.next();
|
||||
assertTrue(d instanceof LocusShard);
|
||||
assertEquals("Sharding strategy must emit single locus shards",1,d.getGenomeLocs().size());
|
||||
assertTrue((d.getGenomeLocs().get(0).getStop() - d.getGenomeLocs().get(0).getStart()) == 199);
|
||||
assertEquals(199,(d.getGenomeLocs().get(0).getStop() - d.getGenomeLocs().get(0).getStart()));
|
||||
++counter;
|
||||
}
|
||||
assertTrue(counter == 1);
|
||||
|
|
|
|||
Loading…
Reference in New Issue