Ejemplo n.º 1
0
  private void runImportCnaData() throws DaoException, IOException {

    DaoGeneticAlteration dao = DaoGeneticAlteration.getInstance();
    DaoGeneOptimized daoGene = DaoGeneOptimized.getInstance();

    // the largest current true Entrez gene ID counts 8 digits
    daoGene.addGene(new CanonicalGene(999999207, "TESTAKT1"));
    daoGene.addGene(new CanonicalGene(999999208, "TESTAKT2"));
    daoGene.addGene(new CanonicalGene(999910000, "TESTAKT3"));
    daoGene.addGene(new CanonicalGene(999999369, "TESTARAF"));
    daoGene.addGene(new CanonicalGene(999999472, "TESTATM"));
    daoGene.addGene(new CanonicalGene(999999673, "TESTBRAF"));
    daoGene.addGene(new CanonicalGene(999999672, "TESTBRCA1"));
    daoGene.addGene(new CanonicalGene(999999675, "TESTBRCA2"));

    ProgressMonitor.setConsoleMode(false);
    // TBD: change this to use getResourceAsStream()
    File file = new File("src/test/resources/cna_test.txt");
    ImportTabDelimData parser = new ImportTabDelimData(file, "Barry", geneticProfileId, null);
    int numLines = FileUtil.getNumLines(file);
    parser.importData(numLines);

    String value = dao.getGeneticAlteration(geneticProfileId, sample1, 999999207);
    assertEquals("0", value);
    value = dao.getGeneticAlteration(geneticProfileId, sample4, 999999207);
    assertEquals("-1", value);
    value = dao.getGeneticAlteration(geneticProfileId, sample2, 999999207);
    assertEquals("0", value);
    value = dao.getGeneticAlteration(geneticProfileId, sample2, 999910000);
    assertEquals("2", value);
    value = dao.getGeneticAlteration(geneticProfileId, sample3, 999910000);
    assertEquals("2", value);

    int cnaStatus =
        Integer.parseInt(dao.getGeneticAlteration(geneticProfileId, sample3, 999910000));
    assertEquals(CopyNumberStatus.COPY_NUMBER_AMPLIFICATION, cnaStatus);
    cnaStatus = Integer.parseInt(dao.getGeneticAlteration(geneticProfileId, sample2, 999910000));
    assertEquals(CopyNumberStatus.COPY_NUMBER_AMPLIFICATION, cnaStatus);
    cnaStatus = Integer.parseInt(dao.getGeneticAlteration(geneticProfileId, sample4, 999999207));
    assertEquals(CopyNumberStatus.HEMIZYGOUS_DELETION, cnaStatus);

    Patient patient = DaoPatient.getPatientByCancerStudyAndPatientId(studyId, "TCGA-A1-A0SB");
    Sample sample =
        DaoSample.getSampleByPatientAndSampleId(patient.getInternalId(), "TCGA-A1-A0SB-01");
    assertTrue(
        DaoSampleProfile.sampleExistsInGeneticProfile(sample.getInternalId(), geneticProfileId));

    patient = DaoPatient.getPatientByCancerStudyAndPatientId(studyId, "TCGA-A1-A0SJ");
    sample = DaoSample.getSampleByPatientAndSampleId(patient.getInternalId(), "TCGA-A1-A0SJ-01");
    assertTrue(
        DaoSampleProfile.sampleExistsInGeneticProfile(sample.getInternalId(), geneticProfileId));

    ArrayList caseIds = DaoSampleProfile.getAllSampleIdsInProfile(geneticProfileId);
    assertEquals(14, caseIds.size());
  }
Ejemplo n.º 2
0
  private void runImportCnaData2() throws DaoException, IOException {

    DaoGeneticAlteration dao = DaoGeneticAlteration.getInstance();

    ProgressMonitor.setConsoleMode(false);
    // TBD: change this to use getResourceAsStream()
    File file = new File("src/test/resources/cna_test2.txt");
    ImportTabDelimData parser = new ImportTabDelimData(file, geneticProfileId, null);
    int numLines = FileUtil.getNumLines(file);
    parser.importData(numLines);

    String value = dao.getGeneticAlteration(geneticProfileId, sample1, 207);
    assertEquals(value, "0");
    value = dao.getGeneticAlteration(geneticProfileId, sample4, 207);
    assertEquals(value, "-1");
    value = dao.getGeneticAlteration(geneticProfileId, sample2, 207);
    assertEquals(value, "0");
    value = dao.getGeneticAlteration(geneticProfileId, sample2, 10000);
    assertEquals(value, "2");
    value = dao.getGeneticAlteration(geneticProfileId, sample3, 10000);
    assertEquals(value, "2");

    int cnaStatus = Integer.parseInt(dao.getGeneticAlteration(geneticProfileId, sample3, 10000));
    assertEquals(CopyNumberStatus.COPY_NUMBER_AMPLIFICATION, cnaStatus);
    cnaStatus = Integer.parseInt(dao.getGeneticAlteration(geneticProfileId, sample2, 10000));
    assertEquals(CopyNumberStatus.COPY_NUMBER_AMPLIFICATION, cnaStatus);
    cnaStatus = Integer.parseInt(dao.getGeneticAlteration(geneticProfileId, sample4, 207));
    assertEquals(CopyNumberStatus.HEMIZYGOUS_DELETION, cnaStatus);

    Patient patient = DaoPatient.getPatientByCancerStudyAndPatientId(studyId, "TCGA-A1-A0SB");
    Sample sample =
        DaoSample.getSampleByPatientAndSampleId(patient.getInternalId(), "TCGA-A1-A0SB-01");
    assertTrue(
        DaoSampleProfile.sampleExistsInGeneticProfile(sample.getInternalId(), geneticProfileId));

    patient = DaoPatient.getPatientByCancerStudyAndPatientId(studyId, "TCGA-A1-A0SJ");
    sample = DaoSample.getSampleByPatientAndSampleId(patient.getInternalId(), "TCGA-A1-A0SJ-01");
    assertTrue(
        DaoSampleProfile.sampleExistsInGeneticProfile(sample.getInternalId(), geneticProfileId));
    ArrayList sampleIds = DaoSampleProfile.getAllSampleIdsInProfile(geneticProfileId);
    assertEquals(14, sampleIds.size());
  }
Ejemplo n.º 3
0
  /**
   * Test importing of Clinical Data File.
   *
   * @throws DaoException Database Access Error.
   * @throws IOException IO Error.
   */
  @Test
  @Ignore("To be fixed")
  public void testImportClinicalDataSurvival() throws Exception {

    // TBD: change this to use getResourceAsStream()
    File clinicalFile = new File("target/test-classes/clinical_data.txt");
    ImportClinicalData importClinicalData = new ImportClinicalData(study, clinicalFile);
    importClinicalData.importData();

    LinkedHashSet<String> caseSet = new LinkedHashSet<String>();
    caseSet.add("TCGA-A1-A0SB");
    caseSet.add("TCGA-A1-A0SI");
    caseSet.add("TCGA-A1-A0SE");

    List<Patient> clinicalCaseList =
        DaoClinicalData.getSurvivalData(study.getInternalId(), caseSet);
    assertEquals(3, clinicalCaseList.size());

    Patient clinical0 = clinicalCaseList.get(0);
    assertEquals(new Double(79.04), clinical0.getAgeAtDiagnosis());
    assertEquals("DECEASED", clinical0.getOverallSurvivalStatus());
    assertEquals("Recurred/Progressed", clinical0.getDiseaseFreeSurvivalStatus());
    assertEquals(new Double(43.8), clinical0.getOverallSurvivalMonths());
    assertEquals(new Double(15.05), clinical0.getDiseaseFreeSurvivalMonths());

    Patient clinical1 = clinicalCaseList.get(1);
    assertEquals(new Double(55.53), clinical1.getAgeAtDiagnosis());
    assertEquals("LIVING", clinical1.getOverallSurvivalStatus());
    assertEquals("DiseaseFree", clinical1.getDiseaseFreeSurvivalStatus());
    assertEquals(new Double(49.02), clinical1.getOverallSurvivalMonths());
    assertEquals(new Double(49.02), clinical1.getDiseaseFreeSurvivalMonths());

    Patient clinical2 = clinicalCaseList.get(2);
    assertEquals(null, clinical2.getDiseaseFreeSurvivalMonths());
  }