public class IntervalList extends Object implements Iterable<Interval>
Modifier and Type | Field | Description |
---|---|---|
static String |
INTERVAL_LIST_FILE_EXTENSION |
Constructor | Description |
---|---|
IntervalList(SAMFileHeader header) |
Constructs a new interval list using the supplied header information.
|
IntervalList(SAMSequenceDictionary dict) |
Constructs a new interval list using the supplied header information.
|
Modifier and Type | Method | Description |
---|---|---|
void |
add(Interval interval) |
Adds an interval to the list of intervals.
|
void |
addall(Collection<Interval> intervals) |
Adds a Collection of intervals to the list of intervals.
|
static List<Interval> |
breakIntervalsAtBandMultiples(List<Interval> intervals,
int bandMultiple) |
Given a list of Intervals and a band multiple, this method will return a list of Intervals such that all of the intervals
do not straddle integer multiples of that band.
|
static IntervalList |
concatenate(Collection<IntervalList> lists) |
A utility function for merging a list of IntervalLists, checks for equal dictionaries.
|
static IntervalList |
copyOf(IntervalList list) |
creates a independent copy of the given IntervalList
|
static IntervalList |
difference(Collection<IntervalList> lists1,
Collection<IntervalList> lists2) |
A utility function for finding the difference between two IntervalLists.
|
boolean |
equals(Object o) |
|
static IntervalList |
fromFile(File file) |
Parses an interval list from a file.
|
static IntervalList |
fromFiles(Collection<File> intervalListFiles) |
Calls
fromFile(java.io.File) on the provided files, and returns their union(java.util.Collection) . |
static IntervalList |
fromName(SAMFileHeader header,
String sequenceName) |
Creates an IntervalList from the given sequence name
|
static IntervalList |
fromPath(Path path) |
Parses an interval list from a path.
|
static IntervalList |
fromReader(BufferedReader in) |
Parses an interval list from a reader in a stream based fashion.
|
long |
getBaseCount() |
Gets the (potentially redundant) sum of the length of the intervals in the list.
|
SAMFileHeader |
getHeader() |
Gets the header (if there is one) for the interval list.
|
List<Interval> |
getIntervals() |
Gets the set of intervals as held internally.
|
long |
getUniqueBaseCount() |
Gets the count of unique bases represented by the intervals in the list.
|
List<Interval> |
getUniqueIntervals() |
Deprecated.
use {@link #uniqued()#getIntervals()} instead.
|
List<Interval> |
getUniqueIntervals(boolean concatenateNames) |
Deprecated.
use {@link #uniqued(boolean)#getIntervals()} or
getUniqueIntervals(IntervalList, boolean) instead. |
static List<Interval> |
getUniqueIntervals(IntervalList list,
boolean concatenateNames) |
Merges list of intervals and reduces them like htsjdk.samtools.util.IntervalList#getUniqueIntervals()
|
static List<Interval> |
getUniqueIntervals(IntervalList list,
boolean concatenateNames,
boolean enforceSameStrands) |
Merges list of intervals and reduces them like htsjdk.samtools.util.IntervalList#getUniqueIntervals()
|
int |
hashCode() |
|
static IntervalList |
intersection(IntervalList list1,
IntervalList list2) |
A utility function for generating the intersection of two IntervalLists, checks for equal dictionaries.
|
static IntervalList |
intersection(Collection<IntervalList> lists) |
A utility function for intersecting a list of IntervalLists, checks for equal dictionaries.
|
static IntervalList |
invert(IntervalList list) |
inverts an IntervalList and returns one that has exactly all the bases in the dictionary that the original one does not.
|
Iterator<Interval> |
iterator() |
Returns an iterator over the intervals.
|
static IntervalList |
overlaps(IntervalList lhs,
IntervalList rhs) |
A utility function for finding the intervals in the first list that have at least 1bp overlap with any interval
in the second list.
|
static IntervalList |
overlaps(Collection<IntervalList> lists1,
Collection<IntervalList> lists2) |
A utility function for finding the intervals in the first list that have at least 1bp overlap with any interval
in the second list.
|
IntervalList |
padded(int padding) |
Returns a new IntervalList where each interval is padded by 'padding' bases on each side.
|
IntervalList |
padded(int before,
int after) |
Returns a new IntervalList where each interval is padded by the specified amount of bases.
|
int |
size() |
Returns the count of intervals in the list.
|
void |
sort() |
Deprecated.
use
sorted() instead. |
IntervalList |
sorted() |
returns an independent sorted IntervalList
|
static IntervalList |
subtract(IntervalList lhs,
IntervalList rhs) |
A utility function for subtracting a single IntervalList from another.
|
static IntervalList |
subtract(Collection<IntervalList> lhs,
Collection<IntervalList> rhs) |
A utility function for subtracting a collection of IntervalLists from another.
|
static IntervalList |
union(IntervalList list1,
IntervalList list2) |
|
static IntervalList |
union(Collection<IntervalList> lists) |
A utility function for finding the union of a list of IntervalLists, checks for equal dictionaries.
|
void |
unique() |
Deprecated.
use
uniqued() instead. |
void |
unique(boolean concatenateNames) |
Deprecated.
use
uniqued(boolean) instead. |
IntervalList |
uniqued() |
Returned an independent IntervalList that is sorted and uniquified.
|
IntervalList |
uniqued(boolean concatenateNames) |
Returned an independent IntervalList that is sorted and uniquified.
|
void |
write(File file) |
Writes out the list of intervals to the supplied file.
|
forEach, spliterator
public static final String INTERVAL_LIST_FILE_EXTENSION
public IntervalList(SAMFileHeader header)
public IntervalList(SAMSequenceDictionary dict)
public SAMFileHeader getHeader()
public void add(Interval interval)
public void addall(Collection<Interval> intervals)
@Deprecated public void sort()
sorted()
instead.public IntervalList padded(int before, int after)
public IntervalList padded(int padding)
public IntervalList sorted()
public IntervalList uniqued()
public IntervalList uniqued(boolean concatenateNames)
concatenateNames
- If false, interval names are not concatenated when merging intervals to save space.@Deprecated public void unique()
uniqued()
instead.@Deprecated public void unique(boolean concatenateNames)
uniqued(boolean)
instead.concatenateNames
- If false, interval names are not concatenated when merging intervals to save space.@Deprecated public List<Interval> getUniqueIntervals()
public static List<Interval> getUniqueIntervals(IntervalList list, boolean concatenateNames)
concatenateNames
- If false, the merged interval has the name of the earlier interval. This keeps name shorter.public static List<Interval> getUniqueIntervals(IntervalList list, boolean concatenateNames, boolean enforceSameStrands)
concatenateNames
- If false, the merged interval has the name of the earlier interval. This keeps name shorter.enforceSameStrands
- enforce that merged intervals have the same strand, otherwise ignore.@Deprecated public List<Interval> getUniqueIntervals(boolean concatenateNames)
getUniqueIntervals(IntervalList, boolean)
instead.getUniqueIntervals()
.
Note: this function modifies the object in-place and is therefore difficult to work with.concatenateNames
- If false, the merged interval has the name of the earlier interval. This keeps name shorter.public static List<Interval> breakIntervalsAtBandMultiples(List<Interval> intervals, int bandMultiple)
intervals
- A list of IntervalbandMultiple
- integer value (> 0) to break up intervals in the list at integer multiples ofpublic long getBaseCount()
public long getUniqueBaseCount()
public int size()
public static IntervalList copyOf(IntervalList list)
list
- public static IntervalList fromFile(File file)
file
- the file containing the intervalspublic static IntervalList fromPath(Path path)
path
- the path containing the intervalspublic static IntervalList fromName(SAMFileHeader header, String sequenceName)
header
- header to use to create IntervalListsequenceName
- name of sequence in headerpublic static IntervalList fromFiles(Collection<File> intervalListFiles)
fromFile(java.io.File)
on the provided files, and returns their union(java.util.Collection)
.public static IntervalList fromReader(BufferedReader in)
in
- a BufferedReader that can be read frompublic void write(File file)
file
- a file to write to. If exists it will be overwritten.public static IntervalList intersection(IntervalList list1, IntervalList list2)
list1
- the first IntervalListlist2
- the second IntervalListpublic static IntervalList intersection(Collection<IntervalList> lists)
lists
- the list of IntervalListpublic static IntervalList concatenate(Collection<IntervalList> lists)
lists
- a list of IntervalListpublic static IntervalList union(Collection<IntervalList> lists)
lists
- the list of IntervalListpublic static IntervalList union(IntervalList list1, IntervalList list2)
public static IntervalList invert(IntervalList list)
list
- an IntervalListpublic static IntervalList subtract(Collection<IntervalList> lhs, Collection<IntervalList> rhs)
lhs
- the collection of IntervalList from which to subtract intervalsrhs
- the collection of intervals to subtractpublic static IntervalList subtract(IntervalList lhs, IntervalList rhs)
lhs
- the IntervalList from which to subtract intervalsrhs
- the IntervalList to subtractpublic static IntervalList difference(Collection<IntervalList> lists1, Collection<IntervalList> lists2)
lists1
- the first collection of IntervalListslists2
- the second collection of IntervalListspublic static IntervalList overlaps(IntervalList lhs, IntervalList rhs)
lhs
- the first collection of IntervalListslhs
- the second collection of IntervalListspublic static IntervalList overlaps(Collection<IntervalList> lists1, Collection<IntervalList> lists2)
lists1
- the first collection of IntervalListslists2
- the second collection of IntervalLists