当前位置: 首页>>代码示例>>Java>>正文


Java Node.getMetaData方法代码示例

本文整理汇总了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());
	}
}
 
开发者ID:lutrasdebtra,项目名称:Beast-Borrowing-Plugin,代码行数:20,代码来源:BeastBorrowingPluginTest.java

示例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());
		}

	}
}
 
开发者ID:lutrasdebtra,项目名称:Beast-Borrowing-Plugin,代码行数:17,代码来源:BeastBorrowingPluginTest.java

示例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");
}
 
开发者ID:lutrasdebtra,项目名称:Beast-Borrowing-Plugin,代码行数:22,代码来源:BeastBorrowingPluginTest.java

示例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");
}
 
开发者ID:lutrasdebtra,项目名称:Beast-Borrowing-Plugin,代码行数:19,代码来源:BeastBorrowingPluginTest.java

示例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);
    }
}
 
开发者ID:CompEvol,项目名称:beastshell,代码行数:23,代码来源:TreeComponent.java

示例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;
}
 
开发者ID:CompEvol,项目名称:beastshell,代码行数:19,代码来源:TreeComponent.java

示例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, "");
	}
}
 
开发者ID:lutrasdebtra,项目名称:Beast-Borrowing-Plugin,代码行数:8,代码来源:LanguageSubsitutionModel.java

示例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());
	}
}
 
开发者ID:lutrasdebtra,项目名称:Beast-Borrowing-Plugin,代码行数:14,代码来源:BeastBorrowingPluginTest.java

示例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());
	}
}
 
开发者ID:lutrasdebtra,项目名称:Beast-Borrowing-Plugin,代码行数:14,代码来源:BeastBorrowingPluginTest.java

示例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);
    }
}
 
开发者ID:CompEvol,项目名称:beastshell,代码行数:10,代码来源:UnrootedTreeDrawing.java

示例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;
	}		
}
 
开发者ID:CompEvol,项目名称:beast2,代码行数:30,代码来源:TreeAnnotator.java

示例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);
    }
}
 
开发者ID:CompEvol,项目名称:beast2,代码行数:38,代码来源:CladeSystem.java

示例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);
        }
    }
 
开发者ID:CompEvol,项目名称:beastshell,代码行数:48,代码来源:UnrootedTreeDrawing.java

示例14: getCanonicalNodeX

import beast.evolution.tree.Node; //导入方法依赖的package包/类
private double getCanonicalNodeX(Node node) {
    return (Double) node.getMetaData("p");
}
 
开发者ID:CompEvol,项目名称:beastshell,代码行数:4,代码来源:TreeComponent.java

示例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));
    }
 
开发者ID:CompEvol,项目名称:beastshell,代码行数:8,代码来源:UnrootedTreeDrawing.java


注:本文中的beast.evolution.tree.Node.getMetaData方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。