use of ubic.gemma.core.analysis.preprocess.PreprocessingException in project Gemma by PavlidisLab.
the class OutlierFlaggingServiceImpl method markAsMissing.
@Override
public void markAsMissing(Collection<BioAssay> bioAssays) {
if (bioAssays == null || bioAssays.size() == 0)
return;
boolean hasNewOutliers = false;
/*
* FIXME: if there are two (or more) platforms, make sure we flag all bioassays that use the same biomaterial.
* However, we are intending to turn all multiplatform datasets into single platform ones
*/
for (BioAssay ba : bioAssays) {
if (ba.getIsOutlier()) {
continue;
}
hasNewOutliers = true;
ba.setIsOutlier(true);
bioAssayService.update(ba);
this.audit(ba, "Sample " + ba.getName() + " marked as missing data.");
}
if (!hasNewOutliers) {
System.out.println("No new outliers.");
return;
}
ExpressionExperiment expExp = expressionExperimentService.findByBioAssay(bioAssays.iterator().next());
auditTrailService.addUpdateEvent(expExp, SampleRemovalEvent.Factory.newInstance(), bioAssays.size() + " flagged as outliers", StringUtils.join(bioAssays, ","));
try {
preprocessorService.process(expExp);
} catch (PreprocessingException e) {
OutlierFlaggingServiceImpl.log.error("Error during postprocessing, make sure additional steps are completed", e);
}
}
use of ubic.gemma.core.analysis.preprocess.PreprocessingException in project Gemma by PavlidisLab.
the class TwoChannelMissingValueCLI method processExperiment.
private boolean processExperiment(ExpressionExperiment ee) {
Collection<QuantitationType> types = eeService.getQuantitationTypes(ee);
ee = this.eeService.thawLite(ee);
if (!force && this.noNeedToRun(ee, MissingValueAnalysisEvent.class))
return false;
QuantitationType previousMissingValueQt = null;
for (QuantitationType qType : types) {
if (qType.getType() == StandardQuantitationType.PRESENTABSENT) {
if (previousMissingValueQt != null) {
AbstractCLI.log.warn("More than one present/absent quantitationtype!");
}
previousMissingValueQt = qType;
}
}
if (previousMissingValueQt != null && !force) {
AbstractCLI.log.warn(ee + " already has missing value vectors, skipping");
return false;
}
if (force && previousMissingValueQt != null) {
AbstractCLI.log.info("Removing old present/absent data");
rawService.removeDataForQuantitationType(previousMissingValueQt);
procService.removeDataForQuantitationType(previousMissingValueQt);
quantitationTypeService.remove(previousMissingValueQt);
}
AbstractCLI.log.info("Got " + ee + ", thawing...");
AbstractCLI.log.info("Computing missing value data..");
Collection<RawExpressionDataVector> missingValueVectors = tcmv.computeMissingValues(ee, s2n, this.extraMissingValueIndicators);
if (missingValueVectors.size() == 0) {
AbstractCLI.log.warn("No missing value vectors computed");
return false;
}
try {
preprocessorService.process(ee, true);
} catch (PreprocessingException e) {
AbstractCLI.log.error("Error during postprocessing of " + ee + " , make sure additional steps are completed", e);
}
return true;
}
use of ubic.gemma.core.analysis.preprocess.PreprocessingException in project Gemma by PavlidisLab.
the class ExpressionExperimentFormController method onSubmit.
@Override
public ModelAndView onSubmit(HttpServletRequest request, HttpServletResponse response, Object command, BindException errors) {
ExpressionExperimentEditValueObject eeCommand = (ExpressionExperimentEditValueObject) command;
ExpressionExperiment expressionExperiment = expressionExperimentService.load(eeCommand.getId());
if (expressionExperiment == null) {
throw new IllegalArgumentException("Could not load experiment");
}
expressionExperiment = expressionExperimentService.thawLite(expressionExperiment);
/*
* Much more complicated
*/
boolean changedQT = this.updateQuantTypes(request, expressionExperiment, eeCommand.getQuantitationTypes());
boolean changedBMM = this.updateBioMaterialMap(request, expressionExperiment);
if (changedQT || changedBMM) {
try {
preprocessorService.process(expressionExperiment);
} catch (PreprocessingException e) {
throw new RuntimeException("There was an error while updating the experiment after " + "making changes to the quantitation types and/or biomaterial map.", e);
}
}
return new ModelAndView(new RedirectView("http://" + request.getServerName() + ":" + request.getServerPort() + request.getContextPath() + "/expressionExperiment/showExpressionExperiment.html?id=" + eeCommand.getId()));
}
use of ubic.gemma.core.analysis.preprocess.PreprocessingException in project Gemma by PavlidisLab.
the class OutlierFlaggingServiceImpl method unmarkAsMissing.
@Override
public void unmarkAsMissing(Collection<BioAssay> bioAssays) {
if (bioAssays.isEmpty())
return;
boolean hasReversions = false;
for (BioAssay bioAssay : bioAssays) {
if (!bioAssay.getIsOutlier()) {
continue;
}
// Rather long transaction.
hasReversions = true;
bioAssay.setIsOutlier(false);
bioAssayService.update(bioAssay);
}
if (!hasReversions) {
return;
}
ExpressionExperiment expExp = expressionExperimentService.findByBioAssay(bioAssays.iterator().next());
auditTrailService.addUpdateEvent(expExp, SampleRemovalReversionEvent.Factory.newInstance(), "Marked " + bioAssays.size() + " bioassays as non-missing", StringUtils.join(bioAssays, ""));
assert expExp != null;
// several transactions
try {
preprocessorService.process(expExp);
} catch (PreprocessingException e) {
OutlierFlaggingServiceImpl.log.error("Error during postprocessing, make sure additional steps are completed", e);
}
}
use of ubic.gemma.core.analysis.preprocess.PreprocessingException in project Gemma by PavlidisLab.
the class SimpleExpressionDataLoaderServiceImpl method create.
/**
* For use in tests.
*/
private ExpressionExperiment create(SimpleExpressionExperimentMetaData metaData, DoubleMatrix<String, String> matrix) {
ExpressionExperiment experiment = this.convert(metaData, matrix);
experiment = persisterHelper.persist(experiment, persisterHelper.prepare(experiment));
assert experiment.getShortName() != null;
try {
preprocessorService.process(experiment);
} catch (PreprocessingException e) {
SimpleExpressionDataLoaderServiceImpl.log.error("Error during postprocessing: " + e.getMessage(), e.getCause() != null ? e.getCause() : e);
}
return experiment;
}
Aggregations