Package org.cipres.treebase.domain.matrix

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


   * (non-Javadoc)
   * @see org.cipres.treebase.web.controllers.PhyloWSController#getObjectQueryParameters(java.lang.Long)
   */
  @Override
  Map<String,String> getObjectQueryParameters(Long objectId) throws ObjectNotFoundException {
    Matrix matrix = getMatrixService().findByID(objectId);
    if ( matrix == null ) {
      throw new ObjectNotFoundException("Can't find matrix " + objectId);
    }
    Study study = matrix.getStudy();
   
    if ( study == null ) {
      throw new ObjectNotFoundException("Can't find study for matrix "+objectId);
    }
   
    setStudy(matrix.getStudy());
   
    Map<String,String> params = new HashMap<String,String>();
    params.put("id", ""+study.getId());
    params.put("matrixid", ""+objectId);
    return params;
View Full Code Here


    TaxonLabelSet inputLabelSet = step.getInputTaxonLabelSet();
    inputLabelSet.buildNexusBlockTaxa(stepContent, true, false);
    for ( AnalyzedData data : step.getDataSetReadOnly() ) {
      if ( data.isInputData() ) {
        PhyloTree tree = data.getTreeData();
        Matrix matrix  = data.getMatrixData();
        if ( tree != null ) {
          tree.getTreeBlock().setTaxonLabelSet(inputLabelSet);         
          tree.buildNexusBlock(stepContent);
        }
        if ( matrix != null ) {
          matrix.setTaxa(inputLabelSet);
          matrix.generateNexusBlock(stepContent);
        }       
      }
    }
   
    stepContent.append("[ The following blocks are output data for analysis step " + analysisId + " ]\n");
    TaxonLabelSet outputLabelSet = step.getOutputTaxonLabelSet();
    //outputLabelSet.buildNexusBlockTaxa(stepContent, true, false);
    for ( AnalyzedData data : step.getDataSetReadOnly() ) {
      if ( ! data.isInputData() ) {
        PhyloTree tree = data.getTreeData();
        Matrix matrix  = data.getMatrixData();
        if ( tree != null ) {
          tree.getTreeBlock().setTaxonLabelSet(outputLabelSet);
          tree.buildNexusBlock(stepContent);
        }
        if ( matrix != null ) {
          matrix.setTaxa(outputLabelSet);
          matrix.generateNexusBlock(stepContent);
        }       
      }
    }   
    return stepContent.toString();
  }
View Full Code Here

    if (dataType.equals(Constants.MATRIX_KEY)) {
      List<EditFieldCommand> matrixList = data.getMatrixList();
      for (int i = 0; i < matrixList.size(); i++) {
        EditFieldCommand editFieldCommand = matrixList.get(i);
        // check if user update title
        Matrix matrix = mMatrixService.findByID(editFieldCommand.getMatrix().getId());
        matrix.setTitle(editFieldCommand.getMatrix().getTitle());
        mMatrixService.update(matrix);
        if (!editFieldCommand.getChecked()) continue; // skip current iteration if not
        // checked
        AnalyzedMatrix analyzedMatrix = new AnalyzedMatrix();
        analyzedMatrix.setInput(input);
View Full Code Here

      theSet.setTitle(an.getName());
      Collection<TreeBlock> treeBlocks = new LinkedList<TreeBlock> ();

      for (AnalysisStep as : an.getAnalysisStepsReadOnly()) {
        for (AnalyzedData ad : as.getDataSetReadOnly()) {
          Matrix m = ad.getMatrixData();
          PhyloTree t = ad.getTreeData();

          if (m != null && ! justTrees) {
            addToSetIfNecessary(theSet, m.getAllTaxonLabels());
            m.setTaxa(theSet);
//            tlService.updateStudyForAllLabels(m, s);
          }
          if (t != null && ! justMatrices) {
            addToSetIfNecessary(theSet, t.getAllTaxonLabels());
//            tlService.updateStudyForAllLabels(t, s);
View Full Code Here

          if (ioSection.label.equals("INPUT_MATRIX")) {
            AnalyzedMatrix theMatrix = new AnalyzedMatrix();
            theMatrix.setInput(true);
            String matrixID = ioSection.getsval("matrix_id");
           
            Matrix matrixData = matrices.get(matrixID);
                 
            if (matrixData == null) {
              warn("Matrix " + matrixID + "is used in analysis " + an.getString("analysis_id") + " but is not listed in any MATRIX section for its study");
              return new ValueNone();
            }

            matrixData.setStudy(theStudy);
            ContextManager.getTaxonLabelService().updateStudyForAllLabels(matrixData, theStudy);
            matrixData.setTB1MatrixID(matrixID);
            ContextManager.getMatrixService().save(matrixData);
            theSubmission.addMatrixIfNecessary(matrixData);
            ContextManager.getSubmissionService().save(theSubmission);
            theMatrix.setMatrix(matrixData);
            theData = theMatrix;
View Full Code Here

              }         
            }
            // ...then...
            if ( treeIsOutput ) {
              for ( AnalyzedData analyzedData : analyzedDataCollection ) {
                Matrix analyzedMatrix = analyzedData.getMatrixData();
                String inputOutput = analyzedData.getInputOutput();
               
                // collect all input matrices
                if ( inputOutput.equals("input") && analyzedMatrix != null ) {
                  pResults.add(analyzedMatrix);
View Full Code Here

  @Override
  @Transient
  public String getDisplayName() {
    // TODO Auto-generated method stub
    Matrix theMatrix = getMatrix();
    return theMatrix == null ? "(none)" : theMatrix.getTitle();
  }
View Full Code Here

        warn(nStudies + " studies, " + nexusFileStudy.size() + " nexus files");
      }
    }
       
    for (TBPersistable obj : ContextManager.getStudyHome().findAll(Matrix.class)) {
      Matrix m = (Matrix) obj;
      String nexusFileName = m.getNexusFileName();
      Transaction trans = me.beginTransaction();

      if (! nexusFileStudy.containsKey(nexusFileName)) continue;
      Study oldStudy = nexusFileStudy.get(nexusFileName);
      Study newStudy = m.getStudy()
      if (newStudy == null || oldStudy == null) continue;
     
      newStudy.getNexusFiles().put(nexusFileName, oldStudy.getNexusFiles().remove(nexusFileName));
      trans.commit();
      warn("Repatriated nexus file " + nexusFileName + " from study " + oldStudy.getId() + " to " + newStudy.getId());
View Full Code Here

      for (TBPersistable obj : matrixService.findSomethingByString(Matrix.class, "TB1MatrixID", legacyID) )
        matrices.add((Matrix) obj);
      matrices.addAll(matrixService.findByNexusFile(legacyID + ".nex"));

      if (matrices.size() == 1) {
        Matrix m = matrices.iterator().next();
        warn("  Fixing matrix " + m.getId());
         
        // Map matrixDataType -> matrixKind
        {
          Collection<MatrixKind> mks = matrixService.findSomethingByString(MatrixKind.class, "description", matrixDataType);
          MatrixKind mk = null;
          if (mks.isEmpty()) {
            warn("Unknown MatrixKind '" + matrixDataType + "'; skipping it");
/*            // Or you can manufacture a fresh one here, which is not normally allowed
*                      // Note that mk.setDescription is private, so you will have to make it public to use this code
*                      // 20090320 MJD
                        mk = new MatrixKind();
            mk.setDescription(matrixDataType);
            mk.setId(matrixService.save(mk));
*/          } else {
            mk = mks.iterator().next();
          }
          if (mk != null) m.setMatrixKind(mk);
        }

        m.setTitle(title);
        m.setTB1MatrixID(legacyID);
       
      } else if (matrices.size() > 1) {
        warn("matrix legacy ID " + legacyID + " matches " + matrices(matrices.size()));
      }
    }
View Full Code Here


    if (! opts.getBoolOpt("m")) {
      for (TBPersistable tbM : ContextManager.getMatrixHome().findAll(Matrix.class)) {
        Transaction tr = rt.beginTransaction();
        Matrix m = (Matrix) tbM;
        Study s = m.getStudy();
        tlService.updateStudyForAllLabels(m, s);
        tr.commit();
        System.err.println("Repatriated labels of matrix " + m.getId());
      }
    }

    if (! opts.getBoolOpt("t")) {
      for (TBPersistable tbT : ContextManager.getPhyloTreeHome().findAll(PhyloTree.class)) {
View Full Code Here

TOP

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

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.