Exemplo n.º 1
0
  /**
   * Test importing of data_rppa file.
   *
   * @throws Exception All Errors.
   */
  @Test
  public void testImportRppaData() throws Exception {
    MySQLbulkLoader.bulkLoadOn();

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

    // Genes with alias:
    daoGene.addGene(makeGeneWithAlias(999999931, "TESTACACA", "TESTACC1"));
    daoGene.addGene(makeGeneWithAlias(999999207, "TESTAKT1", "TESTAKT"));
    daoGene.addGene(makeGeneWithAlias(999999597, "TESTSANDER", "TESTACC1"));
    daoGene.addGene(makeGeneWithAlias(999997158, "TESTTP53BP1", "TEST53BP1"));
    // test for NA being a special case in RPPA, and not the usual alias
    daoGene.addGene(makeGeneWithAlias(999997504, "XK", "NA"));
    // Other genes:
    daoGene.addGene(new CanonicalGene(999999932, "TESTACACB"));
    daoGene.addGene(new CanonicalGene(999999208, "TESTAKT2"));
    daoGene.addGene(new CanonicalGene(999999369, "TESTARAF"));
    daoGene.addGene(new CanonicalGene(999991978, "TESTEIF4EBP1"));
    daoGene.addGene(new CanonicalGene(999995562, "TESTPRKAA1"));
    daoGene.addGene(new CanonicalGene(999997531, "TESTYWHAE"));
    daoGene.addGene(new CanonicalGene(999910000, "TESTAKT3"));
    daoGene.addGene(new CanonicalGene(999995578, "TESTPRKCA"));

    GeneticProfile geneticProfile = new GeneticProfile();

    geneticProfile.setCancerStudyId(studyId);
    geneticProfile.setStableId("gbm_rppa");
    geneticProfile.setGeneticAlterationType(GeneticAlterationType.PROTEIN_LEVEL);
    geneticProfile.setDatatype("LOG2-VALUE");
    geneticProfile.setProfileName("RPPA Data");
    geneticProfile.setProfileDescription("RPPA Data");
    DaoGeneticProfile.addGeneticProfile(geneticProfile);

    int newGeneticProfileId =
        DaoGeneticProfile.getGeneticProfileByStableId("gbm_rppa").getGeneticProfileId();

    ProgressMonitor.setConsoleMode(true);
    // TBD: change this to use getResourceAsStream()
    File file = new File("src/test/resources/tabDelimitedData/data_rppa.txt");
    ImportTabDelimData parser = new ImportTabDelimData(file, newGeneticProfileId, null);
    int numLines = FileUtil.getNumLines(file);
    parser.importData(numLines);
    ConsoleUtil.showMessages();

    int sampleId = DaoSample.getSampleByCancerStudyAndSampleId(studyId, "SAMPLE1").getInternalId();
    String value = dao.getGeneticAlteration(newGeneticProfileId, sampleId, 999997531);
    assertEquals("1.5", value);

    sampleId = DaoSample.getSampleByCancerStudyAndSampleId(studyId, "SAMPLE4").getInternalId();
    value = dao.getGeneticAlteration(newGeneticProfileId, sampleId, 999997531);
    assertEquals("2", value);

    sampleId = DaoSample.getSampleByCancerStudyAndSampleId(studyId, "SAMPLE4").getInternalId();
    value = dao.getGeneticAlteration(newGeneticProfileId, sampleId, 999997504);
    assertEquals(
        "NaN",
        value); // "NA" is not expected to be stored because of workaround for bug in firehose. See
                // also https://github.com/cBioPortal/cbioportal/issues/839#issuecomment-203523078

    sampleId = DaoSample.getSampleByCancerStudyAndSampleId(studyId, "SAMPLE1").getInternalId();
    value = dao.getGeneticAlteration(newGeneticProfileId, sampleId, 999995578);
    assertEquals("1.5", value);
  }
Exemplo n.º 2
0
 /**
  * Test importing of mrna_test file.
  *
  * @throws Exception All Errors.
  */
 @Test
 public void testImportmRnaData1BulkLoadOn() throws Exception {
   // test with both values of MySQLbulkLoader.isBulkLoad()
   MySQLbulkLoader.bulkLoadOn();
   runImportRnaData1();
 }
Exemplo n.º 3
0
  /**
   * Test importing of data_expression file.
   *
   * @throws Exception All Errors.
   */
  @Test
  public void testImportmRnaData2() throws Exception {
    MySQLbulkLoader.bulkLoadOn();

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

    // Gene with alias:
    daoGene.addGene(makeGeneWithAlias(999997504, "TESTXK", "NA"));
    // Other genes:
    daoGene.addGene(new CanonicalGene(999999999, "TESTNAT1"));

    daoGene.addGene(new CanonicalGene(999997124, "TESTTNF"));
    daoGene.addGene(new CanonicalGene(999991111, "TESTCHEK1"));
    daoGene.addGene(new CanonicalGene(999999919, "TESTABCA1"));
    // will get generated negative id:
    daoGene.addGene(new CanonicalGene(-1, "TESTphosphoprotein"));

    GeneticProfile geneticProfile = new GeneticProfile();

    geneticProfile.setCancerStudyId(studyId);
    geneticProfile.setStableId("gbm_mrna");
    geneticProfile.setGeneticAlterationType(GeneticAlterationType.MRNA_EXPRESSION);
    geneticProfile.setDatatype("CONTINUOUS");
    geneticProfile.setProfileName("MRNA Data");
    geneticProfile.setProfileDescription("mRNA Data");
    DaoGeneticProfile.addGeneticProfile(geneticProfile);

    int newGeneticProfileId =
        DaoGeneticProfile.getGeneticProfileByStableId("gbm_mrna").getGeneticProfileId();

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

    // check if expected warnings are given:
    ArrayList<String> warnings = ProgressMonitor.getWarnings();
    int countDuplicatedRowWarnings = 0;
    int countInvalidEntrez = 0;
    int countSkippedWarnings = 0;
    for (String warning : warnings) {
      if (warning.contains("Duplicated row")) {
        countDuplicatedRowWarnings++;
      }
      if (warning.contains("invalid Entrez_Id")) {
        // invalid Entrez
        countInvalidEntrez++;
      }
      if (warning.contains("Record will be skipped")) {
        // Entrez is a valid number, but not found
        countSkippedWarnings++;
      }
    }
    // check that we have 11 warning messages:
    assertEquals(2, countDuplicatedRowWarnings);
    assertEquals(3, countInvalidEntrez);
    assertEquals(6, countSkippedWarnings);

    Set<Long> entrezGeneIds = DaoGeneticAlteration.getGenesIdInProfile(newGeneticProfileId);
    // data will be loaded for 5 of the genes
    assertEquals(5, entrezGeneIds.size());
    HashMap<Long, HashMap<Integer, String>> dataMap =
        dao.getGeneticAlterationMap(newGeneticProfileId, entrezGeneIds);
    assertEquals(5, dataMap.entrySet().size());

    int sampleId = DaoSample.getSampleByCancerStudyAndSampleId(studyId, "SAMPLE1").getInternalId();
    String value = dao.getGeneticAlteration(newGeneticProfileId, sampleId, 999997124);
    assertEquals("770", value);

    sampleId = DaoSample.getSampleByCancerStudyAndSampleId(studyId, "SAMPLE3").getInternalId();
    value = dao.getGeneticAlteration(newGeneticProfileId, sampleId, 999997124);
    assertEquals("220", value);

    // gene should also be loaded via its alias "NA" as defined above:
    sampleId = DaoSample.getSampleByCancerStudyAndSampleId(studyId, "SAMPLE3").getInternalId();
    value = dao.getGeneticAlteration(newGeneticProfileId, sampleId, 999997504);
    assertEquals("9940", value);
  }
Exemplo n.º 4
0
 /**
  * Test importing of cna_test.txt file.
  *
  * @throws Exception All Errors.
  */
 @Test
 public void testImportCnaDataBulkLoadOn() throws Exception {
   MySQLbulkLoader.bulkLoadOn();
   runImportCnaData();
 }