use of ubic.gemma.core.loader.expression.AffyPowerToolsProbesetSummarize in project Gemma by PavlidisLab.
the class DataUpdater method addAffyExonArrayData.
/**
* Use when we want to avoid downloading the CEL files etc. For example if GEO doesn't have them and we ran
* apt-probeset-summarize ourselves. Must be single-platform
*
* @param ee ee
* @param pathToAptOutputFile file
*/
public void addAffyExonArrayData(ExpressionExperiment ee, String pathToAptOutputFile) throws IOException {
Collection<ArrayDesign> ads = experimentService.getArrayDesignsUsed(ee);
if (ads.size() > 1) {
throw new IllegalArgumentException("Can't handle experiments with more than one platform when passing APT output file");
}
ArrayDesign ad = ads.iterator().next();
ad = arrayDesignService.thaw(ad);
ee = experimentService.thawLite(ee);
Taxon primaryTaxon = ad.getPrimaryTaxon();
ArrayDesign targetPlatform = this.prepareTargetPlatformForExonArrays(primaryTaxon);
AffyPowerToolsProbesetSummarize apt = new AffyPowerToolsProbesetSummarize();
Collection<RawExpressionDataVector> vectors = apt.processData(ee, pathToAptOutputFile, targetPlatform);
if (vectors.isEmpty()) {
throw new IllegalStateException("No vectors were returned for " + ee);
}
experimentService.replaceRawVectors(ee, vectors);
if (!targetPlatform.equals(ad)) {
AuditEventType eventType = ExpressionExperimentPlatformSwitchEvent.Factory.newInstance();
auditTrailService.addUpdateEvent(ee, eventType, "Switched in course of updating vectors using AffyPowerTools (from " + ad.getShortName() + " to " + targetPlatform.getShortName() + ")");
}
this.audit(ee, "Data vector input from APT output file " + pathToAptOutputFile + " on " + targetPlatform, true);
this.postprocess(ee);
}
use of ubic.gemma.core.loader.expression.AffyPowerToolsProbesetSummarize in project Gemma by PavlidisLab.
the class DataUpdater method addAffyExonArrayData.
/**
* Replaces any existing "preferred" data. Must be a single-platform study
*
* @param ee ee
* @param ad ad
*/
// Possible external use
@SuppressWarnings({ "unused", "WeakerAccess" })
public void addAffyExonArrayData(ExpressionExperiment ee, ArrayDesign ad) {
RawDataFetcher f = new RawDataFetcher();
Collection<LocalFile> files = f.fetch(ee.getAccession().getAccession());
if (files.isEmpty()) {
throw new RuntimeException("Data was apparently not available");
}
ad = arrayDesignService.thaw(ad);
ee = experimentService.thawLite(ee);
Taxon primaryTaxon = ad.getPrimaryTaxon();
ArrayDesign targetPlatform = this.prepareTargetPlatformForExonArrays(primaryTaxon);
assert !targetPlatform.getCompositeSequences().isEmpty();
AffyPowerToolsProbesetSummarize apt = new AffyPowerToolsProbesetSummarize();
Collection<RawExpressionDataVector> vectors = apt.processExonArrayData(ee, targetPlatform, files);
if (vectors.isEmpty()) {
throw new IllegalStateException("No vectors were returned for " + ee);
}
ee = experimentService.replaceRawVectors(ee, vectors);
if (!targetPlatform.equals(ad)) {
AuditEventType eventType = ExpressionExperimentPlatformSwitchEvent.Factory.newInstance();
auditTrailService.addUpdateEvent(ee, eventType, "Switched in course of updating vectors using AffyPowerTools (from " + ad.getShortName() + " to " + targetPlatform.getShortName() + ")");
}
this.audit(ee, "Data vector computation from CEL files using AffyPowerTools for " + targetPlatform, true);
this.postprocess(ee);
}
use of ubic.gemma.core.loader.expression.AffyPowerToolsProbesetSummarize in project Gemma by PavlidisLab.
the class DataUpdater method reprocessAffyThreePrimeArrayData.
/**
* @param ee ee
* @return This replaces the existing raw data with the CEL file data. CEL file(s) must be found by configuration
*/
// Possible external use
@SuppressWarnings("UnusedReturnValue")
public ExpressionExperiment reprocessAffyThreePrimeArrayData(ExpressionExperiment ee) {
Collection<ArrayDesign> arrayDesignsUsed = this.experimentService.getArrayDesignsUsed(ee);
ee = experimentService.thawLite(ee);
RawDataFetcher f = new RawDataFetcher();
Collection<LocalFile> files = f.fetch(ee.getAccession().getAccession());
if (files.isEmpty()) {
throw new RuntimeException("Data was apparently not available");
}
Collection<RawExpressionDataVector> vectors = new HashSet<>();
// Use the same QT for each one
QuantitationType qt = AffyPowerToolsProbesetSummarize.makeAffyQuantitationType();
qt = quantitationTypeService.create(qt);
for (ArrayDesign ad : arrayDesignsUsed) {
DataUpdater.log.info("Processing data for " + ad);
String cdfFileName = this.findCdf(ad).getAbsolutePath();
ad = arrayDesignService.thaw(ad);
AffyPowerToolsProbesetSummarize apt = new AffyPowerToolsProbesetSummarize(qt);
vectors.addAll(apt.processThreeprimeArrayData(ee, cdfFileName, ad, files));
}
if (vectors.isEmpty()) {
throw new IllegalStateException("No vectors were returned for " + ee);
}
ee = experimentService.replaceRawVectors(ee, vectors);
this.audit(ee, "Data vector computation from CEL files using AffyPowerTools for " + StringUtils.join(arrayDesignsUsed, "; "), true);
if (arrayDesignsUsed.size() == 1) {
this.postprocess(ee);
} else {
DataUpdater.log.warn("Skipping postprocessing for mult-platform experiment");
}
return ee;
}
use of ubic.gemma.core.loader.expression.AffyPowerToolsProbesetSummarize in project Gemma by PavlidisLab.
the class DataUpdater method addAffyData.
/**
* For 3' arrays. This only works for single-platform experiments.
*
* @param ee ee
* @param pathToAptOutputFile file
*/
public void addAffyData(ExpressionExperiment ee, String pathToAptOutputFile) throws IOException {
Collection<ArrayDesign> ads = experimentService.getArrayDesignsUsed(ee);
if (ads.size() > 1) {
throw new IllegalArgumentException("Can't handle experiments with more than one platform when passing APT output file.");
}
ArrayDesign ad = ads.iterator().next();
ad = arrayDesignService.thaw(ad);
ee = experimentService.thawLite(ee);
AffyPowerToolsProbesetSummarize apt = new AffyPowerToolsProbesetSummarize();
Collection<RawExpressionDataVector> vectors = apt.processData(ee, pathToAptOutputFile, ad);
if (vectors.isEmpty()) {
throw new IllegalStateException("No vectors were returned for " + ee);
}
experimentService.replaceRawVectors(ee, vectors);
this.audit(ee, "Data vector input from APT output file " + pathToAptOutputFile + " on " + ad, true);
this.postprocess(ee);
}
Aggregations