Examples of PhyloTree


Examples of org.cipres.treebase.domain.tree.PhyloTree

      logger.info("\n\t\tRunning Test: " + testName);
    }

    // 1. create a new tree with several nodes:
    String newName = testName + " test " + Math.random();
    PhyloTree tree = new PhyloTree();
    tree.setTitle(newName);
    tree.setLabel(newName);
    tree.setNexusFileName(null);

    PhyloTreeNode rootNode = new PhyloTreeNode();
    tree.addTreeNode(rootNode);
    tree.setRootNode(rootNode);

    PhyloTreeNode node1 = new PhyloTreeNode();
    rootNode.addChildNode(node1);

    PhyloTreeNode node2 = new PhyloTreeNode();
    rootNode.addChildNode(node2);

    PhyloTreeNode node3 = new PhyloTreeNode();
    node1.addChildNode(node3);

    PhyloTreeNode node4 = new PhyloTreeNode();
    node3.addChildNode(node4);

    getFixture().store(tree);

    // force commit immediately, important:
    setComplete();
    endTransaction();
    logger.info("tree created: " + tree.getLabel() + "id = " + tree.getId());

    // 2. verify
    String sqlStr = "select count(*) from phylotree where phylotree_id=" + tree.getId();
    int count = jdbcTemplate.queryForInt(sqlStr);
    assertTrue(count == 1);

    // 3. delete
    getFixture().delete(tree);
View Full Code Here

Examples of org.cipres.treebase.domain.tree.PhyloTree

    // 1. create a new tree block with two trees,
    // one associated w/ analysis step:

    String newName = testName + " test " + Math.random();
    PhyloTree tree = new PhyloTree();
    tree.setTitle(newName);
    tree.setLabel(newName);
    tree.setNexusFileName(null);

    PhyloTreeNode rootNode = new PhyloTreeNode();
    tree.addTreeNode(rootNode);
    tree.setRootNode(rootNode);

    PhyloTreeNode node1 = new PhyloTreeNode();
    rootNode.addChildNode(node1);

    PhyloTreeNode node2 = new PhyloTreeNode();
    rootNode.addChildNode(node2);

    PhyloTreeNode node3 = new PhyloTreeNode();
    node1.addChildNode(node3);

    PhyloTreeNode node4 = new PhyloTreeNode();
    node3.addChildNode(node4);

    // tree2:
    PhyloTree tree2 = new PhyloTree();
    tree2.setLabel(newName + "2");
    PhyloTreeNode node21 = new PhyloTreeNode();
    tree2.addTreeNode(node21);
    tree2.setRootNode(node21);

    // treeblock:
    TreeBlock block = new TreeBlock();
    block.setTitle(newName);

    block.addPhyloTree(tree);
    block.addPhyloTree(tree2);

    // Create an analysis step and associate w/ tree.
    Study s = getTestStudy();
    Analysis a1 = new Analysis();
    a1.setName("1 " + newName);
    AnalysisStep step1 = new AnalysisStep();
    step1.setName("step1 " + newName);
    s.addAnalysis(a1);
    a1.addAnalysisStep(step1);

    AnalyzedTree treeData = new AnalyzedTree();
    treeData.setTree(tree);
    treeData.setInput(Boolean.FALSE);
    step1.addAnalyzedData(treeData);

    getFixture().store(tree);
    getFixture().store(tree2);
    getFixture().store(block);

    // force commit immediately, important:
    setComplete();
    endTransaction();
    logger.info("tree1 created: " + tree.getLabel() + "id = " + tree.getId());
    logger.info("tree2 created: " + tree2.getLabel() + "id = " + tree2.getId());
    logger.info("treeBlock created: " + block.getTitle() + "id = " + block.getId());
    logger.info("analysis step created: " + step1.getName() + "id = " + step1.getId()
      + " associated data count=" + step1.getDataSetReadOnly().size());
    // logger.info("treeBlock created: " + block.getTitle() + "id = " + block.getId());
View Full Code Here

Examples of org.cipres.treebase.domain.tree.PhyloTree

    // Now replace the taxon labels in each tree and matrix with their canonical replacements
    for (AnalyzedData d : s.getAnalyzedData()) {
      Matrix m = d.getMatrixData();
      if (m != null) remapMatrixTaxonLabels(m, canonical);
     
      PhyloTree t = d.getTreeData();
      if (t != null) remapPhyloTreeTaxonLabels(t, canonical);
    }
   
    // Do the same for the taxonlabelsets
    for (TaxonLabelSet tls : s.getTaxonLabelSets()) {
View Full Code Here

Examples of org.cipres.treebase.domain.tree.PhyloTree

    outputLabelSet.setTitle("OutputTaxaForAnalysisStep"+getId());
    Set<TaxonLabel> labelSet = new HashSet<TaxonLabel>();
    for ( AnalyzedData data : getDataSetReadOnly() ) {
      if ( ! data.isInputData() ) {
        if ( data.getDataType().equals("tree") ) {
          PhyloTree tree = data.getTreeData();
          labelSet.addAll(tree.getAllTaxonLabels());
        }
        if ( data.getDataType().equals("matrix") ) {
          Matrix matrix = data.getMatrixData();
          labelSet.addAll(matrix.getTaxa().getTaxonLabelsReadOnly());
        }                 
View Full Code Here

Examples of org.cipres.treebase.domain.tree.PhyloTree

    inputLabelSet.setTitle("InputTaxaForAnalysisStep"+getId());
    Set<TaxonLabel> labelSet = new HashSet<TaxonLabel>();
    for ( AnalyzedData data : getDataSetReadOnly() ) {
      if ( data.isInputData() ) {
        if ( data.getDataType().equals("tree") ) {
          PhyloTree tree = data.getTreeData();
          labelSet.addAll(tree.getAllTaxonLabels());
        }
        if ( data.getDataType().equals("matrix") ) {
          Matrix matrix = data.getMatrixData();
          labelSet.addAll(matrix.getTaxa().getTaxonLabelsReadOnly());
        }                 
View Full Code Here

Examples of org.cipres.treebase.domain.tree.PhyloTree

    // 1. get a tree with several nodes:
    // String newName = testName + " test " + Math.random();

    // submission id = 6; tree id 24, tree_order = 2
    PhyloTree tree = (PhyloTree) loadObject(PhyloTree.class, new Long(5));

    logger.info("tree found: " + tree.getLabel() + "id = " + tree.getId());

    // 2. verify
    String sqlStr = "select count(*) from phylotree where phylotree_id=" + tree.getId();
    int count = jdbcTemplate.queryForInt(sqlStr);
    assertTrue(count == 1);

    // 3. delete
    getFixture().delete(tree);
View Full Code Here

Examples of org.cipres.treebase.domain.tree.PhyloTree

            }           
          }
          // ...then collect all output trees
          if ( matrixIsInput ) {
            for ( AnalyzedData analyzedData : analyzedDataCollection ) {
              PhyloTree analyzedTree = analyzedData.getTreeData();
              String inputOutput = analyzedData.getInputOutput();             
             
              // here we store all output data that are trees
              if ( inputOutput.equals("output") && analyzedTree != null ) {
                pResults.add(analyzedTree);
View Full Code Here

Examples of org.cipres.treebase.domain.tree.PhyloTree

  /**
   *
   * @see org.cipres.treebase.domain.tree.PhyloTreeService#updateByRearrangeNodes(java.lang.Long, java.lang.String)
   */
  public void updateByRearrangeNodes(Long pPhyloTreeId, String pNewick) {
    PhyloTree tree = findByID(pPhyloTreeId);
    if (tree == null) {
      return;
    }

    List<TaxonLabel> taxonLabels = new ArrayList<TaxonLabel>();
    taxonLabels.addAll(tree.getAllTaxonLabels());
   
    MesquiteConverter converter = new MesquiteConverter();
    //List<PhyloTreeNode> allnodes = new ArrayList<PhyloTreeNode>(tree.getTreeNodesReadOnly());
   
    getPhyloTreeHome().deleteNodes(tree);
   
    converter.buildNodesFromNewick(tree, taxonLabels, pNewick);
   
    //ALERT: for whatever reason, needs to save tree nodes explicitly.
    //seems the tree.treenodes merge cascade does not work!
    getDomainHome().storeAll(tree.getTreeNodesReadOnly());
   
    update(tree);
  }
View Full Code Here

Examples of org.cipres.treebase.domain.tree.PhyloTree

  public Collection<PhyloTree> findByStudy(Study pStudy) {
    Collection<PhyloTree> trees = new HashSet<PhyloTree>();
    for (Analysis an : pStudy.getAnalysesReadOnly()) {
      for (AnalysisStep step : an.getAnalysisStepsReadOnly()) {
        for (AnalyzedData data : step.getDataSetReadOnly()) {
          PhyloTree treeData = data.getTreeData();
          if (treeData != null) {
            trees.add(treeData);
          }
        }
      }
View Full Code Here

Examples of org.cipres.treebase.domain.tree.PhyloTree

    rt.setupContext();
    TaxonLabelService tlService = ContextManager.getTaxonLabelService();

    for (String arg : args) {
      Long id = Long.parseLong(arg);
      PhyloTree t = ContextManager.getPhyloTreeService().findByID(id);
      if (t == null) {
        System.err.println(id + ": no tree found");
      } else {
        Study s = t.getStudy();
        if (s == null) {
          System.err.println(id + ": no study");
        } else {
          tlService.updateStudyForAllLabels(t, s);
          System.err.println(id + ": done");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.