Examples of Study


Examples of org.cipres.treebase.domain.study.Study

      logger.info("Running Test: " + testName);
    }
    long studyId = 794;

    // this is the full study as it is stored by the database
    Study tbStudy = (Study)loadObject(Study.class, studyId);

    // these are the character state matrices that are part of the study
    Set<org.cipres.treebase.domain.matrix.Matrix> tbMatrices = tbStudy.getMatrices();

    // this is an object representation of a NeXML document
    Document nexDoc = DocumentFactory.safeCreateDocument();
   
    // the converter populates the NeXML document with the contents of the treebase study
View Full Code Here

Examples of org.cipres.treebase.domain.study.Study

    String newName = testName + " test " + Math.random();

    User submitter = (User) loadObject(User.class);
    assertTrue("Empty user table.", submitter != null);

    Study s = new Study();
    s.setName(newName);

    Submission sub = getSubmissionService().createSubmission(submitter, s);

    getPhyloTreeHome().store(sub);

    // force commit immediately, important:
    setComplete();
    endTransaction();

    logger.info("study created: " + s.getName() + "id = " + s.getId());
    logger.info("submission created: " + "id = " + sub.getId());

    onSetUp();

    // 2. add a nexus file:
    // String path = "/12Tx432C.nex"; Failure
    // String path = "/TestNexusFile.nex";
    // String path = "/M12c11.nex";
     String path = "/wtset.nex";
    //String path = "/multiTrees-label.nex";
    //String path = "/charset-taxset-partition.nex";
     //String path = "/49LBR.PDI-branch-length-continue.nex"; // continuous matrix, provided by
    // Peter M.
    File nexusFile = new File(getClass().getResource(path).toURI());
    Collection<File> files = new ArrayList<File>();
    files.add(nexusFile);

    long t1 = System.currentTimeMillis();
    getPhyloTreeHome().refresh(sub);
    // sub = (Submission) loadObject(Submission.class, sub.getId());
    s = sub.getStudy();
    assertTrue("Failed to refresh submission.", sub != null);

    getSubmissionService().addNexusFiles(sub, files, null);
    getStudyService().addNexusFiles(s, files);

    // force commit immediately, important:
    setComplete();
    endTransaction();

    long t2 = System.currentTimeMillis();

    logger.info("files added: " + s.getName() + "id = " + s.getId() + " Time =" + (t2 - t1));

    // 3. verify
    String studySQL = "select count(*) from Study where study_id=" + s.getId();
    String subSQL = "select count(*) from Submission where submission_id=" + sub.getId();
    int count = jdbcTemplate.queryForInt(studySQL);
    assertTrue(count == 1);

    count = jdbcTemplate.queryForInt(subSQL);
View Full Code Here

Examples of org.cipres.treebase.domain.study.Study

   
    // this study had mismatching taxon labels, according to @rdmpage
    long studyId = 2048
   
    // this is the full study as it is stored by the database
    Study tbStudy = (Study)loadObject(Study.class, studyId);

    // this becomes an object representation of a NeXML document
    Document nexDoc = DocumentFactory.safeCreateDocument();
   
    // the converter populates the NeXML document with the contents of the treebase study
    NexmlDocumentWriter ndc = new NexmlDocumentWriter(tbStudy,getTaxonLabelHome(),nexDoc);
    ndc.fromTreeBaseToXml(tbStudy); // here is where the conversion happens
       
    // these are the NeXML tree blocks that were created from the study     
    List<org.nexml.model.TreeBlock> nexTreeBlocks = nexDoc.getTreeBlockList();
   
    // there most be more than zero tree blocks in this study
    Assert.assertTrue(nexTreeBlocks.size() != 0 );
   
    // now we're going to match up the NeXML taxa in trees with their equivalent treebase ones
    for ( org.nexml.model.TreeBlock nexTreeBlock : nexTreeBlocks ) {
     
      // get the equivalent taxa block in treebase for the NeXML tree block's OTU set
      TaxonLabelSet tbTls = (TaxonLabelSet)findEquivalentObject(nexTreeBlock.getOTUs().getId(),"Tls",tbStudy.getTaxonLabelSets());
     
      // now iterate over all nodes in all trees in the focal tree block
      for ( Network<?> nexTree : nexTreeBlock ) {
        for ( Node nexNode : nexTree.getNodes() ) {
         
View Full Code Here

Examples of org.cipres.treebase.domain.study.Study

    String newName = testName + " test " + Math.random();

    User submitter = (User) loadObject(User.class);
    assertTrue("Empty user table.", submitter != null);

    Study s = new Study();
    s.setName(newName);

    Submission sub = getFixture().createSubmission(submitter, s);

    getSubmissionHome().store(s);

    // force commit immediately, important:
    setComplete();
    endTransaction();

    logger.info("study created: " + s.getName() + "id = " + s.getId());
    logger.info("submission created: " + "id = " + sub.getId());

    onSetUp();

    // 2. verify
    String studySQL = "select count(*) from Study where study_id=" + s.getId();
    String subSQL = "select count(*) from Submission where submission_id=" + sub.getId();
    int count = jdbcTemplate.queryForInt(studySQL);
    assertTrue(count == 1);

    count = jdbcTemplate.queryForInt(subSQL);
View Full Code Here

Examples of uk.ac.bbsrc.tgac.miso.core.data.Study

    super(submittable, submissionProperties);
    this.submission = submission;
  }

  public void buildSubmission() {
    Study s = (Study)submittable;
    if (submission != null) {
      Element study = submission.createElement("STUDY");
      //study.setAttribute("accession", s.getAccession());
      study.setAttribute("alias", s.getAlias());

      Element studyDescriptor = submission.createElementNS(null, "DESCRIPTOR");
      Element studyTitle = submission.createElementNS(null, "STUDY_TITLE");
      studyTitle.setTextContent(s.getAlias());
      studyDescriptor.appendChild(studyTitle);

      Element studyType = submission.createElementNS(null, "STUDY_TYPE");
      studyType.setAttribute("existing_study_type", s.getStudyType());
      studyDescriptor.appendChild(studyType);

      // DEPRECATED SRA 1.2
      //Element centerName = doc.createElementNS(null, "CENTER_NAME");
      //centerName.setTextContent(TgacSubmissionConstants.CENTRE_NAME.getKey());
      //studyDescriptor.appendChild(centerName);

      Element centerProjectName = submission.createElementNS(null, "CENTER_PROJECT_NAME");
      centerProjectName.setTextContent(s.getProject().getAlias());
      studyDescriptor.appendChild(centerProjectName);

      Element studyAbstract = submission.createElementNS(null, "STUDY_ABSTRACT");
      //TODO - add Study.getAbstract()
      studyAbstract.setTextContent(s.getAbstract());
      studyDescriptor.appendChild(studyAbstract);

      Element studyDescription = submission.createElementNS(null, "STUDY_DESCRIPTION");
      studyDescription.setTextContent(s.getDescription());
      studyDescriptor.appendChild(studyDescription);

      study.appendChild(studyDescriptor);

      if (submission.getElementsByTagName("STUDY_SET").item(0) != null) {
View Full Code Here

Examples of uk.ac.bbsrc.tgac.miso.core.data.Study

  @Test
  public void testStudyXmlGeneration() {
      Project p = dataObjectFactory.getProject();
      p.setAlias("Submission Test Project");
      //creates a Study object and sets parameters
      Study s = dataObjectFactory.getStudy();
      s.setProject(p);
      s.setAlias("Submission Test Study");
      s.setDescription("A test of the Submission XML generation process");
      s.setSecurityProfile(new SecurityProfile());

      Document submissionDocument = null;
      try {
          DocumentBuilder docBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
          submissionDocument = docBuilder.newDocument();
View Full Code Here

Examples of uk.ac.bbsrc.tgac.miso.core.data.Study

                          }
                  )
  )
  public Study get(long studyId) throws IOException {
    List eResults = template.query(STUDY_SELECT_BY_ID, new Object[]{studyId}, new StudyMapper());
    Study e = eResults.size() > 0 ? (Study) eResults.get(0) : null;
    return e;
  }
View Full Code Here

Examples of uk.ac.bbsrc.tgac.miso.core.data.Study

    return e;
  }

  public Study lazyGet(long studyId) throws IOException {
    List eResults = template.query(STUDY_SELECT_BY_ID, new Object[]{studyId}, new StudyMapper(true));
    Study e = eResults.size() > 0 ? (Study) eResults.get(0) : null;
    return e;
  }
View Full Code Here

Examples of uk.ac.bbsrc.tgac.miso.core.data.Study

    return template.query(STUDIES_BY_RELATED_SUBMISSION, new Object[]{submissionId}, new StudyMapper());
  }

  public Study getByExperimentId(long experimentId) throws IOException {
    List eResults = template.query(STUDY_SELECT_BY_EXPERIMENT_ID, new Object[]{experimentId}, new StudyMapper());
    Study e = eResults.size() > 0 ? (Study) eResults.get(0) : null;
    return e;
  }
View Full Code Here

Examples of uk.ac.bbsrc.tgac.miso.core.data.Study

        if ((element = lookupCache(cacheManager).get(DbUtils.hashCodeCacheKeyFor(id))) != null) {
          log.debug("Cache hit on map for Study " + id);
          return (Study)element.getObjectValue();
        }
      }
      Study s = dataObjectFactory.getStudy();
      s.setId(id);
      s.setName(rs.getString("name"));
      s.setAlias(rs.getString("alias"));
      s.setAccession(rs.getString("accession"));
      s.setDescription(rs.getString("description"));
      s.setStudyType(rs.getString("studyType"));
      try {
        s.setSecurityProfile(securityProfileDAO.get(rs.getLong("securityProfile_profileId")));

        if (!isLazy()) {
          s.setProject(projectDAO.get(rs.getLong("project_projectId")));

          for (Experiment e : experimentDAO.listByStudyId(id)) {
            s.addExperiment(e);
          }
        }
        else {
          s.setProject(projectDAO.lazyGet(rs.getLong("project_projectId")));
        }
      }
      catch (IOException e1) {
        e1.printStackTrace();
      }
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.