コード例 #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());
  }
コード例 #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());
  }