Examples of Taxon


Examples of org.cipres.treebase.domain.taxon.Taxon

    String buttonName = request.getParameter("taxonResultsaction");
    if (buttonName.equals("addCheckedToResults")) {
//      Map<String,String> parameterMap = request.getParameterMap();
      Collection<Taxon> newTaxa = new HashSet<Taxon> ();
      for (String taxonIdString : request.getParameterValues("selection")) {
        Taxon tx;
        try {
          tx = getTaxonLabelService().findTaxonByIDString(taxonIdString);
        } catch (MalformedTreebaseIDString e) {
          // This can only occur if the ID numbers in our web form are
          // malformed, so it represents a programming error.  20090312 MJD
View Full Code Here

Examples of org.cipres.treebase.domain.taxon.Taxon

        LOGGER.debug("Going to search for TreeBASE IDs")
        if (null != index && ! index.endsWith(".tb1") ) {
          TreebaseIDString idstr;
          try {
            idstr = new TreebaseIDString(identifier, Taxon.class, true);
            Taxon match = getTaxonHome().findPersistedObjectByID(idstr.getTBClass(), idstr.getId());
            if ( match != null ) {
              taxaFound.add(match);
            }         
          } catch (MalformedTreebaseIDString e) {
            addMessage(request, "Ignoring malformed taxon ID string '" + identifier + "'; try 'Tx####' or just a number");
          }
        }
        // looking up by legacy IDs, which we might have for Taxon and TaxonVariant
        else {
          LOGGER.debug("Searching for legacy " + index);
          Integer tb1LegacyId = null;
          try {
            tb1LegacyId = Integer.parseInt(identifier);
          } catch ( NumberFormatException e ) {
            addMessage(request, "Ignoring malformed TreeBASE1 ID string '" + identifier + "', because: " + e.getMessage());
            LOGGER.error("Couldn't parse legacy ID: "+e.getMessage());
          }
          if ( null != tb1LegacyId && null != index && index.matches(".*taxonVariant.*") ) {
            TaxonVariant tv = getTaxonHome().findVariantByTB1LegacyId(tb1LegacyId);
            LOGGER.debug("Found taxon variant: " + tv.getId());
            if ( null != tv.getTaxon() ) {
              taxaFound.add(tv.getTaxon());
            }
          }
          else if ( null != tb1LegacyId ){
            Taxon taxon = getTaxonHome().findByTB1LegacyId(tb1LegacyId);
            LOGGER.debug("Found taxon: " + taxon.getId());
            if ( null != taxon ) {
              taxaFound.add(taxon);
            }
          }         
        }
        break;
      case NCBI :
        LOGGER.debug("Going to search for NCBI taxon ids")
        Taxon match = getTaxonHome().findByNcbiTaxId(Integer.parseInt(identifier));
        if ( match != null ) {
          taxaFound.add(match);
        }
        break;
      case UBIO :
        LOGGER.debug("Going to search for uBio nameBankIDs");
        Taxon match1 = getTaxonHome().findByUBIOTaxId(Long.parseLong(identifier));
        if ( match1 != null ) {
          taxaFound.add(match1);
        }
        break;
    }
View Full Code Here

Examples of org.cipres.treebase.domain.taxon.Taxon

      } catch ( NumberFormatException e ) {
        LOGGER.info("NumberFormatException, user supplied taxon variant id was probably null: "+tvId);
      }
    }
    else {
      Taxon taxon = null;
      taxon = getTaxonHome().findByUBIOTaxId(manualId);
      if ( taxon != null ) {
        // 2a
        Collection<TaxonVariant> variants = getTaxonHome().findVariantsByTaxon(taxon);
        variant = variants.iterator().next();
      }
      else {
        // 2b
        TaxonLabelService taxonLabelService = getTaxonLabelService();
        Integer ncbiId = taxonLabelService.findNcbiTaxIdByUBIOTaxId(manualId)
        Taxon newTaxon = null;
        TaxonVariant newVariant = null;
        if ( null != ncbiId ) {
          String ncbiPreferredName = taxonLabelService.getNCBIPreferredName(ncbiId.toString());
          newTaxon = new Taxon(ncbiPreferredName,manualId,ncbiId);
          newVariant = new TaxonVariant(manualId,taxonLabel.getTaxonLabel(),ncbiPreferredName,"canonical form");         
        }       
        else {
          newTaxon = new Taxon();
          newTaxon.setName(taxonLabel.getTaxonLabel());
          newTaxon.setUBioNamebankId(manualId);         
          newVariant = new TaxonVariant(manualId,taxonLabel.getTaxonLabel(),taxonLabel.getTaxonLabel(),"canonical form");
        }
        newVariant.setTaxon(newTaxon);
        getTaxonHome().store(newTaxon);
        getTaxonHome().store(newVariant);
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.