本文整理汇总了Java中beast.evolution.tree.Node.getMetaData方法的典型用法代码示例。如果您正苦于以下问题:Java Node.getMetaData方法的具体用法?Java Node.getMetaData怎么用?Java Node.getMetaData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类beast.evolution.tree.Node
的用法示例。
在下文中一共展示了Node.getMetaData方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: TreeSDBorrowingTest
import beast.evolution.tree.Node; //导入方法依赖的package包/类
private static void TreeSDBorrowingTest(String seq) throws Exception {
seq = "";
for (int j = 0; j < 5; j++) {
seq += '1';
}
Sequence l = new Sequence("", seq);
ExplicitBinaryStochasticDollo sd_mod = new ExplicitBinaryStochasticDollo(0.1, 0.2, 0.0, 0.0,
false);
System.out.println("Tree SD Borrowing Test");
Tree tree = randomYuleTree(2, 0.01);
tree.getRoot().setMetaData("lang", l);
sd_mod.mutateOverTreeBorrowing(tree);
for (Node n : tree.getExternalNodes()) {
Sequence l2 = (Sequence) n.getMetaData("lang");
System.out.println(l2.getData());
}
}
示例2: NoEmptyTraitTest
import beast.evolution.tree.Node; //导入方法依赖的package包/类
private static void NoEmptyTraitTest() throws Exception {
for (int i = 0; i < 1; i++) {
System.out.println(i);
Sequence l = new Sequence("", "00000000000001");
Tree tree = randomYuleTree(3, 0.06);
tree.getRoot().setMetaData("lang", l);
ExplicitBinaryStochasticDollo sd_mod = new ExplicitBinaryStochasticDollo(0.0, 0.5, 0.0, 0.0, true);
tree = sd_mod.mutateOverTree(tree);
for (Node n : tree.getExternalNodes()) {
Sequence l2 = (Sequence) n.getMetaData("lang");
System.out.println(l2.getData());
}
}
}
示例3: GTRTreeValidation
import beast.evolution.tree.Node; //导入方法依赖的package包/类
private static void GTRTreeValidation() throws Exception {
ArrayList<Integer> births = new ArrayList<Integer>();
for (int i = 0; i < 10000; i++) {
System.out.println(i);
ExplicitBinaryGTR gtr_mod = new ExplicitBinaryGTR(0.5, 0.0, 0.0, false);
String seq = "";
for (int j = 0; j < 20; j++) {
seq += Integer.toString(Randomizer.nextInt(2));
}
Sequence l = new Sequence("", seq);
Tree tree = randomYuleTree(8, 0.001);
tree.getRoot().setMetaData("lang", l);
tree = gtr_mod.mutateOverTree(tree);
for (Node n : tree.getExternalNodes()) {
Sequence l2 = (Sequence) n.getMetaData("lang");
births.add(LanguageSubsitutionModel.getBirths(l2));
}
}
listToCSV(births, "Utilities/Thesis Graph Generation/gtrtree.csv");
}
示例4: SDTreeValidation
import beast.evolution.tree.Node; //导入方法依赖的package包/类
private static void SDTreeValidation() throws Exception {
ArrayList<Integer> births = new ArrayList<Integer>();
for (int i = 0; i < 10000; i++) {
System.out.println(i);
ExplicitBinaryStochasticDollo sd_mod = new ExplicitBinaryStochasticDollo(0.5, 0.5, 0.0, 0.0, false);
String seq = "";
Sequence l = new Sequence("", seq);
Tree tree = randomYuleTree(8, 0.01);
tree.getRoot().setMetaData("lang", l);
tree = sd_mod.mutateOverTreeBorrowing(tree);
for (Node n : tree.getExternalNodes()) {
Sequence l2 = (Sequence) n.getMetaData("lang");
births.add(LanguageSubsitutionModel.getBirths(l2));
}
}
listToCSV(births, "Utilities/Thesis Graph Generation/sdtree.csv");
}
示例5: setTipValues
import beast.evolution.tree.Node; //导入方法依赖的package包/类
void setTipValues(Node node) {
if (node.isLeaf()) {
node.setMetaData("p", p);
node.setMetaData("p_min", p);
node.setMetaData("p_max", p);
p += getCanonicalNodeSpacing(node.getTree());
} else {
double pmin = Double.MAX_VALUE;
double pmax = Double.MIN_VALUE;
for (Node childNode : node.getChildren()) {
setTipValues(childNode);
double cpmin = (Double) childNode.getMetaData("p_min");
double cpmax = (Double) childNode.getMetaData("p_max");
if (cpmin < pmin) pmin = cpmin;
if (cpmax > pmax) pmax = cpmax;
}
node.setMetaData("p_min", pmin);
node.setMetaData("p_max", pmax);
}
}
示例6: getIntegerTrait
import beast.evolution.tree.Node; //导入方法依赖的package包/类
private int getIntegerTrait(Node childNode, String traitName) {
Object trait = childNode.getMetaData(traitName);
if (trait instanceof Integer) return (Integer) trait;
if (trait instanceof Double) return (int) Math.round((Double) trait);
if (trait instanceof String) return (int) Math.round(Double.parseDouble((String) trait));
if (trait instanceof int[]) {
Location location = new Location((int[]) trait);
if (locationColours.containsKey(location))
return locationColours.get(location);
else {
locationColours.put(location, nextLocationColour);
return nextLocationColour++;
}
}
return -1;
}
示例7: getSequence
import beast.evolution.tree.Node; //导入方法依赖的package包/类
public static Sequence getSequence(Node n) throws Exception {
try {
return (Sequence) n.getMetaData("lang");
} catch (ClassCastException e) {
return new Sequence(n.metaDataString, "");
}
}
示例8: TreeGenTest
import beast.evolution.tree.Node; //导入方法依赖的package包/类
private static void TreeGenTest(String seq) throws Exception {
Sequence l = new Sequence("", seq);
ExplicitBinaryStochasticDollo sd_mod = new ExplicitBinaryStochasticDollo(0.5, 0.5, 0.0, 0.0, false);
System.out.println("Tree generation test");
Tree tree = randomYuleTree(4, 0.6);
tree.getRoot().setMetaData("lang", l);
sd_mod.mutateOverTree(tree);
for (Node n : tree.getExternalNodes()) {
Sequence l2 = (Sequence) n.getMetaData("lang");
System.out.println(l2.getData());
}
}
示例9: TreeGTRBorrowingTest
import beast.evolution.tree.Node; //导入方法依赖的package包/类
private static void TreeGTRBorrowingTest(String seq) throws Exception {
Sequence l = new Sequence("", seq);
ExplicitBinaryGTR gtr_mod = new ExplicitBinaryGTR(0.5, 1.2, 0.0, false);
System.out.println("Tree GTR Borrowing Test");
Tree tree = randomYuleTree(2, 0.01);
tree.getRoot().setMetaData("lang", l);
gtr_mod.mutateOverTreeBorrowing(tree);
for (Node n : tree.getExternalNodes()) {
Sequence l2 = (Sequence) n.getMetaData("lang");
System.out.println(l2.getData());
}
}
示例10: scaleAndTranslatePositions
import beast.evolution.tree.Node; //导入方法依赖的package包/类
private void scaleAndTranslatePositions(Node node, double scale, double tx, double ty) {
Point2D p = (Point2D) node.getMetaData("p");
node.setMetaData("p", new Point2D.Double(p.getX() * scale + tx, p.getY() * scale + ty));
for (Node child : node.getChildren()) {
scaleAndTranslatePositions(child, scale, tx, ty);
}
}
示例11: processMetaData
import beast.evolution.tree.Node; //导入方法依赖的package包/类
private void processMetaData(Node node) {
for (Node child : node.getChildren()) {
processMetaData(child);
}
Set<String> metaDataNames = node.getMetaDataNames();
if (metaDataNames != null && !metaDataNames.isEmpty()) {
String metadata = "";
for (String name : metaDataNames) {
Object value = node.getMetaData(name);
metadata += name + "=";
if (value instanceof Object[]) {
Object [] values = (Object[]) value;
metadata += "{";
for (int i = 0; i < values.length; i++) {
metadata += values[i].toString();
if (i < values.length - 1) {
metadata += ",";
}
}
metadata += "}";
} else {
metadata += value.toString();
}
metadata += ",";
}
metadata = metadata.substring(0, metadata.length() - 1);
node.metaDataString = metadata;
}
}
示例12: collectAttributesForClade
import beast.evolution.tree.Node; //导入方法依赖的package包/类
private void collectAttributesForClade(BitSet bits, Node node, Set<String> attributeNames) {
Clade clade = cladeMap.get(bits);
if (clade != null) {
if (clade.attributeValues == null) {
clade.attributeValues = new ArrayList<>();
}
int i = 0;
Object[] values = new Object[attributeNames.size()];
for (String attributeName : attributeNames) {
Object value;
switch (attributeName) {
case "height":
value = node.getHeight();
break;
case "length":
value = getBranchLength(node);
break;
default:
value = node.getMetaData(attributeName);
if (value instanceof String && ((String) value).startsWith("\"")) {
value = ((String) value).replaceAll("\"", "");
}
break;
}
values[i] = value;
i++;
}
clade.attributeValues.add(values);
clade.setCount(clade.getCount() + 1);
}
}
示例13: setTipValues
import beast.evolution.tree.Node; //导入方法依赖的package包/类
void setTipValues(Node node) {
if (node.isRoot()) {
node.setMetaData("p", new Point2D.Double(0, 0));
node.setMetaData("arc", 2 * Math.PI);
node.setMetaData("direction", -Math.PI / 2.0);
} else {
Node parent = node.getParent();
double direction = (Double) node.getMetaData("direction");
double length = node.getLength();
Point2D parentPoint2D = (Point2D) parent.getMetaData("p");
double x = parentPoint2D.getX() + length * Math.cos(direction);
double y = parentPoint2D.getY() + length * Math.sin(direction);
if (x < minX) minX = x;
if (x > maxX) maxX = x;
if (y < minY) minY = y;
if (y > maxY) maxY = y;
node.setMetaData("p", new Point2D.Double(x, y));
}
double arc = (Double) node.getMetaData("arc");
int leafNodeCount = node.getLeafNodeCount();
double childDirection = (Double) node.getMetaData("direction");
for (Node child : node.getChildren()) {
int childLeafNodeCount = child.getLeafNodeCount();
double childArc = arc * (double) childLeafNodeCount / (double) leafNodeCount;
child.setMetaData("arc", childArc);
child.setMetaData("direction", childDirection - childArc / 2);
childDirection += childArc;
}
for (Node childNode : node.getChildren()) {
setTipValues(childNode);
}
}
示例14: getCanonicalNodeX
import beast.evolution.tree.Node; //导入方法依赖的package包/类
private double getCanonicalNodeX(Node node) {
return (Double) node.getMetaData("p");
}
示例15: drawBranch
import beast.evolution.tree.Node; //导入方法依赖的package包/类
void drawBranch(Node node, Node childNode, Graphics2D g) {
Point2D pp = (Point2D) node.getMetaData("p");
Point2D cp = (Point2D) childNode.getMetaData("p");
g.draw(new Line2D.Double(pp, cp));
}