Skip to content

Commit

Permalink
Updating code with latest master branch version and (hopefully) resol…
Browse files Browse the repository at this point in the history
…ved conflicts.
  • Loading branch information
mandevgill committed Aug 19, 2024
1 parent be9cb63 commit 95d319f
Show file tree
Hide file tree
Showing 38 changed files with 7,716 additions and 159 deletions.
13 changes: 12 additions & 1 deletion src/dr/app/beast/development_parsers.properties
Original file line number Diff line number Diff line change
Expand Up @@ -424,4 +424,15 @@ dr.evoxml.ReportSitePatternMapParser
dr.inferencexml.loggers.TimeLoggerXMLParser

# Attempt
dr.inferencexml.distribution.WeightsParser
dr.inferencexml.distribution.WeightsParser

#Partition Models
dr.evomodelxml.treedatalikelihood.DataSquashingOperatorParser
dr.evomodelxml.treedatalikelihood.HDPDataSquashingOperatorParser
dr.evomodelxml.treedatalikelihood.DirichletProcessPolyaUrnParser
dr.evomodelxml.treedatalikelihood.HMMPolyaUrnParser
dr.evomodelxml.treedatalikelihood.HDPPolyaUrnParser
dr.evomodel.treedatalikelihood.HDPDrawsFromCommonBaseOperator
dr.evomodel.treedatalikelihood.HDPStickPropsOperator
dr.evomodel.treedatalikelihood.BaseDistPrecisionGibbsOperator
dr.inferencexml.distribution.DirichletDistributionModelParser
2 changes: 2 additions & 0 deletions src/dr/evolution/alignment/PatternList.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ public interface PatternList extends TaxonList, Identifiable {
*/
int[] getPattern(int patternIndex);

int getPatternIndex(int siteIndex);

/**
* Gets the pattern as an array of state frequency vectors (one per sequence)
*
Expand Down
5 changes: 5 additions & 0 deletions src/dr/evolution/alignment/Patterns.java
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,11 @@ public int[] getPattern(int patternIndex) {
return patterns[patternIndex];
}

public int getPatternIndex(int siteIndex){
// Not implemented yet
return -1;
}

@Override
public double[][] getUncertainPattern(int patternIndex) {
throw new UnsupportedOperationException("uncertain patterns not implemented yet");
Expand Down
4 changes: 4 additions & 0 deletions src/dr/evolution/alignment/ResamplePatterns.java
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,10 @@ public double[] getPatternWeights() {
return weights;
}

public int getPatternIndex(int siteIndex){
// Not implemented yet
return -1;
}
/**
* @return the DataType of this siteList
*/
Expand Down
4 changes: 4 additions & 0 deletions src/dr/evolution/alignment/TaxaFilteredSitePatterns.java
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,10 @@ public double[] getPatternWeights() {

}

public int getPatternIndex(int siteIndex){
// Not implemented yet
return -1;
}
@Override
public DataType getDataType() {
return original.getDataType();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,9 @@

import dr.evolution.tree.NodeRef;
import dr.evolution.tree.Tree;
import dr.evomodel.treedatalikelihood.DataLikelihoodDelegate;
import dr.evomodel.treedatalikelihood.RateRescalingScheme;
import dr.evomodel.treedatalikelihood.TreeDataLikelihood;
import dr.evomodel.treedatalikelihood.TreeTraversal;
import dr.evomodel.treedatalikelihood.*;
import dr.evomodel.treedatalikelihood.TreeTraversal.TraversalType;
import dr.evomodel.treelikelihood.PartialsRescalingScheme;
import dr.inference.model.AbstractModel;
import dr.inference.model.Model;
import dr.inference.model.Variable;
Expand Down Expand Up @@ -222,6 +220,15 @@ public void setComputePostOrderStatisticsOnly(boolean computePostOrderStatistics
@Override
public boolean providesPostOrderStatisticsOnly() { return false; }

public int getPartitionCat(){
// not meaningful right now, need to update
return 0;
};

public double[] getSiteLogLikelihoods(){
throw new RuntimeException("getSiteLogLikelihoods() not implemented");
}

@Override
protected void handleModelChangedEvent(Model model, Object object, int index) { // substitution model here
// TODO Auto-generated method stub
Expand All @@ -239,6 +246,26 @@ protected void acceptState() {
// nada
}

public PreOrderSettings getPreOrderSettings() {
return null;
}

@Override
public boolean getPreferGPU() {
return true;
}

public boolean getUseAmbiguities() {
return true;
}

public PartialsRescalingScheme getRescalingScheme() {
return null;
}

public boolean getDelayRescalingUntilUnderflow() {
return true;
}
// get the mutation map
protected MutationBranchMap getMutationMap() {
return mutationMap;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,26 +107,55 @@ protected void adoptValues(Parameter source) {
}

public double getParameterValue(int index) {

// int whichCategoryIndex = index % dim; // TODO Maybe?
// int whichDimIndex = index - whichCategoryIndex * dim; // TODO Maybe?
// Parameter param = uniquelyRealizedParameters.getParameter((int) categoriesParameter.getParameterValue(whichCategoryIndex));
// return param.getParameterValue(whichDimIndex);
int whichCategoryIndex = categoriesParameter.getValue(index).intValue();//
int whichDimIndex = 0;
Parameter param = uniquelyRealizedParameters.getParameter(whichCategoryIndex);
return param.getParameterValue(whichDimIndex);
// return param.getParameterValue(whichDimIndex);

int whichCategoryIndex = categoriesParameter.getValue(index).intValue();//
int whichDimIndex = 0;

Parameter param = uniquelyRealizedParameters.getParameter(whichCategoryIndex);

return param.getParameterValue(whichDimIndex);
}//END: getParameterValue

public void setParameterValue(int dim, double value) {
public double[] getAllParameterValues(int index) {

int whichCategoryIndex = categoriesParameter.getValue(index).intValue();//

Parameter param = uniquelyRealizedParameters.getParameter(whichCategoryIndex);
double[] returnVal = new double[param.getSize()];

for(int i = 0; i < param.getSize(); i++){
returnVal[i] = param.getParameterValue(i);
}

return returnVal;
}

public void setParameterValue(int dim, double value) {

int whichCategoryIndex = (int) categoriesParameter.getParameterValue(dim);
uniquelyRealizedParameters.setParameterValue(whichCategoryIndex, value);

}//END: setParameterValue

int whichCategoryIndex = (int) categoriesParameter.getParameterValue(dim);
uniquelyRealizedParameters.setParameterValue(whichCategoryIndex, value);
public void setParameterValue(int dim, double[] value) {

int whichCategoryIndex = (int) categoriesParameter.getParameterValue(dim);

if(uniquelyRealizedParameters.getParameter(whichCategoryIndex).getSize() != value.length){
throw new RuntimeException("parameter and array with parameter values must have same dimension");
}

for(int i = 0; i < value.length; i++){
uniquelyRealizedParameters.getParameter(whichCategoryIndex).setParameterValue(i,value[i]);
}
//uniquelyRealizedParameters.setParameterValue(whichCategoryIndex, value);

}//END: setParameterValue
}//END: setParameterValue

public void setParameterValueQuietly(int dim, double value) {
throw new RuntimeException("Not implemented");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,9 @@ public double logPdf(Object x) {
return distribution.logPdf(x);
}

public int getDimension(){
return dim;
}
// *****************************************************************
// Interface DensityModel
// *****************************************************************
Expand Down
4 changes: 4 additions & 0 deletions src/dr/evomodel/epidemiology/casetocase/CategoryOutbreak.java
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,10 @@ private void buildDistanceMatrix(){
}
}

public int getPatternIndex(int siteIndex){
// Not implemented yet
return -1;
}
protected void handleModelChangedEvent(Model model, Object object, int index) {
if(!(model instanceof AbstractPeriodPriorDistribution)) {
fireModelChanged(object);
Expand Down
4 changes: 4 additions & 0 deletions src/dr/evomodel/tree/HiddenLinkageModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,10 @@ public double[] getPatternWeights() {
return data.getAlignment().getPatternWeights();
}

public int getPatternIndex(int siteIndex){
// Not implemented yet
return -1;
}
public int getStateCount() {
return data.getAlignment().getStateCount();
}
Expand Down
Loading

0 comments on commit 95d319f

Please sign in to comment.