Examples of PhyloTree


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

    while ( treeBlockIterator.hasNext() ) {
      TreeBlock treeBlock = treeBlockIterator.next();
      if ( study != null ) {
        Iterator<PhyloTree> analyzedTreeIterator = study.getTrees().iterator();
        ANALYZED: while ( analyzedTreeIterator.hasNext() ) {
          PhyloTree analyzedTree = analyzedTreeIterator.next();
          if ( analyzedTree.getTreeBlock().getId() == treeBlock.getId() ) {
            treeBlock.setAnalyzed(true);
            break ANALYZED;
          }
        }
      }
View Full Code Here

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

    } else if (dataType.equals(Constants.TREE_KEY)) {
      List<EditFieldCommand> treeList = data.getTreeList();
      for (int i = 0; i < treeList.size(); i++) {
        EditFieldCommand editFieldCommand = treeList.get(i);
        // check if user update title
        PhyloTree phyloTree = mPhyloTreeService.findByID(editFieldCommand
          .getPhyloTree().getId());
        phyloTree.setLabel(editFieldCommand.getPhyloTree().getLabel());
        mPhyloTreeService.update(phyloTree);
        if (!editFieldCommand.getChecked()) {
          continue; // skip current iteration if not
        }
        // checked
        AnalyzedTree analyzedTree = new AnalyzedTree();
        analyzedTree.setInput(input);
        analyzedTree.setTree(phyloTree);
        analysisStep.addAnalyzedData(analyzedTree);
        mAnalysisStepService.update(analysisStep);
      }
    } else if ( dataType.equals(Constants.TREE_LIST)) {
      List<EditFieldCommand> treeBlockList = data.getTreeBlockList();
      LOGGER.warn("Going to set tree block as analyzed data");
      for ( int i = 0; i < treeBlockList.size(); i++ ) {
        EditFieldCommand editFieldCommand = treeBlockList.get(i);
        if ( ! editFieldCommand.getChecked() ) {
          continue// skip current iteration if not checked
        }       
        TreeBlock treeBlock = mPhyloTreeService.findTreeBlockByID(editFieldCommand.getTreeBlock().getId());
        if ( treeBlock == null ) {
          LOGGER.warn("No treeblock!!!");
        }
        else {
          LOGGER.warn(treeBlock.getTitle());
          Iterator<PhyloTree> treeIterator = treeBlock.getTreeListIterator();
          while (treeIterator.hasNext()) {
            PhyloTree phyloTree = treeIterator.next();
            AnalyzedTree analyzedTree = new AnalyzedTree();
            analyzedTree.setInput(input);
            analyzedTree.setTree(phyloTree);
            analysisStep.addAnalyzedData(analyzedTree);
            mAnalysisStepService.update(analysisStep);
View Full Code Here

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

          int seen = 0;
          for ( AnalyzedData innerData : selectedData ) {
            if ( innerData instanceof AnalyzedTree ) {             
              Iterator<PhyloTree> treeIterator = treeBlock.getTreeListIterator();
              FIND: while (treeIterator.hasNext()) {
                PhyloTree treeInBlock = treeIterator.next();
                if ( treeInBlock.getId() == ((AnalyzedTree)innerData).getTree().getId() ) {
                  seen++;
                  break FIND;
                }
              }
            }
View Full Code Here

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

    stepContent.append("[ The following blocks are input data for analysis step " + analysisId + " ]\n");
    TaxonLabelSet inputLabelSet = step.getInputTaxonLabelSet();
    inputLabelSet.buildNexusBlockTaxa(stepContent, true, false);
    for ( AnalyzedData data : step.getDataSetReadOnly() ) {
      if ( data.isInputData() ) {
        PhyloTree tree = data.getTreeData();
        Matrix matrix  = data.getMatrixData();
        if ( tree != null ) {
          tree.getTreeBlock().setTaxonLabelSet(inputLabelSet);         
          tree.buildNexusBlock(stepContent);
        }
        if ( matrix != null ) {
          matrix.setTaxa(inputLabelSet);
          matrix.generateNexusBlock(stepContent);
        }       
      }
    }
   
    stepContent.append("[ The following blocks are output data for analysis step " + analysisId + " ]\n");
    TaxonLabelSet outputLabelSet = step.getOutputTaxonLabelSet();
    //outputLabelSet.buildNexusBlockTaxa(stepContent, true, false);
    for ( AnalyzedData data : step.getDataSetReadOnly() ) {
      if ( ! data.isInputData() ) {
        PhyloTree tree = data.getTreeData();
        Matrix matrix  = data.getMatrixData();
        if ( tree != null ) {
          tree.getTreeBlock().setTaxonLabelSet(outputLabelSet);
          tree.buildNexusBlock(stepContent);
        }
        if ( matrix != null ) {
          matrix.setTaxa(outputLabelSet);
          matrix.generateNexusBlock(stepContent);
        }       
View Full Code Here

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

  }

  @Override
  protected String getFileContent(long pTreeId, HttpServletRequest request) {
    Study study = ControllerUtil.findStudy(request, mStudyService);
    PhyloTree tree = getPhyloTreeService().findByID(pTreeId);
    tree = getPhyloTreeService().resurrect(tree);
    TreeBlock enclosingTreeBlock = getPhyloTreeService().resurrect(tree.getTreeBlock());
    TaxonLabelSet tls = getPhyloTreeService().resurrect(enclosingTreeBlock.getTaxonLabelSet());
    if ( getFormat(request) == FORMAT_NEXML || getFormat(request) == FORMAT_RDF ) {
      NexusDataSet nds = new NexusDataSet();
      nds.getTaxonLabelSets().add(tls);
      TreeBlock treeBlock = new TreeBlock();
      treeBlock.setTaxonLabelSet(tls);
      treeBlock.addPhyloTree(tree);
      nds.getTreeBlocks().add(treeBlock);
      return getNexmlService().serialize(nds,getDefaultProperties(request),tree.getStudy());
    }
    /*else if ( getFormat(request) == FORMAT_RDF ) {
      NexusDataSet nds = new NexusDataSet();
      nds.getTaxonLabelSets().add(tls);
      TreeBlock treeBlock = new TreeBlock();
      treeBlock.setTaxonLabelSet(tls);
      treeBlock.addPhyloTree(tree);
      nds.getTreeBlocks().add(treeBlock);     
      return getRdfaService().serialize(nds,getDefaultProperties(request),tree.getStudy());     
    }  */ 
    else {
      StringBuilder builder = new StringBuilder();
      builder.append("#NEXUS\n\n");
 
      // header:
      TreebaseUtil.attachStudyHeader(study, builder);
 
      // taxa:
      // one taxon label per line, no line number.
      tls.buildNexusBlockTaxa(builder, true, false);
     
      //tree block:
      tree.buildNexusBlock(builder);
     
      return builder.toString();
    }
  }
View Full Code Here

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

    }
  }

  @Override
  protected Study getStudy(long objectId, HttpServletRequest request) {
    PhyloTree tree = getPhyloTreeService().findByID(objectId);
    return tree.getStudy();
  }
View Full Code Here

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

      Collection<TreeBlock> treeBlocks = new LinkedList<TreeBlock> ();

      for (AnalysisStep as : an.getAnalysisStepsReadOnly()) {
        for (AnalyzedData ad : as.getDataSetReadOnly()) {
          Matrix m = ad.getMatrixData();
          PhyloTree t = ad.getTreeData();

          if (m != null && ! justTrees) {
            addToSetIfNecessary(theSet, m.getAllTaxonLabels());
            m.setTaxa(theSet);
//            tlService.updateStudyForAllLabels(m, s);
          }
          if (t != null && ! justMatrices) {
            addToSetIfNecessary(theSet, t.getAllTaxonLabels());
//            tlService.updateStudyForAllLabels(t, s);
            treeBlocks.add(t.getTreeBlock());
          }   
        }
      }

      ContextManager.getTaxonLabelService().save(theSet);
View Full Code Here

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

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

    // 1. find a tree:
    PhyloTree tree = (PhyloTree) loadObject(PhyloTree.class);
    //PhyloTree tree = (PhyloTree) loadObject(PhyloTree.class, 41L);
    String newick   = tree.getNewickString();
   
    Long id = tree.getId();
    logger.info("tree found: id= " + id + "\n" + newick);

    // 2. test use the same newick:
      getFixture().updateByRearrangeNodes(id, newick);
   

    // 3. verify
      tree = (PhyloTree) loadObject(PhyloTree.class, id);
      String newick2 = tree.getNewickString();
    logger.info("new newick:\n" + newick2);
      assertTrue(newick.equalsIgnoreCase(newick2));
     
    if (logger.isInfoEnabled()) {
      logger.info(testName + " - end "); //$NON-NLS-1$
View Full Code Here

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

    }
  }

  public void testFindByTopology3() {
    Boolean searchResult = null;
    PhyloTree t = (PhyloTree) loadObject(PhyloTree.class);
    RandomList<PhyloTreeNode> nodes = new RandomList<PhyloTreeNode> ();
    nodes.addAll(t.getTreeNodesReadOnly());
   
    while (searchResult == null) {
      PhyloTreeNode a;
      do{ a = nodes.someElement();}
      while (a.getTaxonLabel()==null);
View Full Code Here

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

            }     
           
            AnalyzedTree theTree = new AnalyzedTree();
            theTree.setInput(false);
            String treeID = ioSection.getsval("tree_id");
            PhyloTree treeData = trees.get(treeID);

            treeData.setStudy(theStudy);
            ContextManager.getTaxonLabelService().updateStudyForAllLabels(treeData, theStudy);
            treeData.setTB1TreeID(treeID);
            ContextManager.getPhyloTreeService().save(treeData);
            theTreeBlock.addPhyloTree(treeData);
            theSubmission.addPhyloTreeBlockIfNecessary(theTreeBlock);
            ContextManager.getSubmissionService().save(theSubmission);
            theTree.setTree(treeData);
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.