public class TimeOrderCharacterData extends java.lang.Object implements java.io.Serializable, BranchLimits, UnitsProvider, IdGroup
IdGroup.Utils
Modifier and Type | Field and Description |
---|---|
protected pal.misc.TimeOrderCharacterData.SubgroupHandler[] |
subgroups_ |
protected IdGroup |
taxa
the identifier group
|
protected int[] |
timeOrdinals
Order of times
|
protected double[] |
times
Actual times of each sample
|
protected int |
units |
ABSTOL, DEFAULT_LENGTH, FRACDIGITS, MAXARC, MINARC
DAYS, EXPECTED_SUBSTITUTIONS, GENERATIONS, MONTHS, SAMPLE, SHORT_UNIT_NAMES, UNIT_NAMES, UNKNOWN, YEARS
Modifier | Constructor and Description |
---|---|
protected |
TimeOrderCharacterData()
Parameterless constructor for superclasses.
|
|
TimeOrderCharacterData(IdGroup taxa,
int units)
Constructor taking only IdGroup.
|
|
TimeOrderCharacterData(IdGroup taxa,
int units,
boolean contemp)
Constructor taking only IdGroup.
|
|
TimeOrderCharacterData(int numSeqsPerSample,
int numSamples,
double timeBetweenSamples,
int units)
Constructs a TimeOrderCharacterData with a number of
equal-sized, evenly-spaced sampling times.
|
Modifier and Type | Method and Description |
---|---|
static TimeOrderCharacterData |
clone(TimeOrderCharacterData tocd)
Returns a clone of the specified TimeOrderCharacterData
|
TimeOrderCharacterData |
createSubgroup(int subgroupNumber)
Creates a TimeOrderCharacterData which is a subset of this sub group.
|
TimeOrderCharacterData |
generateDummyTimedTOCD(double[] sampleRates) |
TimeOrderCharacterData |
generateExpectedSubsitutionsTimedTOCD(double[] sampleRates)
Given an array of rates between samples (matching exactly the samples in order) then
produces a TimeOrderCharacterData object that is timed by Expected Substitutions.
|
double[] |
getCopyOfTimes()
Returns a copy of the times in the form of an array.
|
double |
getHeight(int taxon,
double rate)
NOTE: currently assumes times exist!
|
int |
getIdCount()
Returns the number of identifiers in this group
|
Identifier |
getIdentifier(int i)
Returns the ith identifier.
|
IdGroup |
getIdGroup()
Deprecated.
TimeOrderCharacterData now implements IdGroup
|
double |
getMaximumTime() |
double |
getMinimumTime() |
java.lang.String |
getName()
Returns a name for this character data.
|
int |
getNumberOfSubgroups() |
int |
getNumChars()
Returns the number of characters per identifier
|
int |
getOrdinalCount() |
int[] |
getOrdinals()
Gets ordinals.
|
double |
getOrdinalTime(int ordinal)
Obtain the time of a particular ordinal
|
TimeOrderCharacterData |
getReordered(IdGroup base)
Creates a new TimeOrderCharacterData object with the same properites as this one
but the identifier positions match that of base (ie whichIdNumber(Name) returns the same as for base)
|
int |
getSampleCount()
Deprecated.
Use getOrdinalCount()
|
Identifier[] |
getSubgroupMembers(int subgroupNumber) |
double |
getSuggestedMaximumMutationRate()
A simple utility method for generating a maximu mutation rate based
on times.
|
double |
getTime(int taxon) |
double |
getTime(java.lang.String taxonName) |
int |
getTimeOrdinal(Identifier taxonName) |
int |
getTimeOrdinal(int taxon) |
int |
getTimeOrdinal(java.lang.String taxonName) |
double[] |
getUniqueTimeArray()
Returns an ordered vector of unique times in this
time order character data.
|
double[][] |
getUniqueTimeMatrix()
Returns a matrix of times between samples.
|
int |
getUnits() |
boolean |
hasSubgroups() |
boolean |
hasTimes() |
void |
removeTimes()
Remove time character data.
|
TimeOrderCharacterData |
scale(double rate,
int newUnits) |
void |
setIdentifier(int i,
Identifier ident)
Sets the ith identifier.
|
void |
setName(java.lang.String name)
Sets the name of this character data.
|
void |
setOrdinals(int[] ordinals)
Sets ordinals.
|
void |
setOrdinals(TimeOrderCharacterData tocd)
Set time ordinals from another TimeOrderCharacterData.
|
void |
setOrdinals(TimeOrderCharacterData tocd,
IdGroup standard,
boolean doTimes)
Set time ordinals from another TimeOrderCharacterData.
|
void |
setSubgroup(int[] subgroup)
A means for define a subgroup.
|
void |
setSubgroup(java.lang.String[] subgroup)
A means for define a subgroup.
|
void |
setSubgroups(int[][] subgroups)
A means for define a subgroup.
|
void |
setSubgroups(java.lang.String[][] subgroups)
A means for define subgroups.
|
void |
setTimes(double[] times,
int units)
Sets the times, and works out what the ordinals should be.
|
void |
setTimes(double[] times,
int units,
boolean recalculateOrdinals)
Sets the times.
|
void |
setTimesAndOrdinals(TimeOrderCharacterData tocd) |
void |
shuffleTimes() |
TimeOrderCharacterData |
subset(IdGroup staxa)
Extracts a subset of a TimeOrderCharacterData.
|
java.lang.String |
toString()
Returns a string representation of this time order character data.
|
int |
whichIdNumber(java.lang.String name)
returns the index of the identifier with the given name.
|
protected int[] timeOrdinals
protected double[] times
protected IdGroup taxa
protected int units
protected pal.misc.TimeOrderCharacterData.SubgroupHandler[] subgroups_
protected TimeOrderCharacterData()
public TimeOrderCharacterData(IdGroup taxa, int units)
taxa
- the taxa that this time data relates to.units
- the units of the times.public TimeOrderCharacterData(IdGroup taxa, int units, boolean contemp)
taxa
- the taxa that this time data relates to.units
- the units of the times.contemp
- if true, all times are set to zero, else
times are not set.public TimeOrderCharacterData(int numSeqsPerSample, int numSamples, double timeBetweenSamples, int units)
numSeqsPerSample
- the number of taxa/sequences per sample time.numSamples
- the number of sample times.timeBetweenSamples
- the time between each pair of consecutive samples.units
- the units in which the times are expressed.public static TimeOrderCharacterData clone(TimeOrderCharacterData tocd)
public TimeOrderCharacterData subset(IdGroup staxa)
public int getUnits()
getUnits
in interface UnitsProvider
public final void setSubgroups(int[][] subgroups)
subgroups
- an array of integer arrays. Each array holds the indexes
of the members that for that subgrouppublic final void setSubgroup(int[] subgroup)
subgroups
- an array indexes
of the members that for the subgrouppublic final void setSubgroup(java.lang.String[] subgroup)
subgroups
- an array of names that represent the members of the subgroup.Non existent memebers are ignoredpublic final void setSubgroups(java.lang.String[][] subgroups)
subgroups
- an array of String arrays. Each array holds the members
for a particular subgroup. Nonexistent members are ignored.public final boolean hasSubgroups()
public final int getNumberOfSubgroups()
public final TimeOrderCharacterData createSubgroup(int subgroupNumber)
public final Identifier[] getSubgroupMembers(int subgroupNumber)
public void setTimes(double[] times, int units)
public void setTimes(double[] times, int units, boolean recalculateOrdinals)
recalculateOrdinals
- true if ordinals should be
recalculated from the times.public TimeOrderCharacterData scale(double rate, int newUnits)
public void setOrdinals(int[] ordinals)
public double getMaximumTime()
public double getMinimumTime()
public int[] getOrdinals()
public double[] getCopyOfTimes()
public TimeOrderCharacterData getReordered(IdGroup base)
java.lang.IllegalArgumentException
- if the base ids don't match the ids of this tocdpublic void removeTimes()
public TimeOrderCharacterData generateExpectedSubsitutionsTimedTOCD(double[] sampleRates)
public TimeOrderCharacterData generateDummyTimedTOCD(double[] sampleRates)
public void setOrdinals(TimeOrderCharacterData tocd)
tocd
- to take ordinals from.public void setTimesAndOrdinals(TimeOrderCharacterData tocd)
public void setOrdinals(TimeOrderCharacterData tocd, IdGroup standard, boolean doTimes)
tocd
- to take ordinals fromidgroup
- use these labels to match indices in given tocd.doTimes
- if set then sets times as wellpublic int getNumChars()
public java.lang.String getName()
public void setName(java.lang.String name)
public double getTime(int taxon)
public double getOrdinalTime(int ordinal)
ordinal
- The ordinal of interestjava.lang.IllegalArgumentException
- If no such ordinalpublic double getTime(java.lang.String taxonName)
public double getHeight(int taxon, double rate)
public int getTimeOrdinal(int taxon)
public int getTimeOrdinal(java.lang.String taxonName)
public int getTimeOrdinal(Identifier taxonName)
public boolean hasTimes()
public double[] getUniqueTimeArray()
public double[][] getUniqueTimeMatrix()
public int getSampleCount()
public int getOrdinalCount()
public java.lang.String toString()
toString
in class java.lang.Object
public void shuffleTimes()
public Identifier getIdentifier(int i)
IdGroup
getIdentifier
in interface IdGroup
public void setIdentifier(int i, Identifier ident)
IdGroup
setIdentifier
in interface IdGroup
public int getIdCount()
IdGroup
getIdCount
in interface IdGroup
public int whichIdNumber(java.lang.String name)
IdGroup
whichIdNumber
in interface IdGroup
public IdGroup getIdGroup()
public final double getSuggestedMaximumMutationRate()