Class CoalescentIntervals

java.lang.Object
pal.coalescent.CoalescentIntervals
All Implemented Interfaces:
Serializable, Report, Units

public class CoalescentIntervals extends Object implements Units, Report, 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:
  • Field Details

    • 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:
    • 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:
    • 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:
  • Constructor Details

    • CoalescentIntervals

      public CoalescentIntervals()
      Parameterless constructor.
    • CoalescentIntervals

      public CoalescentIntervals(int size)
      Constructor taking a number of intervals.
  • Method Details

    • 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 invalid input: '<'= 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 (invalid input: '<'= 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 String toString()
      Overrides:
      toString in class Object
    • report

      public void report(PrintWriter out)
      Description copied from interface: Report
      print human readable report (e.g., on parameters and associated model)
      Specified by:
      report in interface Report
      Parameters:
      out - output stream