Examples of TreeBlock


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

   */
  @Transient
  public Set<TreeBlock> getTreeBlocks() {
    Set<TreeBlock> treeBlocks = new HashSet<TreeBlock>();
    for ( PhyloTree tree : getTrees() ) {
      TreeBlock treeBlock = tree.getTreeBlock();
      if ( ! treeBlocks.contains(treeBlock) ) {
        treeBlocks.add(treeBlock);
      }
    }
    return treeBlocks;
View Full Code Here

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

                Map<String,String> nexusMap = t.getStudy().getNexusFiles();
                String nexusFile = nexusMap.remove(nexusFileName);
                s.getNexusFiles().put(nexusFileName, nexusFile);
                t.setStudy(s);
              }
              TreeBlock tb = t.getTreeBlock();
              if (tb == null) {
                System.err.println("  No tree block!");
              } else if (! tbs.contains(tb)) {
                Submission oldSub = sh.findByTreeBlock(tb);
                if (oldSub != null) {
View Full Code Here

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

    }   
   
    // Trees
    NexmlTreeBlockReader ntbc = new NexmlTreeBlockReader(pStudy,getTaxonLabelHome(),document);
    for ( org.nexml.model.TreeBlock xmlTreeBlock : document.getTreeBlockList() ) {
      TreeBlock tbTreeBlock = ntbc.fromXmlToTreeBase(xmlTreeBlock);
      for ( PhyloTree phyloTree : tbTreeBlock.getTreeList() ) {
        phyloTree.setNexusFileName(pFile.getName());
      }
      pDataSet.getTreeBlocks().add(tbTreeBlock);
   
   
View Full Code Here

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

      // bi-directional relationships:
      // * delete treeblock -> tree
      // * delete submission-> tree
      // * delete analyzedData -> tree
      TreeBlock block = pTree.getTreeBlock();
      if (block != null) {
        block.removePhyloTree(pTree);

        if (block.isEmpty()) {
          //TaxonLabelSet tSet=block.getTaxonLabelSet();
          deleteTreeBlock(block);
          //getTaxonLabelHome().clean(tSet);
        }
      }
View Full Code Here

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

   * @return
   */
  public TreeBlock fromXmlToTreeBase(org.nexml.model.TreeBlock xmlTreeBlock) {
    OTUs xmlOTUs = xmlTreeBlock.getOTUs();
    Long tbTaxonLabelSetId = readTreeBaseID(xmlOTUs);
    TreeBlock tbTreeBlock = new TreeBlock();
    tbTreeBlock.setTitle(xmlTreeBlock.getLabel());
    if ( null != tbTaxonLabelSetId ) {
      TaxonLabelSet tbTaxonLabelSet = getTaxonLabelHome()
        .findPersistedObjectByID(TaxonLabelSet.class, tbTaxonLabelSetId);
      tbTreeBlock.setTaxonLabelSet(tbTaxonLabelSet);
    }
    Iterator<Network<?>> xmlNetworkIterator = xmlTreeBlock.iterator();
    while ( xmlNetworkIterator.hasNext() ) {
      Network<?> xmlNetwork = xmlNetworkIterator.next();
      if ( xmlNetwork instanceof Tree ) {
        PhyloTree tbPhyloTree = fromXmlToTreeBase((Tree<?>) xmlNetwork);
        tbPhyloTree.setStudy(getStudy());
        tbTreeBlock.addPhyloTree(tbPhyloTree);
      }       
    }   
    return tbTreeBlock;
  }
View Full Code Here

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

      study = tree.getStudy();
    }
    if (pRequest.getParameter("treeblockid") != null) {
      String treeBlockId = pRequest.getParameter("treeblockid");
      Long value = Long.parseLong(treeBlockId);
      TreeBlock treeBlock = getPhyloTreeHome().findTreeBlockById(value);
      study = getSubmissionHome().findByTreeBlock(treeBlock).getStudy();
    }
    if ( ControllerUtil.isReviewerAccessGranted(pRequest) || ( study != null && study.isPublished() ) ) {
      return super.handleRequest(pRequest, pResponse);
    }
View Full Code Here

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

      return new AGenericList<Collection<PhyloTree>>(new ArrayList<PhyloTree>());
    }

    Long value = Long.parseLong(TBID);

    TreeBlock treeblock = getPhyloTreeHome().findTreeBlockById(value);
    // It can happen that the TBID is saved but the tree-block has been deleted
    // Or the only tree in the block has been removed.
    if (treeblock != null) {

      Long submission_id = getSubmissionHome().findByTreeBlock(treeblock).getId();
      TBPermission perm2 = getSubmissionService().getPermission(
        request.getRemoteUser(),
        submission_id);
      if (perm2 == TBPermission.WRITE || perm2 == TBPermission.SUBMITTED_WRITE) {
        LOGGER.info("setAuthorizationChecked(true)");
        setAuthorizationChecked(true);
        Collection<PhyloTree> phyloTreeList = treeblock.getTreeList();
        ControllerUtil.setTreeBlockId(TBID, request);
        checkAnalyzed(phyloTreeList,ControllerUtil.findStudy(request, mStudyService));
        // This ID has to be saved for success/cancel view.
        return new AGenericList<Collection<PhyloTree>>(phyloTreeList);
      } else {
View Full Code Here

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

    return "TB";
  }

  @Override
  protected String getFileContent(long blockid, HttpServletRequest request) {
    TreeBlock treeBlock = getPhyloTreeHome().findTreeBlockById(blockid);   
    if ( getFormat(request) == FORMAT_NEXML || getFormat(request) == FORMAT_RDF ) {
      NexusDataSet nexusDataSet = new NexusDataSet();
      nexusDataSet.getTaxonLabelSets().add(treeBlock.getTaxonLabelSet());
      nexusDataSet.getTreeBlocks().add(treeBlock);
      return getNexmlService().serialize(nexusDataSet,getDefaultProperties(request));
    }
    /*else if ( getFormat(request) == FORMAT_RDF ) {
      NexusDataSet nexusDataSet = new NexusDataSet();
      nexusDataSet.getTaxonLabelSets().add(treeBlock.getTaxonLabelSet());
      nexusDataSet.getTreeBlocks().add(treeBlock);     
      return getRdfaService().serialize(nexusDataSet,getDefaultProperties(request));     
    }*/   
    else {
      StringBuilder bldr = new StringBuilder("#NEXUS\n\n");
      treeBlock.generateAFileDynamically(bldr);
      return bldr.toString();
    }
  }
View Full Code Here

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

    }
  }

  @Override
  protected Study getStudy(long objectId, HttpServletRequest request) {
    TreeBlock treeBlock = getPhyloTreeHome().findTreeBlockById(objectId);
    Submission submission = getSubmissionHome().findByTreeBlock(treeBlock);
    return submission.getStudy();   
  }
View Full Code Here

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

    if (pRequest.getParameter("treeblockid") != null) {

      String TBID = pRequest.getParameter("treeblockid");
      Long value = Long.parseLong(TBID);

      TreeBlock TB = getPhyloTreeHome().findTreeBlockById(value);

      if (TB.getTitle().startsWith("Tree")) {
        newickStringName = TB.getTitle();
      } else {
        newickStringName = "Tree Block: " + TB.getTitle();
      }

      for (PhyloTree aTree : TB.getTreeList()) {
        treeMap.put(getMapKey(aTree), aTree.getId() + separator + aTree.getNewickString()
          + separator + "T");
        phylowsMap.put(getMapKey(aTree), aTree.getTreebaseIDString().getNamespacedGUID().toString());
        if ( defaultNewick.equals("") ) {
          defaultNewick = aTree.getNewickString();
        }
        treeList.add(aTree);
      }         
      // XXX ok, so this mess started when we somehow combined phylowidget for searching
      // with phylowidget for submission (why???) -- rvosa
      if ( TB.getTreeListIterator().hasNext() ) {
        Study study = TB.getTreeListIterator().next().getStudy();
        if ( study != null && study.isPublished() ) {
          pRequest.getSession().setAttribute("treeBlockID", TB.getId());
          if ( TB.getTreeListIterator().hasNext() ) {
            pRequest.getSession().setAttribute("studyID", study.getId());
          }
        }
      }
    }
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.