Package org.cipres.treebase.domain.matrix

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


    StandardMatrix matrix = new StandardMatrix();
    matrix.setAligned(true);
    matrix.setTitle(newName);
    matrix.setNexusFileName("None");

    MatrixDataType dnaType = getMatrixDataTypeHome().findByDescription(
      MatrixDataType.MATRIX_DATATYPE_DNA);
    matrix.setDataType(dnaType);

    // add two columns:
    DiscreteChar dnaChar = (DiscreteChar) dnaType.getDefaultCharacter();
    assertTrue("Failed to load dna character", dnaChar != null);

    MatrixColumn c1 = new MatrixColumn();
    c1.setCharacter(dnaChar);
    matrix.addColumn(c1);
View Full Code Here


    // get symbols as one String. need to do conversion:
    buildSymbols(categoricalData, m);

    // first consider the default char based on matrix data type.
    // For standard matrix, we know it has to be discrete char:
    MatrixDataType dataType = getMatrixDataType();
    DiscreteChar defaultChar = (DiscreteChar) dataType.getDefaultCharacter();
    if (defaultChar != null) {
      matrixJDBC.setDefaultCharID(defaultChar.getId());
    }

    List<MatrixColumnJDBC> columnJDBCs = new ArrayList<MatrixColumnJDBC>();
View Full Code Here

    MesquiteMatrixConverter converter = null;
    if (mesqDataType == MESQUITE_DNA_TYPE) {
      converter = new MesquiteStandardMatrixConverter();

      MatrixDataType dataType = pDataTypeHome
        .findByDescription(MatrixDataType.MATRIX_DATATYPE_DNA);
      converter.setMatrixDataType(dataType);
    } else if (mesqDataType == MESQUITE_RNA_TYPE) {
      converter = new MesquiteStandardMatrixConverter();

      MatrixDataType dataType = pDataTypeHome
        .findByDescription(MatrixDataType.MATRIX_DATATYPE_RNA);
      converter.setMatrixDataType(dataType);
    } else if (mesqDataType == MESQUITE_PROTEIN_TYPE) {
      converter = new MesquiteStandardMatrixConverter();

      MatrixDataType dataType = pDataTypeHome
        .findByDescription(MatrixDataType.MATRIX_DATATYPE_PROTEIN);
      converter.setMatrixDataType(dataType);
      // } else if (mesqDataType == DiscreteDatatypes._CODON_DATATYPE) {
      // converter = new MesquiteStandardMatrixConverter();
      //
      // // TODO: per Mark H. CODON should be depreciated in NCL.
      // MatrixDataType dataType = pDataTypeHome
      // .findByDescription(MatrixDataType.MATRIX_DATATYPE_DNA);
      // converter.setMatrixDataType(dataType);
    } else if (mesqDataType == MESQUITE_CATEGORICAL_TYPE) {
      converter = new MesquiteStandardMatrixConverter();

      MatrixDataType dataType = pDataTypeHome
        .findByDescription(MatrixDataType.MATRIX_DATATYPE_STANDARD);
      converter.setMatrixDataType(dataType);
    } else if (mesqDataType == MESQUITE_CONTINUOUS_TYPE) {
      MesquiteContinuousMatrixConverter continousConverter = new MesquiteContinuousMatrixConverter();
      continousConverter.setItemDefinitionHome(pItemDefHome);

      converter = continousConverter;
      MatrixDataType dataType = pDataTypeHome
        .findByDescription(MatrixDataType.MATRIX_DATATYPE_CONTINUOUS);
      converter.setMatrixDataType(dataType);
    } else {
      // TODO: other types: nucleotide, distance, ...

      // a missing datatype means use standard type:
      converter = new MesquiteStandardMatrixConverter();

      MatrixDataType dataType = pDataTypeHome
        .findByDescription(MatrixDataType.MATRIX_DATATYPE_STANDARD);
      converter.setMatrixDataType(dataType);
    }

    return converter;
View Full Code Here

  /**
   *
   * @see org.cipres.treebase.domain.matrix.MatrixDataTypeHome#findByDescription(java.lang.String)
   */
  public MatrixDataType findByDescription(String pDescription) {
    MatrixDataType returnVal = null;

    Criteria c = getSession().createCriteria(MatrixDataType.class).add(
      org.hibernate.criterion.Expression.eq("description", pDescription));

    returnVal = (MatrixDataType) c.uniqueResult();
View Full Code Here

    if (logger.isInfoEnabled()) {
      logger.info("\n\t\tRunning Test: " + testName);
    }

    String desc = MatrixDataType.MATRIX_DATATYPE_DNA;
    MatrixDataType result = getFixture().findByDescription(desc);

    // verify
    assertTrue(result != null);
    assertTrue(result.getDefaultCharacter() != null);
    assertTrue(result.getDescription().equals(desc));

    if (logger.isInfoEnabled()) {
      logger.info(testName + " verified type:" + desc);
    }
  }
View Full Code Here

TOP

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

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.