Examples of Taxa


Examples of mesquite.lib.Taxa

      LOGGER.info("MesquiteCOnverter: MesquiteProject project=" + project); //$NON-NLS-1$
    }

    // taxon first:
    ListableVector taxas = project.getTaxas();
    Taxa t = null;

    for (int i = 0; i < taxas.size(); i++) {
      // One Taxa represents one TAXA block in a Nexus file.
      t = (Taxa) taxas.elementAt(i);
      if (!t.isDoomed()) {
        // a taxa is represented by a TaxonLabelSet
        // name is important:
        TaxonLabelSet labelSet = new TaxonLabelSet();
        labelSet.setStudy(pStudy);
        labelSet.setTitle(t.getName());
        labelSet.setTaxa(true);

        // TODO: make sure the name is not null
        if (LOGGER.isDebugEnabled()) {
          LOGGER.debug("taxa(" + i + ") name=" + t.getName()); //$NON-NLS-1$
        }

        // FIXME: instead of using a loop, use one query!
        long[] taxaIDs = t.getTaxaIDs();
        for (int j = 0; j < taxaIDs.length; j++) {
          Taxon taxon = t.getTaxon(j);

          String aLabel = taxon.getName();

          TaxonLabel taxonLabel = getTaxonLabelHome().getByDescriptionAndStudy(
            aLabel,
            pStudy);

          labelSet.addPhyloTaxonLabel(taxonLabel);
        }

        pDataSet.addTaxonLabelSet(t, labelSet);
      }
    }

    // matrix:
    MesquiteMatrixConverter.convertMatrices(
      project,
      pDataSet,
      pFile.getName(),
      getMatrixDataTypeHome(),
      getItemDefinitionHome());

    // tree:
    TreesManager treeManager = (TreesManager) project.ownerModule
      .findElementManager(TreeVector.class);
    ListableVector treeVectors = treeManager.getTreeBlockVector();
    for (int i = 0; i < treeVectors.size(); i++) {
      // One treeVector represents one tree block
      TreeVector treeVector = (TreeVector) treeVectors.elementAt(i);
      // System.out.println(" treeVector: " + i + " - " + treeVector.getName());

      TreeBlock treeblock = new TreeBlock();
      treeblock.setTitle(treeVector.getName());

      // first get the taxon list for the trees:
      Taxa treeTaxa = treeVector.getTaxa();
      // String taxaName = treeTaxa.getName();
      TaxonLabelSet tlSet = pDataSet.getTaxonLabelSet(treeTaxa);
      treeblock.setTaxonLabelSet(tlSet);

      List<TaxonLabel> treeTaxonLabels = null;
View Full Code Here

Examples of mesquite.lib.Taxa

    if (TreebaseUtil.isEmpty(pNewick)) {
      return;
    }

    // make new taxa:
    Taxa taxa = new Taxa(pTaxonLabels.size());
    Iterator<TaxonLabel> iter = pTaxonLabels.iterator();
    Map<String, Integer> taxonLabelStrToIndexMap = new HashMap<String, Integer>();

    for (int it = 0; it < pTaxonLabels.size(); it++) {
      String taxonLabelStr = iter.next().getTaxonLabel();
      taxa.getTaxon(it).setName(taxonLabelStr);
      taxonLabelStrToIndexMap.put(StringUtil.blanksToUnderline(taxonLabelStr), it + 1);
      // taxa.getTaxon(it).setNameIsDefault(true);
    }

    // need to make sure newick string consists of indices:
View Full Code Here

Examples of mesquite.lib.Taxa

      // for qualified leave nodes.
      aNode.setName(nodeLabel);

      // TODO: need verify
      List<TaxonLabel> currentTaxa = getCurrentTaxaList();
      Taxa currentTreeTaxa = getCurrentTreeTaxa();

      String taxonLabelName = currentTreeTaxa.getTaxonName(pMesquiteTree
        .taxonNumberOfNode(pNodeIndex));
      aNode.setTaxonLabel(getTaxaLabel(currentTaxa, taxonLabelName));

    }
View Full Code Here

Examples of mesquite.lib.Taxa

    m.setTitle(pMesqMatrix.getName());
    m.setMissingSymbol(pMesqMatrix.getUnassignedSymbol());
    m.setGapSymbol(pMesqMatrix.getInapplicableSymbol());
    m.setDataType(getMatrixDataType());

    Taxa mesqTaxa = pMesqMatrix.getTaxa();
    TaxonLabelSet tlSet = pDataSet.getTaxonLabelSet(mesqTaxa);
    m.setTaxa(tlSet);
    List<TaxonLabel> taxonLabels = tlSet.getTaxonLabelsReadOnly();

    // add rows
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.