Examples of PhyloTreeService


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

      }
    }
   
    LOGGER.info("doSearch old results contained " + oldRes.size() + " item(s)");
    Collection<PhyloTree> newRes;
    PhyloTreeService treeService = getSearchService().getPhyloTreeService()
   
    TaxonVariant[] taxonVariant = new TaxonVariant[taxon.length];
    List<String> resolutionError = new LinkedList<String> ();
    for (int i=0; i<taxon.length; i++) {
      if (taxon[i] == null) continue;
      if (taxon[i].equals(""))
        resolutionError.add("TaxonVariant name " + i + " missing");
      Set<TaxonVariant> tvSet = getTaxonLabelService().findTaxonVariantByName(taxon[i]);
      taxonVariant[i] = tvSet.isEmpty() ? null : tvSet.iterator().next(); // FIXME: This is not really the right behavior
      if (taxonVariant[i] == null)
        resolutionError.add("Couldn't resolve TaxonVariant '" + taxon[i] + "'");
      else
        LOGGER.debug("input '" + taxon[i] + "' resolved to TV " + taxonVariant[i].getId() + " ('" + taxonVariant[i].getFullName() + "')");
    }
    if (! resolutionError.isEmpty()) {
      addMessages(request, resolutionError);
      return new ModelAndView("search/treeTopSearch", Constants.RESULT_SET, oldRes);
    }
       
    switch (searchType) {
    case topology3Search:
      checkTaxa(taxonVariant, 3);
      newRes = treeService.findByTopology3(taxonVariant[0], taxonVariant[1], taxonVariant[2]);
      break;
    case topology4aSearch:
      checkTaxa(taxonVariant, 4);
      newRes = treeService.findByTopology4a(taxonVariant[0], taxonVariant[1], taxonVariant[2], taxonVariant[3]);
      break;
    case topology4sSearch:
      checkTaxa(taxonVariant, 4);
      newRes = treeService.findByTopology4s(taxonVariant[0], taxonVariant[1], taxonVariant[2], taxonVariant[3]);
      break;
    default:
      throw new Error ("Unknown search type '" + searchType + "'");
    }
   
View Full Code Here

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

      SearchType searchType,
      BindException errors,
      String searchTerm) throws InstantiationException {

    Collection<PhyloTree> matches = null;
    PhyloTreeService phyloTreeService = getSearchService().getPhyloTreeService()


    switch(searchType) {
    case byID:
      matches = (Collection<PhyloTree>) doSearchByIDString(request, phyloTreeService, PhyloTree.class, searchTerm);
      break;

    case byKind:
      matches = phyloTreeService
        .findSomethingByItsDescription(PhyloTree.class, "treeKind", searchTerm, true);
      break;
     
    case byQuality:
      matches = phyloTreeService
        .findSomethingByItsDescription(PhyloTree.class, "treeQuality", searchTerm, true);
      break;

    case byTitle:
      matches = phyloTreeService
        .findSomethingBySubstring(PhyloTree.class, "title", searchTerm);
      break;

    case byType:
      matches = phyloTreeService
        .findSomethingByItsDescription(PhyloTree.class, "treeType", searchTerm, true);
      break;

    case byNTAX:
      try {
          matches = phyloTreeService
          .findSomethingByRangeExpression(PhyloTree.class, "nTax", searchTerm);
        } catch (MalformedRangeExpression e) {
          addMessage(request, "Malformed range expression: " + e.getMessage());
        }
    }
View Full Code Here

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

      HttpServletResponse response,
      BindException errors,
      String searchTerm) throws InstantiationException {
   
    Collection<PhyloTree> matches = null;
    PhyloTreeService phyloTreeService = getSearchService().getPhyloTreeService();
   
    try {
      matches = phyloTreeService.findTreesByNCBINodes(searchTerm);
    }
    catch ( NumberFormatException e ) {
      addMessage(request, "Malformed NCBI identifier '" + searchTerm );
      LOGGER.error("Couldn't parse NCBI identifier: "+e.getMessage());
    }
View Full Code Here

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

import org.cipres.treebase.domain.tree.PhyloTreeService;

public class TreeQuery extends AbstractStandalone {
  public static void main(String[] args) {
    setupContext();
    PhyloTreeService treeServ = ContextManager.getPhyloTreeService();
    TaxonLabelService tlServ = ContextManager.getTaxonLabelService();
   
    Set<TaxonVariant>[] tvSet = new Set[3];
    for (int i=0; i<3; i++) {
      tvSet[i] = tlServ.findTaxonVariantByName(args[i]);
      warn(args[i] + " yields " + tvSet[i].size() + " matches");
    }
   
    TaxonVariant[] tv = new TaxonVariant[3];
    for (int i=0; i<3; i++) {
      tv[i] = tvSet[i].iterator().next();
      tvShow(tv[i]);
    }   
   
    Set<PhyloTree> trees = treeServ.findByTopology3(tv[0], tv[1], tv[2]);
    warn("Found " + trees.size() + " trees.");
   
    for (PhyloTree t : trees) {
      System.out.println(t.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.