Search in sources :

Example 1 with AffyPowerToolsProbesetSummarize

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);
}
Also used : RawExpressionDataVector(ubic.gemma.model.expression.bioAssayData.RawExpressionDataVector) AuditEventType(ubic.gemma.model.common.auditAndSecurity.eventType.AuditEventType) ArrayDesign(ubic.gemma.model.expression.arrayDesign.ArrayDesign) Taxon(ubic.gemma.model.genome.Taxon) AffyPowerToolsProbesetSummarize(ubic.gemma.core.loader.expression.AffyPowerToolsProbesetSummarize)

Example 2 with AffyPowerToolsProbesetSummarize

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);
}
Also used : LocalFile(ubic.gemma.model.common.description.LocalFile) RawExpressionDataVector(ubic.gemma.model.expression.bioAssayData.RawExpressionDataVector) AuditEventType(ubic.gemma.model.common.auditAndSecurity.eventType.AuditEventType) ArrayDesign(ubic.gemma.model.expression.arrayDesign.ArrayDesign) Taxon(ubic.gemma.model.genome.Taxon) AffyPowerToolsProbesetSummarize(ubic.gemma.core.loader.expression.AffyPowerToolsProbesetSummarize) RawDataFetcher(ubic.gemma.core.loader.expression.geo.fetcher.RawDataFetcher)

Example 3 with AffyPowerToolsProbesetSummarize

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;
}
Also used : ArrayDesign(ubic.gemma.model.expression.arrayDesign.ArrayDesign) AffyPowerToolsProbesetSummarize(ubic.gemma.core.loader.expression.AffyPowerToolsProbesetSummarize) LocalFile(ubic.gemma.model.common.description.LocalFile) RawExpressionDataVector(ubic.gemma.model.expression.bioAssayData.RawExpressionDataVector) RawDataFetcher(ubic.gemma.core.loader.expression.geo.fetcher.RawDataFetcher)

Example 4 with AffyPowerToolsProbesetSummarize

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);
}
Also used : RawExpressionDataVector(ubic.gemma.model.expression.bioAssayData.RawExpressionDataVector) ArrayDesign(ubic.gemma.model.expression.arrayDesign.ArrayDesign) AffyPowerToolsProbesetSummarize(ubic.gemma.core.loader.expression.AffyPowerToolsProbesetSummarize)

Aggregations

AffyPowerToolsProbesetSummarize (ubic.gemma.core.loader.expression.AffyPowerToolsProbesetSummarize)4 ArrayDesign (ubic.gemma.model.expression.arrayDesign.ArrayDesign)4 RawExpressionDataVector (ubic.gemma.model.expression.bioAssayData.RawExpressionDataVector)4 RawDataFetcher (ubic.gemma.core.loader.expression.geo.fetcher.RawDataFetcher)2 AuditEventType (ubic.gemma.model.common.auditAndSecurity.eventType.AuditEventType)2 LocalFile (ubic.gemma.model.common.description.LocalFile)2 Taxon (ubic.gemma.model.genome.Taxon)2