Package pal.coalescent
Class CoalescentIntervals
- java.lang.Object
-
- pal.coalescent.CoalescentIntervals
-
public class CoalescentIntervals extends java.lang.Object implements Units, Report, java.io.Serializable
A series of coalescent intervals representing the time order information contained in a (serial) clock-constrained tree. Can model both n-coalescents and s-coalescents.- Version:
- $Id: CoalescentIntervals.java,v 1.14 2001/08/04 19:57:31 alexi Exp $
- Author:
- Alexei Drummond, Korbinian Strimmer
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static int
COALESCENT
Denotes and interval after which a coalescent event is observed (i.e.static int
NEW_SAMPLE
Denotes an interval at the end of which a new sample addition is observed (i.e.static int
NOTHING
Denotes an interval at the end of which nothing is observed (i.e.-
Fields inherited from interface pal.misc.Units
DAYS, EXPECTED_SUBSTITUTIONS, GENERATIONS, MONTHS, SAMPLE, SHORT_UNIT_NAMES, UNIT_NAMES, UNKNOWN, YEARS
-
-
Constructor Summary
Constructors Constructor Description CoalescentIntervals()
Parameterless constructor.CoalescentIntervals(int size)
Constructor taking a number of intervals.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double
computeLogLikelihood(DemographicModel model)
Returns the log likelihood of this set of coalescent intervals, given a demographic model.int
getCoalescentEvents(int i)
Returns the number coalescent events in an intervaldouble
getInterval(int i)
Gets an interval.int
getIntervalCount()
get number of intervalsint
getIntervalType(int i)
Returns the type of interval observed.int
getNumLineages(int i)
Returns the number of uncoalesced lineages within this interval.void
getSmallIntervals(double minSize, boolean[] smallInterval)
Returns a list stating which of the intervals are <= minSize (and thus should be pooled).double
getTotalHeight()
get the total height of the genealogy represented by these intervals.int
getUnits()
Returns the units these coalescent intervals are measured in.void
groupIntervals(CoalescentIntervals reference)
Group intervals following a given (compatible) reference.boolean
isBinaryCoalescent()
Checks whether this set of coalescent intervals is fully resolved (i.e.boolean
isCoalescentOnly()
Checks whether this set of coalescent intervals coalescent only (i.e.void
poolIntervals(boolean[] smallInterval)
Starting at time zero (i.e.void
poolSmallIntervals(double minSize)
Starting at time zero (i.e.void
report(java.io.PrintWriter out)
print human readable report (e.g., on parameters and associated model)void
setInterval(int i, double value)
Sets interval.void
setNumLineages(int i, int numLines)
set the number lineages for this particular interval.void
setUnits(int u)
Sets the units these coalescent intervals are measured in.java.lang.String
toString()
-
-
-
Field Detail
-
COALESCENT
public static final int COALESCENT
Denotes and interval after which a coalescent event is observed (i.e. the number of lineages is smaller in the next interval)- See Also:
- Constant Field Values
-
NEW_SAMPLE
public static final int NEW_SAMPLE
Denotes an interval at the end of which a new sample addition is observed (i.e. the number of lineages is larger in the next interval).- See Also:
- Constant Field Values
-
NOTHING
public static final int NOTHING
Denotes an interval at the end of which nothing is observed (i.e. the number of lineages is the same in the next interval).- See Also:
- Constant Field Values
-
-
Method Detail
-
setUnits
public void setUnits(int u)
Sets the units these coalescent intervals are measured in.
-
getUnits
public int getUnits()
Returns the units these coalescent intervals are measured in.
-
getNumLineages
public int getNumLineages(int i)
Returns the number of uncoalesced lineages within this interval. Required for s-coalescents, where new lineages are added as earlier samples are come across.
-
setNumLineages
public void setNumLineages(int i, int numLines)
set the number lineages for this particular interval.
-
getCoalescentEvents
public int getCoalescentEvents(int i)
Returns the number coalescent events in an interval
-
getIntervalType
public int getIntervalType(int i)
Returns the type of interval observed.
-
getInterval
public double getInterval(int i)
Gets an interval.
-
setInterval
public void setInterval(int i, double value)
Sets interval.
-
getTotalHeight
public double getTotalHeight()
get the total height of the genealogy represented by these intervals.
-
getIntervalCount
public int getIntervalCount()
get number of intervals
-
isBinaryCoalescent
public boolean isBinaryCoalescent()
Checks whether this set of coalescent intervals is fully resolved (i.e. whether is has exactly one coalescent event in each subsequent interval)
-
isCoalescentOnly
public boolean isCoalescentOnly()
Checks whether this set of coalescent intervals coalescent only (i.e. whether is has exactly one or more coalescent event in each subsequent interval)
-
groupIntervals
public void groupIntervals(CoalescentIntervals reference)
Group intervals following a given (compatible) reference. The reference must have the same number of lineages at the start of the first interval, and the present CoalsecentIntervals must be fully resolved.
-
getSmallIntervals
public void getSmallIntervals(double minSize, boolean[] smallInterval)
Returns a list stating which of the intervals are <= minSize (and thus should be pooled).
-
poolIntervals
public void poolIntervals(boolean[] smallInterval)
Starting at time zero (i.e. with the interval with largest number of lineages), the specified small intervals are pooled with the next non-small interval (if this does not exist then with the previous non-small interval)
-
poolSmallIntervals
public void poolSmallIntervals(double minSize)
Starting at time zero (i.e. with the interval with largest number of lineages), small intervals (<= minSize) are pooled with the next non-small interval (if this does not exist then with the previous non-small interval)
-
computeLogLikelihood
public double computeLogLikelihood(DemographicModel model)
Returns the log likelihood of this set of coalescent intervals, given a demographic model.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-