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


Java TreeTool类代码示例

本文整理汇总了Java中pal.tree.TreeTool的典型用法代码示例。如果您正苦于以下问题:Java TreeTool类的具体用法?Java TreeTool怎么用?Java TreeTool使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


TreeTool类属于pal.tree包,在下文中一共展示了TreeTool类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: reroot

import pal.tree.TreeTool; //导入依赖的package包/类
public void reroot(String filename, String outfile) throws Exception {
    // Reroot the tree on "seq_1" - the first sequence in the original FASTA file must be the outgroup
    // We need to set this so that ancestral reconstruction is done correctly in PAML
    Tree tree = TreeTool.readTree(new FileReader(filename));
    Tree rerootedTree = TreeManipulator.getRootedBy(tree, new String[]{Constants.OUTGROUP_SEQUENCE_NAME});
    PrintWriter pw = new PrintWriter(new FileWriter(outfile));
    TreeUtils.printNH(rerootedTree, pw);
    pw.close();
}
 
开发者ID:baezortega,项目名称:mutree,代码行数:10,代码来源:TreeRerooter.java

示例2: getTrees

import pal.tree.TreeTool; //导入依赖的package包/类
private Tree[] getTrees(String file) throws Exception {
    Tree[] trees = new Tree[2];

    BufferedReader reader = Files.newReader(new File(file), Charsets.US_ASCII);

    while (!reader.readLine().startsWith("Ancestral reconstruction by")) { /* empty */ }

    String line;

    // skip all lines until we read the first tree
    while (!(line = reader.readLine()).startsWith("(")) { /* empty */ }

    // this is the true tree - use this to get the true branch lengths
    trees[0] = TreeTool.readTree(new StringReader(line));

    // skip all lines until we have read two more trees
    for (int i = 0; i < 2; i++) while (!(line = reader.readLine()).startsWith("(")) { /* empty */ }

    // this third tree is tree with the branches labeled - use this to get node/branch names
    trees[1] = TreeTool.readTree(new StringReader(line));

    reader.close();

    return trees;
}
 
开发者ID:baezortega,项目名称:mutree,代码行数:26,代码来源:ParseRST.java

示例3: getTrees_RAxML

import pal.tree.TreeTool; //导入依赖的package包/类
private Tree[] getTrees_RAxML(String file1, String file2) throws Exception {
    Tree[] trees = new Tree[2];

    // 1. Read original ROOTED RAxML tree
    // This is the true tree - use this to get the true branch lengths
    BufferedReader reader = Files.newReader(new File(file1), Charsets.US_ASCII);
    
    String line = reader.readLine();
    trees[0] = TreeTool.readTree(new StringReader(line));
    
    reader.close();
    
    
    // 2. Read node-labelled RAxML tree
    // This is the tree with the nodes labeled - use this to get ancestral node names
    reader = Files.newReader(new File(file2), Charsets.US_ASCII);
    
    line = reader.readLine();
    trees[1] = TreeTool.readTree(new StringReader(line));
    
    reader.close();

    return trees;
}
 
开发者ID:baezortega,项目名称:mutree,代码行数:25,代码来源:ParseRST.java


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