Examples of PhyloTree


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

        attachAnalysisStepMetadata(tbAnalysisStep, nexAnalysisStep);       
        for ( AnalyzedData tbAnalyzedData : tbAnalysisStep.getDataSetReadOnly() ) {
          String type = tbAnalyzedData.getDataType();
          logger.info("analyzed data is of type "+type);
          if ( "tree".equals(type) ) {
            PhyloTree tbTree = tbAnalyzedData.getTreeData();
            analyzedDataForData.put(tbTree.getTreebaseIDString().toString(), tbAnalyzedData);
          }
          else if ( "matrix".equals(type) ) {
            org.cipres.treebase.domain.matrix.Matrix tbMatrix = tbAnalyzedData.getMatrixData();
            analyzedDataForData.put(tbMatrix.getTreebaseIDString().toString(), tbAnalyzedData);
          }
View Full Code Here

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

            Collection<AnalyzedData> analyzedDataCollection = analysisStep.getDataSetReadOnly();
            boolean treeIsOutput = false;
             
            // now we have to check any trees in the analyzedData...
            for ( AnalyzedData analyzedData : analyzedDataCollection ) {
              PhyloTree analyzedTree = analyzedData.getTreeData();
              String inputOutput = analyzedData.getInputOutput();           
             
              // if the datum is a tree, and it's an output, and it's our focal tree...
              if ( inputOutput.equals("output") && analyzedTree != null && analyzedTree.getId() == phyloTree.getId() ) {
                treeIsOutput = true;
              }         
            }
            // ...then...
            if ( treeIsOutput ) {
View Full Code Here

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

      ((DeleteTree) ContextManager.getBean("deleteTree")).doIt(tId);
    }
  }

  public void doIt(Long id) {
    PhyloTree t = treeHome.findPersistedObjectByID(PhyloTree.class, id);
    if (t == null) return;

    treeHome.deleteNodes(t);
    treeHome.delete(t);
  }
View Full Code Here

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

   * @see org.cipres.treebase.domain.study.AnalyzedData#getDisplayName()
   */
  @Override
  @Transient
  public String getDisplayName() {
    PhyloTree theTree = getTree();
    return theTree == null ? "(none)" : theTree.getLabel();
  }
View Full Code Here

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

      trans.commit();
      warn("Repatriated nexus file " + nexusFileName + " from study " + oldStudy.getId() + " to " + newStudy.getId());
    }
   
    for (TBPersistable obj : ContextManager.getStudyHome().findAll(PhyloTree.class)) {
      PhyloTree t = (PhyloTree) obj;
      String nexusFileName = t.getNexusFileName();
      Transaction trans = me.beginTransaction();

      if (! nexusFileStudy.containsKey(nexusFileName)) continue;
      Study oldStudy = nexusFileStudy.get(nexusFileName);
      Study newStudy = t.getStudy();   
      if (newStudy == null || oldStudy == null) continue;
   
      newStudy.getNexusFiles().put(nexusFileName, oldStudy.getNexusFiles().remove(nexusFileName));
      trans.commit();
      warn("Repatriated nexus file " + nexusFileName + " from study " + oldStudy.getId() + " to " + newStudy.getId());
View Full Code Here

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

      Set<PhyloTree> trees = new HashSet<PhyloTree> ();
      for (TBPersistable obj : treeService.findSomethingByString(PhyloTree.class, "TB1TreeID", legacyID))
        trees.add((PhyloTree) obj);
     
      if (trees.size() == 1) {
        PhyloTree t = trees.iterator().next();
        warn("  Fixing tree " + t.getId());
       
        t.setLabel(label);
        t.setTitle(title);
       
        { // Map type -> treeType
          Collection<TreeType> tts = treeService.findSomethingByString(TreeType.class, "description", type);
          TreeType tt = null;
          if (tts.isEmpty()) {
            warn("Unknown TreeType '" + type + "'; skipping it");
/*            // Or you can manufacture a fresh one here, which is not normally allowed
*                      // Note that tt.setDescription is private, so you will have to make it public to use this code
*                      // 20090320 MJD
            tt = new TreeType();
            tt.setDescription(type);
            tt.setId(matrixService.save(tt));
*/
          } else {
            tt = tts.iterator().next();
          }
          if (tt != null) t.setTreeType(tt);
        }
      } else if (trees.size() > 1) {
        warn("Found " + trees(trees.size()) + " matching legacy ID " + legacyID);
      }
    }
View Full Code Here

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

  }
 
  public void testSerializeTree() {
    long treeId = 4816;
    Document doc = DocumentFactory.safeCreateDocument();   
    PhyloTree tree = (PhyloTree)loadObject(PhyloTree.class,treeId);
    TaxonLabelSet tls = tree.getTreeBlock().getTaxonLabelSet();
    NexusDataSet nds = new NexusDataSet();
    nds.getTaxonLabelSets().add(tls);
    TreeBlock treeBlock = new TreeBlock();
    treeBlock.setTaxonLabelSet(tls);
    treeBlock.addPhyloTree(tree);
    nds.getTreeBlocks().add(treeBlock);
    NexmlDocumentWriter conv = new NexmlDocumentWriter(tree.getStudy(),getTaxonLabelHome(),doc);
    String xml = conv.fromTreeBaseToXml(nds).getXmlString();
    System.out.println(xml);
    Assert.assertNotNull(xml);
  }
View Full Code Here

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

    }

    if (! opts.getBoolOpt("t")) {
      for (TBPersistable tbT : ContextManager.getPhyloTreeHome().findAll(PhyloTree.class)) {
        Transaction tr = rt.beginTransaction();
        PhyloTree t = (PhyloTree) tbT;
        Study s = t.getStudy();
        System.err.print("Repatriating labels of tree " + t.getId() + "...");
        tlService.updateStudyForAllLabels(t, s);
        tr.commit();
        System.err.println(" Done.");
      }
    }
View Full Code Here

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

          LOGGER.debug(" tree=" + newick); //$NON-NLS-1$
        }

        // System.out.println(" tree: " + mesqTree.getName() + " " + newick);

        PhyloTree phyloTree = new PhyloTree();
        phyloTree.setLabel(mesqTree.getName());
        phyloTree.setNexusFileName(pFile.getName());
        phyloTree.setPublished(false);
        phyloTree.setRootedTree(mesqTree.getRooted());
        phyloTree.setNewickString(newick);
        phyloTree.setStudy(pStudy);
        // phyloTree.setBigTree(false); //TODO
        // phyloTree.setTreeType(treeType);
        // phyloTree.setTreeAttribute(pNewTreeAttribute);
        // phyloTree.setTreeQuality(pNewTreeQuality);

        int rootIndex = mesqTree.getRoot();
        PhyloTreeNode rootNode = createNode(mesqTree, null, rootIndex);
        phyloTree.addTreeNode(rootNode);
        phyloTree.setRootNode(rootNode);

        treeTraversal(mesqTree, rootIndex, rootNode);

        phyloTree.updateSubtreeBounds();

        treeblock.addPhyloTree(phyloTree);
        // pDataSet.getPhyloTrees().add(phyloTree);

        // verification
        if (LOGGER.isDebugEnabled()) {
          Set<PhyloTreeNode> nodes = phyloTree.getTreeNodesReadOnly();
          LOGGER.debug("-num of nodes=" + nodes.size()); //$NON-NLS-1$
        }

      }
View Full Code Here

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

   
   
    // 1. create a list of taxon labels and a tree:
    String newName = testName + " test " + Math.random();

    PhyloTree tree = new PhyloTree();
    tree.setTitle(newName);
   
    List<TaxonLabel> labels = new ArrayList<TaxonLabel>();
    labels.add(new TaxonLabel("Heppiella_verticillata"));
    labels.add(new TaxonLabel("Heppiella_ulmifolia"));
    labels.add(new TaxonLabel("Heppiella_viscida"));
    labels.add(new TaxonLabel("Heppiella_repens"));
    labels.add(new TaxonLabel("Gloxinia"));
   
    //String newick2 = "[&R] (Gloxinia,Gloxinia_1234,(Heppiella_repens,Heppiella_verticillata,Heppiella_viscida,Heppiella_ulmifolia))";
    String newick = "[&R] (Gloxinia,(Heppiella_repens,Heppiella_verticillata,Heppiella_viscida,Heppiella_ulmifolia))";
   
//    Parser mesqParser = new Parser(newick2);
//    String aToken = mesqParser.getNextToken();
//    int i =0;
//    while (!TreebaseUtil.isEmpty(aToken)) {
//      logger.debug(" " + i+ ": " + aToken);
//      i++;
//      aToken = mesqParser.getNextToken();
//    }
//
   
//    String newick = "[&R] (5,(4,1,3,2))";
   
    // 2. test
    MesquiteConverter converter = new MesquiteConverter();
    converter.buildNodesFromNewick(tree, labels, newick);
   
    //3. verify:
    tree.updateNewickString();
    logger.debug("treenode size=" + tree.getTreeNodesReadOnly().size() + "\n" + tree.getNewickString());
    //assertTrue(condition);
   
    if (logger.isInfoEnabled()) {
      logger.info(testName + " - end "); //$NON-NLS-1$
    }
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.