Package org.cipres.treebase.domain.matrix

Examples of org.cipres.treebase.domain.matrix.CharacterMatrix


                        if (objs.isEmpty()) {
        AbstractStandalone.warn("No matrices found for legacy ID " + legacyID);
        continue;
      }
      for (TBPersistable obj : objs) {
        CharacterMatrix m = (CharacterMatrix) obj;
        Integer actual =  m.getnChar();
        if (actual == null || actual.intValue() == 0) {
          actual = m.getColumnsReadOnly().size();
          AbstractStandalone.warn("M" + m.getId() + " is missing nChar");
        }
        if (actual != expected)
          AbstractStandalone.warn("M" + m.getId() + " has nChar " + actual + ", expected " + expected);
      }
    }
    return v;
  }
View Full Code Here


        }

        MesquiteMatrixConverter converter = getConverter(data, pDataTypeHome, pItemDefHome);
        MatrixJDBC matrixJDBC = converter.convertMatrix(data, pDataSet);

        CharacterMatrix m = matrixJDBC.getCharacterMatrix();
        m.setNexusFileName(pNexusFileName);
        pDataSet.getMatrices().add(m);

        // setup jdbc dataset for direct jdbc batch inserts:
        // pDataSet.getDataJDBC().addData(m, data, converter);
        pDataSet.getDataJDBC().getMatrixJDBCList().add(matrixJDBC);
View Full Code Here

   * @param pData
   * @return
   */
  private MatrixJDBC convertMatrix(CharacterData pMesqMatrix, NexusDataSet pDataSet) {
    MatrixJDBC matrixJDBC = createMatrix(pMesqMatrix);
    CharacterMatrix m = matrixJDBC.getCharacterMatrix();

    // matrix properties:
    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
    for (int rowIndex = 0; rowIndex < taxonLabels.size(); rowIndex++) {

      TaxonLabel label = taxonLabels.get(rowIndex);

      MatrixRow aRow = new MatrixRow();
      aRow.setTaxonLabel(label);
      m.addRow(aRow);

      // add elements for a row: replaced by the direct jdbc version
      // addRowElements(aRow, rowIndex, pMesqMatrix);
    }

View Full Code Here

   * @see org.cipres.treebase.domain.matrix.RowSegmentHome#deleteByMatrixAndColumnRange(java.lang.Long, int, int)
   */
  public int deleteByMatrixAndColumnRange(Long pMatrixId, int pStart, int pEnd) {

    // error checking:
    CharacterMatrix m = getPersistedObjectByID(CharacterMatrix.class, pMatrixId);
    if (m == null || pStart < 0 || pEnd < 0 || pStart > pEnd) {
      return 0;
    }

    // int columnCount = m.getColumnsReadOnly().size();
    // another way to find the size of a collection w/o initialze it:
    int columnCount = ((Number) getSession()
      .createFilter(m.getColumns(), "select count(*)").uniqueResult()).intValue();

    if (pStart >= columnCount || pEnd >= columnCount) {
      return 0;
    }

View Full Code Here

    MatrixHome mh = (MatrixHome) ContextManager.getBean("matrixHome");
    Matrix m = mh.findPersistedObjectByID(Matrix.class, id);
    if (m == null) return;
   
    if (m instanceof CharacterMatrix) {
      CharacterMatrix cm = (CharacterMatrix) m;
      mh.cascadeDeleteRows(cm.getRowsReadOnly());
      mh.cascadeDeleteElements(cm);
      mh.cascadeDeleteColumns(cm);
    }
    mh.delete(m);
  }
View Full Code Here

    // 1.find a submission with matrix:
    Long matrixId = 265L; //
    //Long matrixId = 1544L; // 40k+ columns!
    //Long matrixId = 1547L; // large, but not crazy.
    CharacterMatrix m = (CharacterMatrix) loadObject(CharacterMatrix.class, matrixId);
    int start = 0;
    int end = 30;
   
    //2. query:
    List<String> rowStrings = getFixture().findRowAsString(m, start, end);
View Full Code Here

    for ( MatrixColumn tbColumn : tbMatrix.getColumnsReadOnly() ) {
      org.nexml.model.Character xmlCharacter = xmlMatrix.createCharacter();
      copyCharacterAttributes(tbColumn, xmlCharacter);
     
      //coerce the tbMatrix into a character matrix to get its character sets
      CharacterMatrix tbCharacterMatrix = (CharacterMatrix)tbMatrix;
      Set<CharSet> tbCharSets = tbCharacterMatrix.getCharSets();
      for ( CharSet tbCharSet : tbCharSets ) {
        Collection<ColumnRange> tbColumnRanges = tbCharSet.getColumns(tbCharacterMatrix);
       
        for ( ColumnRange tbColumnRange : tbColumnRanges ) {
         
View Full Code Here

    request.getSession().setAttribute("MATRIX_ID", matrix_id); // This session variable is used
    // for the cancel button in the
    // matrixRowSegmentList.jsp page

    // all the matrices are standard matrices for now
    CharacterMatrix standardMatrix = (CharacterMatrix) matrix;
    List<MatrixRow> matrixRows = standardMatrix.getRowsReadOnly();

    // save Matrix object in session
    ControllerUtil.saveMatrix(request, matrix);

    // add some data for the row to show
View Full Code Here

TOP

Related Classes of org.cipres.treebase.domain.matrix.CharacterMatrix

Copyright © 2018 www.massapicom. 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.