use of ubic.gemma.core.loader.util.AlreadyExistsInSystemException in project Gemma by PavlidisLab.
the class SVDServiceImplTest method testsvdGapped.
/*
* See bug 2139; two different sets of bioassays in the data.
*/
@Test
public void testsvdGapped() throws Exception {
geoService.setGeoDomainObjectGenerator(new GeoDomainObjectGeneratorLocal(this.getTestFileBasePath("gse482short")));
// also used in the GeoDatasetServiceIntegrationTest.
try {
Collection<?> results = geoService.fetchAndLoad("GSE482", false, true, false);
ee = (ExpressionExperiment) results.iterator().next();
} catch (AlreadyExistsInSystemException e) {
if (e.getData() instanceof List) {
ee = (ExpressionExperiment) ((List<?>) e.getData()).iterator().next();
} else {
ee = (ExpressionExperiment) e.getData();
}
}
assertNotNull(ee);
ee = eeService.thaw(ee);
processedExpressionDataVectorService.createProcessedDataVectors(ee);
ee = eeService.findByShortName("GSE482");
assertNotNull(ee);
SVDValueObject svd = svdService.svd(ee.getId());
assertNotNull(svd);
assertNotNull(svd.getvMatrix());
assertEquals(10, svd.getBioMaterialIds().length);
}
use of ubic.gemma.core.loader.util.AlreadyExistsInSystemException in project Gemma by PavlidisLab.
the class DataUpdaterTest method testLoadRNASeqData.
/*
* More realistic test of RNA seq. GSE19166
*
*/
@Test
public void testLoadRNASeqData() throws Exception {
geoService.setGeoDomainObjectGenerator(new GeoDomainObjectGenerator());
ExpressionExperiment ee;
try {
Collection<?> results = geoService.fetchAndLoad("GSE19166", false, false, false);
ee = (ExpressionExperiment) results.iterator().next();
} catch (AlreadyExistsInSystemException e) {
ee = (ExpressionExperiment) ((List<?>) e.getData()).get(0);
}
ee = experimentService.thaw(ee);
// Load the data from a text file.
DoubleMatrixReader reader = new DoubleMatrixReader();
try (InputStream countData = this.getClass().getResourceAsStream("/data/loader/expression/flatfileload/GSE19166_expression_count.test.txt");
InputStream rpkmData = this.getClass().getResourceAsStream("/data/loader/expression/flatfileload/GSE19166_expression_RPKM.test.txt")) {
DoubleMatrix<String, String> countMatrix = reader.read(countData);
DoubleMatrix<String, String> rpkmMatrix = reader.read(rpkmData);
List<String> probeNames = countMatrix.getRowNames();
assertEquals(199, probeNames.size());
// we have to find the right generic platform to use.
targetArrayDesign = this.getTestPersistentArrayDesign(probeNames, taxonService.findByCommonName("human"));
targetArrayDesign = arrayDesignService.thaw(targetArrayDesign);
assertEquals(199, targetArrayDesign.getCompositeSequences().size());
// Main step.
dataUpdater.addCountData(ee, targetArrayDesign, countMatrix, rpkmMatrix, 36, true, false);
}
ee = experimentService.thaw(ee);
// should have: log2cpm, counts, rpkm, and counts-masked ('preferred')
assertEquals(4, ee.getQuantitationTypes().size());
for (BioAssay ba : ee.getBioAssays()) {
assertEquals(targetArrayDesign, ba.getArrayDesignUsed());
}
assertNotNull(ee.getNumberOfDataVectors());
assertEquals(199, ee.getNumberOfDataVectors().intValue());
// GSM475204 GSM475205 GSM475206 GSM475207 GSM475208 GSM475209
// 3949585 3929008 3712314 3693219 3574068 3579631
ExpressionDataDoubleMatrix mat = dataMatrixService.getProcessedExpressionDataMatrix(ee);
assertEquals(199, mat.rows());
TestUtils.assertBAs(ee, targetArrayDesign, "GSM475204", 3949585);
assertEquals(3 * 199, ee.getRawExpressionDataVectors().size());
assertEquals(199, ee.getProcessedExpressionDataVectors().size());
Collection<DoubleVectorValueObject> processedDataArrays = dataVectorService.getProcessedDataArrays(ee);
assertEquals(199, processedDataArrays.size());
for (DoubleVectorValueObject v : processedDataArrays) {
assertEquals(6, v.getBioAssays().size());
}
assertTrue(!dataVectorService.getProcessedDataVectors(experimentService.load(ee.getId())).isEmpty());
}
use of ubic.gemma.core.loader.util.AlreadyExistsInSystemException in project Gemma by PavlidisLab.
the class GeoDatasetServiceTest method testFetchAndLoadGSE1133.
/*
* Has multiple species (mouse and human, one and two platforms respectively), also test publication entry.
*/
@Test
public void testFetchAndLoadGSE1133() throws Exception {
geoService.setGeoDomainObjectGenerator(new GeoDomainObjectGeneratorLocal(this.getTestFileBasePath("gse1133Short")));
Collection<?> results;
try {
results = geoService.fetchAndLoad("GSE1133", false, true, false);
} catch (AlreadyExistsInSystemException e) {
log.warn("Test skipped because GSE1133 was not removed from the system prior to test");
return;
}
assertEquals(2, results.size());
for (Object o : results) {
ExpressionExperiment e = (ExpressionExperiment) o;
e = eeService.thawLite(e);
aclTestUtils.checkEEAcls(e);
assertNotNull(e.getPrimaryPublication());
assertEquals("6062-7", e.getPrimaryPublication().getPages());
try {
eeService.remove(e);
} catch (Exception ex) {
log.info("Failed to remove EE after test");
}
}
}
use of ubic.gemma.core.loader.util.AlreadyExistsInSystemException in project Gemma by PavlidisLab.
the class GeoDatasetServiceTest method testLoadGSE30521ExonArray.
@Test
public void testLoadGSE30521ExonArray() throws Exception {
try {
geoService.setGeoDomainObjectGenerator(new GeoDomainObjectGeneratorLocal(this.getTestFileBasePath()));
Collection<?> results = geoService.fetchAndLoad("GSE30521", false, true, false);
ee = (ExpressionExperiment) results.iterator().next();
} catch (AlreadyExistsInSystemException e) {
log.info("Test skipped because GSE30521 was already loaded - clean the DB before running the test");
return;
}
ee = this.eeService.thawLite(ee);
/*
* Should load okay, but should not load the data.
*/
try {
processedExpressionDataVectorService.computeProcessedExpressionData(ee);
fail("Should not have any data vectors for exon arrays on first loading");
} catch (Exception e) {
// OK
}
}
use of ubic.gemma.core.loader.util.AlreadyExistsInSystemException in project Gemma by PavlidisLab.
the class GeoDatasetServiceTest method testFetchAndLoadGSE37646RNASEQ.
@Test
public void testFetchAndLoadGSE37646RNASEQ() throws Exception {
geoService.setGeoDomainObjectGenerator(new GeoDomainObjectGeneratorLocal(this.getTestFileBasePath()));
try {
Collection<?> results = geoService.fetchAndLoad("GSE37646", false, true, false);
ee = (ExpressionExperiment) results.iterator().next();
aclTestUtils.checkEEAcls(ee);
} catch (AlreadyExistsInSystemException e) {
log.warn("Test skipped because GSE1133 was not removed from the system prior to test");
}
}
Aggregations