// command line utility public static void main(String[] args) throws IOException, DaoException { if (args.length != 2) { System.out.printf( "command line usage: importGistic.pl <gistic-data-file.txt> <cancer-study-id>\n" + "\t <gistic-data-file.txt> Note that gistic-data-file.txt must be a massaged file, it does not come straight from the Broad\n" + "\t <cancer-study-id> e.g. 'tcga_gbm'"); return; } SpringUtil.initDataSource(); GisticReader gisticReader = new GisticReader(); File gistic_f = new File(args[0]); int cancerStudyInternalId = gisticReader.getCancerStudyInternalId(args[1]); ProgressMonitor.setConsoleMode(false); System.out.println("Reading data from: " + gistic_f.getAbsolutePath()); System.out.println("CancerStudyId: " + cancerStudyInternalId); int lines = FileUtil.getNumLines(gistic_f); System.out.println(" --> total number of lines: " + lines); ProgressMonitor.setMaxValue(lines); ArrayList<Gistic> gistics = null; gistics = gisticReader.parse(gistic_f, cancerStudyInternalId); if (gistics == null) { System.out.println("Error: didn't get any data"); return; } // add to CGDS database for (Gistic g : gistics) { try { DaoGistic.addGistic(g); } catch (validationException e) { // only catching validationException, not DaoException logger.debug(e); } catch (DaoException e) { System.err.println(e); } } ConsoleUtil.showWarnings(); }
private void runImportRnaData1() throws DaoException, IOException { DaoGeneOptimized daoGene = DaoGeneOptimized.getInstance(); DaoGeneticAlteration dao = DaoGeneticAlteration.getInstance(); daoGene.addGene(new CanonicalGene(999999780, "A")); daoGene.addGene(new CanonicalGene(999995982, "B")); daoGene.addGene(new CanonicalGene(999993310, "C")); daoGene.addGene(new CanonicalGene(999997849, "D")); daoGene.addGene(new CanonicalGene(999992978, "E")); daoGene.addGene(new CanonicalGene(999997067, "F")); daoGene.addGene(new CanonicalGene(999911099, "G")); daoGene.addGene(new CanonicalGene(999999675, "6352")); 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/mrna_test.txt"); ImportTabDelimData parser = new ImportTabDelimData(file, newGeneticProfileId, null); int numLines = FileUtil.getNumLines(file); parser.importData(numLines); ConsoleUtil.showMessages(); int sampleId = DaoSample.getSampleByCancerStudyAndSampleId(studyId, "DD639").getInternalId(); String value = dao.getGeneticAlteration(newGeneticProfileId, sampleId, 999992978); assertEquals("2.01", value); sampleId = DaoSample.getSampleByCancerStudyAndSampleId(studyId, "DD638").getInternalId(); value = dao.getGeneticAlteration(newGeneticProfileId, sampleId, 999997849); assertEquals("0.55", value); }
/** * 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); }