Search in sources :

Example 1 with LogColumn

use of dr.inference.loggers.LogColumn in project beast-mcmc by beast-dev.

the class CausalMutationsLogger method getColumns.

/**
     * @return the log columns.
     */
public LogColumn[] getColumns() {
    int numDimension = treeModel.getNodeCount();
    LogColumn[] columns = new LogColumn[numDimension];
    for (int i = 0; i < numDimension; i++) {
        //columns[i] = new StatisticColumn(getDimensionName(i), i);
        String traitName = "" + (i) + ":";
        LinkedList<Integer>[] mutationList = clusterPrior.getMutationList();
        if (mutationList[i] != null) {
            Iterator itr = mutationList[i].iterator();
            int count = 0;
            while (itr.hasNext()) {
                if (count > 0) {
                    traitName += ",";
                }
                int curMutation = ((Integer) itr.next()).intValue();
                traitName += curMutation;
                count++;
            }
        }
        final int curNode = i;
        columns[i] = new LogColumn.Abstract(traitName) {

            @Override
            protected String getFormattedValue() {
                //return "AAA";
                LinkedList<Integer>[] causalList = clusterPrior.getCausalList();
                return parseCausalList(causalList[curNode]);
            }
        };
    }
    return columns;
}
Also used : LogColumn(dr.inference.loggers.LogColumn) Iterator(java.util.Iterator) LinkedList(java.util.LinkedList)

Example 2 with LogColumn

use of dr.inference.loggers.LogColumn in project beast-mcmc by beast-dev.

the class CaseToCaseTransmissionLikelihood method getColumns.

// Not the most elegant solution, but you want two types of log out of this model, one for numerical parameters
// (which Tracer can read) and one for the transmission tree (which it cannot). This is set up so that C2CTransL
// is the numerical log and C2CTreeL the TT one.
public LogColumn[] getColumns() {
    ArrayList<LogColumn> columns = new ArrayList<LogColumn>();
    columns.add(new LogColumn.Abstract("trans_LL") {

        protected String getFormattedValue() {
            return String.valueOf(transLogProb);
        }
    });
    columns.add(new LogColumn.Abstract("period_LL") {

        protected String getFormattedValue() {
            return String.valueOf(periodsLogProb);
        }
    });
    columns.addAll(Arrays.asList(treeLikelihood.passColumns()));
    for (AbstractPeriodPriorDistribution hyperprior : (outbreak).getInfectiousMap().values()) {
        columns.addAll(Arrays.asList(hyperprior.getColumns()));
    }
    columns.add(new LogColumn.Abstract("FirstInfectionTime") {

        protected String getFormattedValue() {
            if (sortedTreeEvents == null) {
                sortEvents();
            }
            return String.valueOf(treeLikelihood.getInfectionTime(indexCase));
        }
    });
    columns.add(new LogColumn.Abstract("IndexCaseIndex") {

        protected String getFormattedValue() {
            return String.valueOf(treeLikelihood.getOutbreak().getCaseIndex(indexCase));
        }
    });
    return columns.toArray(new LogColumn[columns.size()]);
}
Also used : LogColumn(dr.inference.loggers.LogColumn) AbstractPeriodPriorDistribution(dr.evomodel.epidemiology.casetocase.periodpriors.AbstractPeriodPriorDistribution)

Example 3 with LogColumn

use of dr.inference.loggers.LogColumn in project beast-mcmc by beast-dev.

the class OldGLMSubstitutionModel method getColumns.

public LogColumn[] getColumns() {
    //Aggregate columns from ComplexSubstitutionModel with glm.columns
    LogColumn[] aggregated = new LogColumn[glm.getColumns().length + 2];
    int index = 0;
    for (LogColumn col : glm.getColumns()) {
        aggregated[index] = col;
        index++;
    }
    aggregated[index++] = new LikelihoodColumn(getId() + ".L");
    aggregated[index++] = new NormalizationColumn(getId() + ".Norm");
    return aggregated;
//return glm.getColumns();
}
Also used : LogColumn(dr.inference.loggers.LogColumn)

Example 4 with LogColumn

use of dr.inference.loggers.LogColumn in project beast-mcmc by beast-dev.

the class MarkovModulatedSubstitutionModel method getColumns.

public LogColumn[] getColumns() {
    List<LogColumn> columns = new ArrayList<LogColumn>();
    for (LogColumn parentColumn : super.getColumns()) {
        columns.add(parentColumn);
    }
    for (int i = 0; i < numBaseModel; ++i) {
        String label = "rateScalar." + i;
        columns.add(new RateColumn(label, i));
    }
    return columns.toArray(new LogColumn[0]);
}
Also used : LogColumn(dr.inference.loggers.LogColumn) ArrayList(java.util.ArrayList)

Example 5 with LogColumn

use of dr.inference.loggers.LogColumn in project beast-mcmc by beast-dev.

the class GLMSubstitutionModel method getColumns.

// This info can be gotten from the GLM
//    public LogColumn[] getColumns() {
//        return glm.getColumns();
//    }
public LogColumn[] getColumns() {
    //Aggregate columns from ComplexSubstitutionModel with glm.columns
    LogColumn[] aggregated = new LogColumn[glm.getColumns().length + 2];
    int index = 0;
    for (LogColumn col : glm.getColumns()) {
        aggregated[index] = col;
        index++;
    }
    aggregated[index++] = new LikelihoodColumn(getId() + ".L");
    aggregated[index++] = new NormalizationColumn(getId() + ".Norm");
    return aggregated;
//return glm.getColumns();
}
Also used : LogColumn(dr.inference.loggers.LogColumn)

Aggregations

LogColumn (dr.inference.loggers.LogColumn)6 TreeTrait (dr.evolution.tree.TreeTrait)1 AbstractPeriodPriorDistribution (dr.evomodel.epidemiology.casetocase.periodpriors.AbstractPeriodPriorDistribution)1 ArrayList (java.util.ArrayList)1 Iterator (java.util.Iterator)1 LinkedList (java.util.LinkedList)1