public final class GenomeLocSortedSet extends java.util.AbstractSet<GenomeLoc>
Constructor and Description |
---|
GenomeLocSortedSet(GenomeLocParser parser)
Create a new, empty GenomeLocSortedSet
|
GenomeLocSortedSet(GenomeLocParser parser,
java.util.Collection<GenomeLoc> l)
Create a new GenomeLocSortedSet containing locations l
The elements in l can be in any order, and can be overlapping.
|
GenomeLocSortedSet(GenomeLocParser parser,
GenomeLoc e)
Create a new GenomeLocSortedSet containing location e
|
Modifier and Type | Method and Description |
---|---|
boolean |
add(GenomeLoc loc)
Adds a GenomeLoc to the collection, inserting at the correct sorted position into the set.
|
boolean |
add(GenomeLoc loc,
boolean mergeIfIntervalOverlaps)
Adds a GenomeLoc to the collection, inserting at the correct sorted position into the set.
|
boolean |
addRegion(GenomeLoc loc)
Adds a GenomeLoc to the collection, merging it if it overlaps another region.
|
long |
coveredSize()
Return the size, in bp, of the genomic regions by all of the regions in this set
|
static GenomeLocSortedSet |
createSetFromList(GenomeLocParser parser,
java.util.List<GenomeLoc> locs)
Create a sorted genome location set from a list of GenomeLocs.
|
static GenomeLocSortedSet |
createSetFromSequenceDictionary(htsjdk.samtools.SAMSequenceDictionary dict)
create a list of genomic locations, given a reference sequence
|
GenomeLocParser |
getGenomeLocParser()
Gets the GenomeLocParser used to create this sorted set.
|
java.util.List<GenomeLoc> |
getOverlapping(GenomeLoc loc)
Return a list of intervals overlapping loc
|
protected java.util.List<GenomeLoc> |
getOverlappingFullSearch(GenomeLoc loc)
Return a list of intervals overlapping loc by enumerating all locs and testing for overlap
Purely for testing purposes -- this is way to slow for any production code
|
boolean |
isEmpty()
determine if the collection is empty
|
java.util.Iterator<GenomeLoc> |
iterator()
get an iterator over this collection
|
boolean |
overlaps(GenomeLoc loc)
Determine if the given loc overlaps any loc in the sorted set
|
void |
remove(GenomeLoc location)
a simple removal of an interval contained in this list.
|
int |
size()
return the size of the collection
|
long |
sizeBeforeLoc(GenomeLoc loc)
Return the number of bps before loc in the sorted set
|
GenomeLocSortedSet |
subtractRegions(GenomeLocSortedSet toRemoveSet) |
java.util.List<GenomeLoc> |
toList()
convert this object to a list
|
java.lang.String |
toString() |
addAll, clear, contains, containsAll, remove, retainAll, toArray, toArray
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
public GenomeLocSortedSet(GenomeLocParser parser)
parser
- a non-null the parser we use to create genome locspublic GenomeLocSortedSet(GenomeLocParser parser, GenomeLoc e)
parser
- a non-null the parser we use to create genome locse
- a single genome locs to add to this setpublic GenomeLocSortedSet(GenomeLocParser parser, java.util.Collection<GenomeLoc> l)
parser
- a non-null the parser we use to create genome locsl
- a collection of genome locs to add to this setpublic GenomeLocParser getGenomeLocParser()
public java.util.Iterator<GenomeLoc> iterator()
public int size()
public long coveredSize()
public long sizeBeforeLoc(GenomeLoc loc)
loc
- the location before which we are counting basespublic boolean isEmpty()
public boolean overlaps(GenomeLoc loc)
loc
- the location to testpublic java.util.List<GenomeLoc> getOverlapping(GenomeLoc loc)
loc
- the location we want overlapping intervalsprotected java.util.List<GenomeLoc> getOverlappingFullSearch(GenomeLoc loc)
loc
- the location we want overlapping intervalspublic boolean add(GenomeLoc loc)
public boolean addRegion(GenomeLoc loc)
loc
- the GenomeLoc to addpublic boolean add(GenomeLoc loc, boolean mergeIfIntervalOverlaps)
loc
- the GenomeLoc to addmergeIfIntervalOverlaps
- if true we merge the interval if it overlaps another one already in the set, otherwise we throw an exceptionpublic GenomeLocSortedSet subtractRegions(GenomeLocSortedSet toRemoveSet)
public void remove(GenomeLoc location)
location
- the GenomeLoc to removepublic static GenomeLocSortedSet createSetFromSequenceDictionary(htsjdk.samtools.SAMSequenceDictionary dict)
dict
- the sequence dictionary to create a collection frompublic static GenomeLocSortedSet createSetFromList(GenomeLocParser parser, java.util.List<GenomeLoc> locs)
locs
- the listpublic java.util.List<GenomeLoc> toList()
public java.lang.String toString()
toString
in class java.util.AbstractCollection<GenomeLoc>