use of ubic.gemma.core.loader.util.AlreadyExistsInSystemException in project Gemma by PavlidisLab.
the class BaselineDetectionTest method setUp.
@Before
public void setUp() throws Exception {
String path = FileTools.resourceToPath("/data/loader/expression/geo/gse18162Short");
try {
geoService.setGeoDomainObjectGenerator(new GeoDomainObjectGeneratorLocal(path));
Collection<?> results = geoService.fetchAndLoad("GSE18162", false, true, false);
ee = (ExpressionExperiment) results.iterator().next();
} catch (AlreadyExistsInSystemException e) {
// OK.
if (e.getData() instanceof List) {
ee = (ExpressionExperiment) ((List<?>) e.getData()).iterator().next();
} else {
ee = (ExpressionExperiment) e.getData();
}
}
ee = this.eeService.thawLite(ee);
if (ee.getExperimentalDesign().getExperimentalFactors().isEmpty()) {
ee = eeService.load(ee.getId());
ee = this.eeService.thawLite(ee);
try (InputStream is = this.getClass().getResourceAsStream("/data/loader/expression/geo/gse18162Short/design.txt")) {
experimentalDesignImporter.importDesign(ee, is);
}
ee = eeService.load(ee.getId());
ee = this.eeService.thawLite(ee);
}
// end setup
}
use of ubic.gemma.core.loader.util.AlreadyExistsInSystemException in project Gemma by PavlidisLab.
the class DiffExMetaAnalyzerServiceTest method loadSet.
private void loadSet(String acc) throws Exception {
String path = new File(this.getClass().getResource("/data/loader/expression/geo/meta-analysis").toURI()).getAbsolutePath();
geoService.setGeoDomainObjectGenerator(new GeoDomainObjectGeneratorLocal(path));
try {
geoService.fetchAndLoad(acc, false, true, false);
} catch (AlreadyExistsInSystemException ignored) {
log.info("Set already exists in system.");
}
}
use of ubic.gemma.core.loader.util.AlreadyExistsInSystemException in project Gemma by PavlidisLab.
the class DiffExWithInvalidInteraction2Test method setup.
@Before
public void setup() throws Exception {
geoService.setGeoDomainObjectGenerator(new GeoDomainObjectGeneratorLocal(FileTools.resourceToPath("/data/analysis/expression")));
try {
Collection<?> results = geoService.fetchAndLoad("GSE37301", false, true, false);
ee = (ExpressionExperiment) results.iterator().next();
} catch (AlreadyExistsInSystemException e) {
ee = (ExpressionExperiment) ((Collection<?>) e.getData()).iterator().next();
}
ee = expressionExperimentService.thawLite(ee);
Collection<ExperimentalFactor> toremove = new HashSet<>(ee.getExperimentalDesign().getExperimentalFactors());
for (ExperimentalFactor ef : toremove) {
experimentalFactorService.delete(ef);
ee.getExperimentalDesign().getExperimentalFactors().remove(ef);
}
expressionExperimentService.update(ee);
processedExpressionDataVectorService.computeProcessedExpressionData(ee);
ee = expressionExperimentService.thaw(ee);
designImporter.importDesign(ee, this.getClass().getResourceAsStream("/data/analysis/expression/7737_GSE37301_expdesign.data.txt"));
}
use of ubic.gemma.core.loader.util.AlreadyExistsInSystemException in project Gemma by PavlidisLab.
the class SVDServiceImplTest method testsvd.
@Test
public void testsvd() throws Exception {
geoService.setGeoDomainObjectGenerator(new GeoDomainObjectGeneratorLocal(this.getTestFileBasePath("shortTest")));
// also used in the GeoDatasetServiceIntegrationTest.
try {
Collection<?> results = geoService.fetchAndLoad("GSE674", false, true, false);
ee = (ExpressionExperiment) results.iterator().next();
} catch (AlreadyExistsInSystemException e) {
ee = (ExpressionExperiment) ((Collection<?>) e.getData()).iterator().next();
}
assertNotNull(ee);
ee = eeService.thaw(ee);
processedExpressionDataVectorService.createProcessedDataVectors(ee);
ee = eeService.findByShortName("GSE674");
assertNotNull(ee);
SVDValueObject svd = svdService.svd(ee.getId());
assertNotNull(svd);
assertNotNull(svd.getvMatrix());
assertEquals(5, svd.getFactorCorrelations().size());
analysisUtilService.deleteOldAnalyses(ee);
}
use of ubic.gemma.core.loader.util.AlreadyExistsInSystemException in project Gemma by PavlidisLab.
the class ExpressionDataDoubleMatrixTest method testMatrixConversion.
@Test
public void testMatrixConversion() throws Exception {
try {
geoService.setGeoDomainObjectGenerator(new GeoDomainObjectGeneratorLocal(this.getTestFileBasePath("")));
Collection<?> results = geoService.fetchAndLoad("GSE8294", false, true, false);
newee = (ExpressionExperiment) results.iterator().next();
} catch (AlreadyExistsInSystemException e) {
newee = (ExpressionExperiment) ((List<?>) e.getData()).iterator().next();
}
newee = expressionExperimentService.thaw(newee);
// make sure we really thawRawAndProcessed them, so we can get the design element sequences.
Collection<RawExpressionDataVector> vectors = newee.getRawExpressionDataVectors();
rawExpressionDataVectorService.thaw(vectors);
ExpressionDataMatrixBuilder builder = new ExpressionDataMatrixBuilder(vectors);
ExpressionDataDoubleMatrix matrix = builder.getPreferredData();
assertTrue(!Double.isNaN(matrix.get(10, 0)));
assertEquals(66, matrix.rows());
assertEquals(9, matrix.columns());
/*
* Additional tests for files and outlier marking.
*/
processedDataVectorService.computeProcessedExpressionData(newee);
File f1 = expressionDataFileService.writeOrLocateDataFile(expressionExperimentService.load(newee.getId()), true, true);
assertNotNull(f1);
assertTrue(f1.exists());
expressionDataFileService.deleteAllFiles(newee);
assertTrue(!f1.exists());
/*
* outlier removal.
*/
BioAssay tba = newee.getBioAssays().iterator().next();
Collection<BioAssay> ol = new HashSet<>();
ol.add(tba);
sampleRemoveService.markAsMissing(ol);
assertTrue(tba.getIsOutlier());
newee = expressionExperimentService.thaw(newee);
Collection<ProcessedExpressionDataVector> vecs = newee.getProcessedExpressionDataVectors();
this.processedDataVectorService.thaw(vecs);
assertTrue(!vecs.isEmpty());
ExpressionDataMatrixBuilder matrixBuilder = new ExpressionDataMatrixBuilder(vecs);
ExpressionDataDoubleMatrix data = matrixBuilder.getProcessedData();
assertNotNull(data);
assertTrue(Double.isNaN(data.getColumn(tba)[10]));
sampleRemoveService.unmarkAsMissing(ol);
newee = expressionExperimentService.load(newee.getId());
newee = expressionExperimentService.thaw(newee);
vecs = newee.getProcessedExpressionDataVectors();
this.processedDataVectorService.thaw(vecs);
assertTrue(!vecs.isEmpty());
matrixBuilder = new ExpressionDataMatrixBuilder(vecs);
data = matrixBuilder.getProcessedData();
assertTrue(!tba.getIsOutlier());
assertTrue(!Double.isNaN(data.getColumn(tba)[10]));
}
Aggregations