use of ubic.gemma.model.expression.experiment.ExpressionExperiment in project Gemma by PavlidisLab.
the class DifferentialExpressionAnalysisCli method doWork.
@Override
protected Exception doWork(String[] args) {
Exception err = this.processCommandLine(args);
if (err != null) {
return err;
}
SecurityService securityService = this.getBean(SecurityService.class);
for (BioAssaySet ee : expressionExperiments) {
if (!(ee instanceof ExpressionExperiment)) {
continue;
}
if (expressionExperiments.size() > 1) {
AbstractCLI.log.info(">>>>>> Begin processing: " + ee);
}
/*
* This is really only important when running as admin and in a batch mode.
*/
AbstractCLI.log.debug(securityService.getOwner(ee));
if (!securityService.isOwnedByCurrentUser(ee) && this.expressionExperiments.size() > 1) {
AbstractCLI.log.warn("Experiment is not owned by current user, skipping: " + ee);
continue;
}
this.processExperiment((ExpressionExperiment) ee);
}
this.summarizeProcessing();
return null;
}
use of ubic.gemma.model.expression.experiment.ExpressionExperiment in project Gemma by PavlidisLab.
the class SVDServiceHelperImpl method getTopLoadedVectors.
@Override
public Map<ProbeLoading, DoubleVectorValueObject> getTopLoadedVectors(ExpressionExperiment ee, int component, int count) {
PrincipalComponentAnalysis pca = principalComponentAnalysisService.loadForExperiment(ee);
Map<ProbeLoading, DoubleVectorValueObject> result = new HashMap<>();
if (pca == null) {
return result;
}
List<ProbeLoading> topLoadedProbes = principalComponentAnalysisService.getTopLoadedProbes(ee, component, count);
if (topLoadedProbes == null) {
SVDServiceHelperImpl.log.warn("No probes?");
return result;
}
Map<Long, ProbeLoading> probes = new LinkedHashMap<>();
Set<CompositeSequence> p = new HashSet<>();
for (ProbeLoading probeLoading : topLoadedProbes) {
CompositeSequence probe = probeLoading.getProbe();
probes.put(probe.getId(), probeLoading);
p.add(probe);
}
if (probes.isEmpty())
return result;
assert probes.size() <= count;
Collection<ExpressionExperiment> ees = new HashSet<>();
ees.add(ee);
Collection<DoubleVectorValueObject> dvVos = processedExpressionDataVectorService.getProcessedDataArraysByProbe(ees, p);
if (dvVos.isEmpty()) {
SVDServiceHelperImpl.log.warn("No vectors came back from the call; check the Gene2CS table?");
return result;
}
// note that this might have come from a cache.
/*
* This is actually expected, because we go through the genes.
*/
BioAssayDimension bioAssayDimension = pca.getBioAssayDimension();
assert bioAssayDimension != null;
assert !bioAssayDimension.getBioAssays().isEmpty();
for (DoubleVectorValueObject vct : dvVos) {
ProbeLoading probeLoading = probes.get(vct.getDesignElement().getId());
if (probeLoading == null) {
/*
* This is okay, we will skip this probe. It was another probe for a gene that _was_ highly loaded.
*/
continue;
}
assert bioAssayDimension.getBioAssays().size() == vct.getData().length;
vct.setRank(probeLoading.getLoadingRank().doubleValue());
vct.setExpressionExperiment(new ExpressionExperimentValueObject(ee));
result.put(probeLoading, vct);
}
if (result.isEmpty()) {
SVDServiceHelperImpl.log.warn("No results, something went wrong; there were " + dvVos.size() + " vectors to start but they all got filtered out.");
}
return result;
}
use of ubic.gemma.model.expression.experiment.ExpressionExperiment in project Gemma by PavlidisLab.
the class WhatsNewServiceImpl method addAllEEs.
private void addAllEEs(Date date, Collection<ExpressionExperiment> ees, Collection<AuditableObject> newObjects) {
for (ExpressionExperiment ee : ees) {
AuditableObject ao = new AuditableObject();
ao.date = date;
ao.type = "ExpressionExperiment";
ao.id = ee.getId();
newObjects.add(ao);
}
}
use of ubic.gemma.model.expression.experiment.ExpressionExperiment in project Gemma by PavlidisLab.
the class GeoDatasetServiceTest method testFetchAndLoadMultiChipPerSeriesShort.
@Test
public void testFetchAndLoadMultiChipPerSeriesShort() throws Exception {
geoService.setGeoDomainObjectGenerator(new GeoDomainObjectGeneratorLocal(this.getTestFileBasePath("shortTest")));
/*
* HG-U133A. GDS473 is for the other chip (B). Series is GSE674. see
* http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?db=gds&term=GSE674[Accession]&cmd=search
*/
ExpressionExperiment newee;
try {
Collection<?> results = geoService.fetchAndLoad("GSE674", false, true, false);
newee = (ExpressionExperiment) results.iterator().next();
} catch (AlreadyExistsInSystemException e) {
log.info("Skipping test, data already exists in db");
return;
}
assertNotNull(newee);
newee = eeService.thaw(newee);
/*
* Test for bug 468 (merging of subsets across GDS's)
*/
ExperimentalFactor factor = newee.getExperimentalDesign().getExperimentalFactors().iterator().next();
// otherwise get 4.
assertEquals(2, factor.getFactorValues().size());
Collection<RawExpressionDataVector> vectors = newee.getRawExpressionDataVectors();
rawExpressionDataVectorService.thaw(vectors);
ExpressionDataMatrixBuilder builder = new ExpressionDataMatrixBuilder(vectors);
ExpressionDataMatrix<Double> matrix = builder.getPreferredData();
assertNotNull(matrix);
assertEquals(31, matrix.rows());
assertEquals(15, matrix.columns());
// GSM10363 = D1-U133B
this.testMatrixValue(newee, matrix, "200000_s_at", "GSM10363", 5722.0);
// GSM10380 = C7-U133A
this.testMatrixValue(newee, matrix, "1007_s_at", "GSM10380", 1272.0);
}
use of ubic.gemma.model.expression.experiment.ExpressionExperiment in project Gemma by PavlidisLab.
the class GeoSuperSeriesLoadTest method removeOldData.
private void removeOldData(ExpressionExperiment ee2) {
Collection<ArrayDesign> arrayDesignsUsed = ees.getArrayDesignsUsed(ee2);
ees.remove(ee2);
for (ArrayDesign ad : arrayDesignsUsed) {
for (ExpressionExperiment ee3 : adService.getExpressionExperiments(ad)) {
this.removeOldData(ee3);
}
for (ArrayDesign aa : ad.getMergees()) {
adService.remove(aa);
}
adService.remove(ad);
}
}
Aggregations