All Downloads are FREE. Search and download functionalities are using the official Maven repository.

lphy.base.function.tree.MigrationCount Maven / Gradle / Ivy

Go to download

The standard library of LPhy, which contains the required generative distributions and basic functions.

The newest version!
package lphy.base.function.tree;

import lphy.base.evolution.coalescent.StructuredCoalescent;
import lphy.base.evolution.tree.TimeTree;
import lphy.core.model.DeterministicFunction;
import lphy.core.model.Value;
import lphy.core.model.annotation.GeneratorCategory;
import lphy.core.model.annotation.GeneratorInfo;
import lphy.core.model.annotation.ParameterInfo;
import lphy.core.model.datatype.IntegerValue;

public class MigrationCount extends DeterministicFunction {

    public static final String treeParamName = "tree";

    public MigrationCount(@ParameterInfo(name = treeParamName, description = "the tree.") Value x) {
        setParam(treeParamName, x);
    }

    @GeneratorInfo(name="countMigrations",
            category = GeneratorCategory.TREE, examples = {"simpleStructuredCoalescent.lphy"},
            description = "The number of single-child nodes in the tree where the '" +
                    StructuredCoalescent.populationLabel + "' attribute changes.")
    public Value apply() {
        Value v = (Value)getParams().get(treeParamName);
        return new IntegerValue(StructuredCoalescent.countMigrations(v.value()), this);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy