Search in sources :

Example 1 with RawDataFetcher

use of ubic.gemma.core.loader.expression.geo.fetcher.RawDataFetcher 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 2 with RawDataFetcher

use of ubic.gemma.core.loader.expression.geo.fetcher.RawDataFetcher in project Gemma by PavlidisLab.

the class BatchInfoPopulationServiceImpl method needToRun.

/**
 * @param ee ee
 * @return true if it needs processing
 */
private boolean needToRun(ExpressionExperiment ee) {
    ExpressionExperimentValueObject eevo = expressionExperimentService.loadValueObject(ee);
    assert eevo != null;
    if (StringUtils.isBlank(eevo.getAccession())) {
        BatchInfoPopulationServiceImpl.log.info(ee + " lacks an external accession to use for fetching, will not attempt to fetch raw data files.");
        return false;
    }
    if (eevo.getTechnologyType().equals("NONE")) {
        BatchInfoPopulationServiceImpl.log.info(ee + " has technology type 'NONE', will not attempt to fetch raw data files");
        return false;
    }
    AuditEvent e = auditEventService.getLastEvent(ee, BatchInformationFetchingEvent.class);
    if (e == null)
        return true;
    if (FailedBatchInformationFetchingEvent.class.isAssignableFrom(e.getClass()))
        // worth trying
        return true;
    // on occasions the files appear or were missed the first time ...? GSE20842
    if (FailedBatchInformationMissingEvent.class.isAssignableFrom(e.getClass())) {
        RawDataFetcher fetcher = new RawDataFetcher();
        return fetcher.checkForFile(ee.getAccession().getAccession());
    }
    // already did it.
    return false;
}
Also used : ExpressionExperimentValueObject(ubic.gemma.model.expression.experiment.ExpressionExperimentValueObject) AuditEvent(ubic.gemma.model.common.auditAndSecurity.AuditEvent) RawDataFetcher(ubic.gemma.core.loader.expression.geo.fetcher.RawDataFetcher)

Example 3 with RawDataFetcher

use of ubic.gemma.core.loader.expression.geo.fetcher.RawDataFetcher in project Gemma by PavlidisLab.

the class BatchInfoPopulationServiceImpl method fetchRawDataFiles.

/**
 * Currently only supports GEO
 *
 * @param ee ee
 * @return local file
 */
private Collection<LocalFile> fetchRawDataFiles(ExpressionExperiment ee) {
    RawDataFetcher fetcher = new RawDataFetcher();
    DatabaseEntry accession = ee.getAccession();
    if (accession == null) {
        BatchInfoPopulationServiceImpl.log.warn("No accession for " + ee.getShortName());
        return new HashSet<>();
    }
    return fetcher.fetch(accession.getAccession());
}
Also used : DatabaseEntry(ubic.gemma.model.common.description.DatabaseEntry) RawDataFetcher(ubic.gemma.core.loader.expression.geo.fetcher.RawDataFetcher)

Example 4 with RawDataFetcher

use of ubic.gemma.core.loader.expression.geo.fetcher.RawDataFetcher 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)

Aggregations

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