Package inspector.jqcml.model

Examples of inspector.jqcml.model.QualityAssessment


    qcml.setVersion(version);

    Cv cv = new Cv("name", "uri", "cv");
    qcml.addCv(cv);

    QualityAssessment run = new QualityAssessment("run");
    QualityParameter param = new QualityParameter("name", cv, "param");
    param.setAccession("accession");
    run.addQualityParameter(param);
    qcml.addRunQuality(run);

    assertEquals(version, qcml.getVersion());

    // warning should be logged
View Full Code Here


        qcml.setFileName("Invalid.qcML");

        Cv cv = new Cv("name", "uri", "id");
        qcml.addCv(cv);

        QualityAssessment run = new QualityAssessment("id");
        QualityParameter param = new QualityParameter("name", cv, "id");
        param.setAccession("accession");
        run.addQualityParameter(param);
        qcml.addRunQuality(run);

        writer.writeQcML(qcml);
    }
View Full Code Here

    @Test(expected = IllegalStateException.class)
    public void writeQcML_missingContent() {
        QcML qcml = new QcML();
        qcml.setFileName("Invalid.qcML");

        QualityAssessment run = new QualityAssessment("run");
        QualityParameter param = new QualityParameter("name", new Cv("name", "uri", "cv"), "param");
        param.setAccession("accession");
        run.addQualityParameter(param);
        qcml.addRunQuality(run);

        writer.writeQcML(qcml);
    }
View Full Code Here

                if(qaIds.size() > 0) {  // only start a transaction if required
                    entityManager.getTransaction().begin();
                    // delete each duplicate QA
                    for(Entry<String, Integer> entry : qaIds.entrySet()) {
                        logger.info("Duplicate QA <id={}>: delete old QA <primaryKey={}>", entry.getKey(), entry.getValue());
                        QualityAssessment qa = entityManager.find(QualityAssessment.class, entry.getValue());
                        entityManager.remove(qa);
                    }
                    entityManager.getTransaction().commit();
                }
View Full Code Here

    try {
      // unmarshal this element
      Object temp = unmarshaller.unmarshal(xmlSnippet);
      QualityAssessmentList qaList = (QualityAssessmentList) JAXBIntrospector.getValue(temp);
      QualityAssessmentAdapter adapter = new QualityAssessmentAdapter();
      QualityAssessment result = adapter.unmarshal(qaList);
     
      // resolve references to Cv's (unmarshal them if required)
      adapter.resolveReferences(result, cvCache, index, unmarshaller);
     
      // set the isSet flag based on the element name
      if(unmarshaller.getIntrospector().getElementName(temp).getLocalPart().equals("setQuality"))
        result.setSet(true);
      else
        result.setSet(false);
     
      return result;
    } catch (Exception e) {
      logger.error("Unable to manually call adapter {} for XML snippet: {}\n{}", adapter, xmlSnippet.substring(0, xmlSnippet.indexOf('>')+1), e);
      throw new IllegalStateException("Unable to manually call the XmlAdapter: " + e);
View Full Code Here

      cv.setId("cv_" + i);
      qcmlExpected.addCv(cv);
    }
    // add RunQuality's
    for(int i = 0; i < 5; i++) {
      QualityAssessment runQuality = new QualityAssessment("run_" + i);
      // add MetaDataParameters
      for(int j = 0; j < (i+1) * 2; j++) {
        MetaDataParameter param = new MetaDataParameter();
        param.setName("metadata parameter " + i + "-" + j);
        param.setId("mp_run" + i + "_param" + j);
        param.setCvRef(qcmlExpected.getCv("cv_" + (i+j) % qcmlExpected.getNumberOfCvs()));
        param.setAccession("QC:00000" + j);
        param.setValue(Integer.toString((int)(Math.random()*1000)));
        runQuality.addMetaDataParameter(param);
      }
      // add QualityParameters
      for(int j = 0; j < (i+1) * 3; j++) {
        QualityParameter param = new QualityParameter();
        param.setName("quality parameter " + i + "-" + j);
        param.setId("qp_run" + i + "_param" + j);
        param.setCvRef(qcmlExpected.getCv("cv_" + (i+j) % qcmlExpected.getNumberOfCvs()));
        param.setAccession("QC:00000" + j);
        param.setValue(Integer.toString((int)(Math.random()*1000)));
        runQuality.addQualityParameter(param);
      }
      // add AttachmentParameters
      for(int j = 0; j < (i+1) * 2; j++) {
        AttachmentParameter param = new AttachmentParameter();
        param.setName("attachment parameter " + i + "-" + j);
        param.setId("ap_run" + i + "_param" + j);
        param.setCvRef(qcmlExpected.getCv("cv_" + (i+j) % qcmlExpected.getNumberOfCvs()));
        param.setAccession("QC:00000" + j);
        param.setQualityParameterRef(runQuality.getQualityParameter("qp_run" + i + "_param" + j));
        param.setBinary(DatatypeConverter.printBase64Binary(new BigInteger(1024, random).toByteArray()));
        runQuality.addAttachmentParameter(param);
      }
      qcmlExpected.addRunQuality(runQuality);
    }
    // add SetQuality's
    for(int i = 0; i < 2; i++) {
      QualityAssessment setQuality = new QualityAssessment("set_" + i);
      // add MetaDataParameters
      for(int j = 0; j < (i+1) * 2; j++) {
        MetaDataParameter param = new MetaDataParameter();
        param.setName("metadata parameter " + i + "-" + j);
        param.setId("mp_set" + i + "_param" + j);
        param.setCvRef(qcmlExpected.getCv("cv_" + (i+j) % qcmlExpected.getNumberOfCvs()));
        param.setAccession("QC:00000" + j);
        param.setValue(Integer.toString((int)(Math.random()*1000)));
        setQuality.addMetaDataParameter(param);
      }
      // add QualityParameters
      for(int j = 0; j < (i+1) * 5; j++) {
        QualityParameter param = new QualityParameter();
        param.setName("quality parameter " + i + "-" + j);
        param.setId("qp_set" + i + "_param" + j);
        param.setCvRef(qcmlExpected.getCv("cv_" + (i+j) % qcmlExpected.getNumberOfCvs()));
        param.setAccession("QC:00000" + j);
        param.setValue(Integer.toString((int)(Math.random()*1000)));
        setQuality.addQualityParameter(param);
      }
      // add AttachmentParameters
      for(int j = 0; j < (i+1) * 3; j++) {
        AttachmentParameter param = new AttachmentParameter();
        param.setName("attachment parameter " + i + "-" + j);
        param.setId("ap_set" + i + "_param" + j);
        param.setCvRef(qcmlExpected.getCv("cv_" + (i+j) % qcmlExpected.getNumberOfCvs()));
        param.setAccession("QC:00000" + j);
        param.setQualityParameterRef(setQuality.getQualityParameter("qp_set" + i + "_param" + j));
        param.setBinary(DatatypeConverter.printBase64Binary(new BigInteger(1024, random).toByteArray()));
        setQuality.addAttachmentParameter(param);
      }
      qcmlExpected.addSetQuality(setQuality);
    }
    qcmlExpected.addCv(new Cv("cv item 5", "/path/to/cv/5", "cv_5"));
    qcmlExpected.addCv(new Cv("cv item 6", "/path/to/cv/6", "cv_6"));
View Full Code Here

  public void addRunQuality_new() {
    int count = qcml.getNumberOfRunQualities();
    // new RunQuality is absent
    assertNull(qcml.getRunQuality("new RunQuality"));
    // add new RunQuality
    qcml.addRunQuality(new QualityAssessment("new RunQuality"));
    // new RunQuality is present
    assertEquals(qcml.getNumberOfRunQualities(), count+1);
    assertNotNull(qcml.getRunQuality("new RunQuality"));
  }
View Full Code Here

  @Test
  public void addRunQuality_duplicate() {
    int count = qcml.getNumberOfRunQualities();
    // new RunQuality is present
    assertNotNull(qcml.getRunQuality("run_2"));
    QualityAssessment old = qcml.getRunQuality("run_2");
    // add new RunQuality
    qcml.addRunQuality(new QualityAssessment("run_2"));
    // new RunQuality is present
    assertEquals(qcml.getNumberOfRunQualities(), count);
    assertNotNull(qcml.getRunQuality("run_2"));
    assertNotSame(old, qcml.getRunQuality("run_2"));
  }
View Full Code Here

  public void addSetQuality_new() {
    int count = qcml.getNumberOfSetQualities();
    // new SetQuality is absent
    assertNull(qcml.getSetQuality("new SetQuality"));
    // add new SetQuality
    qcml.addSetQuality(new QualityAssessment("new SetQuality"));
    // new RunQuality is present
    assertEquals(qcml.getNumberOfSetQualities(), count+1);
    assertNotNull(qcml.getSetQuality("new SetQuality"));
  }
View Full Code Here

  @Test
  public void addSetQuality_duplicate() {
    int count = qcml.getNumberOfSetQualities();
    // new SetQuality is present
    assertNotNull(qcml.getSetQuality("set_1"));
    QualityAssessment old = qcml.getSetQuality("set_1");
    // add new SetQuality
    qcml.addSetQuality(new QualityAssessment("set_1"));
    // new SetQuality is present
    assertEquals(qcml.getNumberOfSetQualities(), count);
    assertNotNull(qcml.getSetQuality("set_1"));
    assertNotSame(old, qcml.getSetQuality("set_1"));
  }
View Full Code Here

TOP

Related Classes of inspector.jqcml.model.QualityAssessment

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.