public class GenomeLoc extends java.lang.Object implements java.lang.Comparable<GenomeLoc>, java.io.Serializable, HasGenomeLocation, htsjdk.samtools.util.Locatable
Modifier and Type | Field and Description |
---|---|
protected int |
contigIndex
the basic components of a genome loc, its contig index,
start and stop position, and (optionally) the contig name
|
protected java.lang.String |
contigName |
protected int |
start |
protected int |
stop |
static GenomeLoc |
UNMAPPED
A static constant to use when referring to the unmapped section of a datafile
file.
|
static GenomeLoc |
WHOLE_GENOME |
Modifier | Constructor and Description |
---|---|
protected |
GenomeLoc(java.lang.String contig,
int contigIndex,
int start,
int stop) |
Modifier and Type | Method and Description |
---|---|
int |
compareContigs(GenomeLoc that)
conpare this genomeLoc's contig to another genome loc
|
int |
compareTo(GenomeLoc that) |
boolean |
containsP(GenomeLoc that) |
boolean |
contiguousP(GenomeLoc that) |
boolean |
discontinuousP(GenomeLoc that) |
boolean |
disjointP(GenomeLoc that) |
int |
distance(GenomeLoc that) |
long |
distanceAcrossContigs(GenomeLoc other,
htsjdk.samtools.SAMFileHeader samFileHeader)
Calculates the distance between two genomeLocs across contigs (if necessary).
|
GenomeLoc |
endpointSpan(GenomeLoc that)
Returns a new GenomeLoc that represents the region between the endpoints of this and that.
|
boolean |
equals(java.lang.Object other)
Check to see whether two genomeLocs are equal.
|
java.lang.String |
getContig() |
int |
getContigIndex() |
int |
getEnd() |
GenomeLoc |
getLocation() |
int |
getStart() |
GenomeLoc |
getStartLocation() |
int |
getStop() |
GenomeLoc |
getStopLocation() |
int |
hashCode() |
GenomeLoc |
intersect(GenomeLoc that) |
boolean |
isBefore(GenomeLoc that)
Tests whether this contig is completely before contig 'that'.
|
boolean |
isBetween(GenomeLoc left,
GenomeLoc right) |
boolean |
isPast(GenomeLoc that)
Tests whether this contig is completely after contig 'that'.
|
boolean |
isUnmapped()
Return true if this GenomeLoc represents the UNMAPPED location
|
static boolean |
isUnmapped(GenomeLoc loc) |
GenomeLoc |
max(GenomeLoc other)
Returns the maximum GenomeLoc of this and other
|
GenomeLoc |
merge(GenomeLoc that)
Returns a new GenomeLoc that represents the entire span of this and that.
|
static <T extends GenomeLoc> |
merge(java.util.SortedSet<T> sortedLocs)
Merges a list of *sorted* *contiguous* locs into 1
|
static <T extends GenomeLoc> |
merge(T a,
T b)
Merges 2 *contiguous* locs into 1
|
int |
minDistance(GenomeLoc that)
Return the minimum distance between any pair of bases in this and that GenomeLocs:
|
boolean |
onSameContig(GenomeLoc that) |
boolean |
overlapsP(GenomeLoc that) |
double |
reciprocialOverlapFraction(GenomeLoc o)
reciprocialOverlap: what is the min.
|
static GenomeLoc |
setStart(GenomeLoc loc,
int start)
create a new genome loc from an existing loc, with a new start position
Note that this function will NOT explicitly check the ending offset, in case someone wants to
set the start of a new GenomeLoc pertaining to a read that goes off the end of the contig.
|
static GenomeLoc |
setStop(GenomeLoc loc,
int stop)
create a new genome loc from an existing loc, with a new stop position
Note that this function will NOT explicitly check the ending offset, in case someone wants to
set the stop of a new GenomeLoc pertaining to a read that goes off the end of the contig.
|
int |
size()
How many BPs are covered by this locus?
|
GenomeLoc[] |
split(int splitPoint)
Splits the contig into to regions: [start,split point) and [split point, end].
|
java.util.List<GenomeLoc> |
subtract(GenomeLoc that) |
java.lang.String |
toString() |
GenomeLoc |
union(GenomeLoc that) |
protected final int contigIndex
protected final int start
protected final int stop
protected final java.lang.String contigName
public static final GenomeLoc UNMAPPED
public static final GenomeLoc WHOLE_GENOME
protected GenomeLoc(java.lang.String contig, int contigIndex, int start, int stop)
public static final boolean isUnmapped(GenomeLoc loc)
public final GenomeLoc getLocation()
getLocation
in interface HasGenomeLocation
public final GenomeLoc getStartLocation()
public final GenomeLoc getStopLocation()
public final java.lang.String getContig()
getContig
in interface htsjdk.samtools.util.Locatable
public final int getContigIndex()
public final int getStart()
getStart
in interface htsjdk.samtools.util.Locatable
public int getEnd()
getEnd
in interface htsjdk.samtools.util.Locatable
public final int getStop()
public final java.lang.String toString()
toString
in class java.lang.Object
public final boolean disjointP(GenomeLoc that)
public final boolean discontinuousP(GenomeLoc that)
public final boolean overlapsP(GenomeLoc that)
public final boolean contiguousP(GenomeLoc that)
public final boolean isUnmapped()
public GenomeLoc merge(GenomeLoc that) throws GATKException
GATKException
public GenomeLoc[] split(int splitPoint)
splitPoint
- The point at which to split the contig. Must be contained in the given interval.public GenomeLoc intersect(GenomeLoc that) throws GATKException
GATKException
public final boolean containsP(GenomeLoc that)
public final boolean onSameContig(GenomeLoc that)
public final int distance(GenomeLoc that)
public final boolean isBefore(GenomeLoc that)
that
- Contig to test against.public final boolean isPast(GenomeLoc that)
that
- Contig to test against.public final int minDistance(GenomeLoc that)
public boolean equals(java.lang.Object other)
equals
in class java.lang.Object
other
- Other contig to compare.public int hashCode()
hashCode
in class java.lang.Object
public final int compareContigs(GenomeLoc that)
that
- the genome loc to compare contigs withpublic int compareTo(GenomeLoc that)
compareTo
in interface java.lang.Comparable<GenomeLoc>
public int size()
public final double reciprocialOverlapFraction(GenomeLoc o)
public GenomeLoc max(GenomeLoc other)
other
- another non-null genome locpublic static <T extends GenomeLoc> GenomeLoc merge(T a, T b)
a
- GenomeLoc #1b
- GenomeLoc #2public static <T extends GenomeLoc> GenomeLoc merge(java.util.SortedSet<T> sortedLocs)
sortedLocs
- a sorted list of contiguous locspublic long distanceAcrossContigs(GenomeLoc other, htsjdk.samtools.SAMFileHeader samFileHeader)
other
- the genome loc to compare tosamFileHeader
- the contig informationpublic static GenomeLoc setStart(GenomeLoc loc, int start)
loc
- the old locationstart
- a new start positionpublic static GenomeLoc setStop(GenomeLoc loc, int stop)
loc
- the old locationstop
- a new stop position