简体   繁体   English

使用Java Evolutionary Biology Library(JEBL)分析带有数据的树节点

[英]Annotating tree nodes with data for analysis with the Java Evolutionary Biology Library (JEBL)

I'm using JEBL and am stumbling along with the API as I can't find very clear documentation or examples anywhere. 我正在使用JEBL并且我在API中遇到了绊脚石,因为我无法在任何地方找到非常清晰的文档或示例。

What I would like to do is read in a tree with branches annotated with lengths and nodes annotated too. 我想要做的是在树中读取带有注释长度和节点注释的分支。 I should then be able to get the leaves and traverse the tree upwards, checking the annotations of the nodes as I go (the traversal is easy enough with JEBL, my problem is really with the annotation). 然后我应该能够获取树叶并向上遍历树,在我去的时候检查节点的注释(使用JEBL,遍历很容易,我的问题实际上是注释)。

They are phylogenetic trees where each node is a species and the annotations will mark whether certain genes are present on a particular node, and there are likely few enough genes that a string would be sufficient (eg if there are three genes A, B, and C possible node annotations might be "AB", "AC", or ""), and this must be allowed to be non-unique (since two nodes might have the same set of genes). 它们是系统发育树,其中每个节点都是一个物种,注释将标记特定节点上是否存在某些基因,并且可能没有足够的基因使得一个字符串就足够了(例如,如果有三个基因A,B和C可能的节点注释可能是“AB”,“AC”或“”),并且必须允许这是非唯一的(因为两个节点可能具有相同的基因集)。

At the moment I am reading the trees in Newick format - I can read the trees in and have branch lengths and traverse the tree, but I don't know how to label the nodes in a useful way (they must be able to be annotated in the format that they are read in from, not programmatically after they are read in): 目前我正在阅读Newick格式的树 - 我可以读取树中的树并且有树枝长度并遍历树,但我不知道如何以有用的方式标记节点(它们必须能够被注释以读取它们的格式,在读入后不以编程方式):

import java.io.IOException;
import java.io.StringReader;
import java.util.Set;
import jebl.evolution.trees.SimpleRootedTree;
import jebl.evolution.graphs.Node;
import jebl.evolution.io.ImportException;
import jebl.evolution.io.NewickImporter;
import jebl.gui.trees.treeviewer.TreeViewer;
import jebl.evolution.trees.Tree;

public class TreeLoader {  
    public static void main(String[] args) {
        String newick = "(A:0.1,B:0.2,(C:0.3,D:0.4)E:0.5)F;";
        StringReader sr = new StringReader(newick);
        NewickImporter ni = new NewickImporter(sr, true);
        try {
            SimpleRootedTree srt = (SimpleRootedTree) ni.importNextTree();
            Set<Node> leaves = srt.getExternalNodes();
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (ImportException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }           
    }   
    }

I can't see a way to include the node annotations in the Newick representation to be read in correctly. 我无法看到在Newick表示中包含节点注释以便正确读取的方法。 (I can't use the node names (A, B, etc in the above example) because they have to be unique). (我不能使用节点名称(上例中的A,B等),因为它们必须是唯一的)。 I have been looking at the Nexus format but don't really understand it very well. 我一直在研究Nexus格式,但并不是很了解它。 I downloaded Tree Graph to try to create appropriate Nexus files but I can't quite figure out how to do the annotations as I require. 我下载了Tree Graph以尝试创建适当的Nexus文件,但我无法弄清楚如何根据需要进行注释。 And then afterwards I'm not sure if they'll be read in by JEBL in a useful way anyway. 然后我不确定他们是否会以有用的方式被JEBL读入。 I imagine the way forward is to make use of JEBL's Attributable functionality (since Node implements this) but I'm not sure how it will work. 我想前进的方法是利用JEBL的Attributable功能(因为Node实现了这个),但我不确定它是如何工作的。

Any advice on how to set up my Nexus files and/or how to get JEBL to read them in correctly and how I can access the annotations would be very gratefully received!! 关于如何设置我的Nexus文件和/或如何让JEBL正确读取它们以及如何访问注释的任何建议都将非常感激!

May be off topic, but have you considered using ETE Toolkit : 可能是偏离主题,但您是否考虑过使用ETE Toolkit

In addition to a bunch of functionality, such as searching and traversal, it can also do node annotation: 除了一堆功能,例如搜索和遍历,它还可以执行节点注释:

http://etetoolkit.org/docs/latest/tutorial/tutorial_trees.html#node-annotation http://etetoolkit.org/docs/latest/tutorial/tutorial_trees.html#node-annotation

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM