Search in sources :

Example 11 with ProcessedExpressionDataVector

use of ubic.gemma.model.expression.bioAssayData.ProcessedExpressionDataVector in project Gemma by PavlidisLab.

the class ExpressionExperimentDaoImpl method removeProcessedVectors.

private void removeProcessedVectors(Session session, Set<BioAssayDimension> dims, Set<QuantitationType> qts, int count, Collection<ProcessedExpressionDataVector> processedVectors) {
    for (ProcessedExpressionDataVector dv : processedVectors) {
        BioAssayDimension bad = dv.getBioAssayDimension();
        dims.add(bad);
        QuantitationType qt = dv.getQuantitationType();
        qts.add(qt);
        dv.setBioAssayDimension(null);
        dv.setQuantitationType(null);
        session.delete(dv);
        if (++count % 1000 == 0) {
            session.flush();
        }
        if (count % 20000 == 0) {
            AbstractDao.log.info(count + " processed design Element data vectors deleted");
        }
        // put back..
        dv.setBioAssayDimension(bad);
        dv.setQuantitationType(qt);
    }
}
Also used : BioAssayDimension(ubic.gemma.model.expression.bioAssayData.BioAssayDimension) ProcessedExpressionDataVector(ubic.gemma.model.expression.bioAssayData.ProcessedExpressionDataVector) QuantitationType(ubic.gemma.model.common.quantitationtype.QuantitationType)

Example 12 with ProcessedExpressionDataVector

use of ubic.gemma.model.expression.bioAssayData.ProcessedExpressionDataVector in project Gemma by PavlidisLab.

the class QuantitationTypeData method getPreferredDataVectors.

/**
 * @return The 'preferred' data vectors - NOT the processed data vectors!
 */
private Collection<DesignElementDataVector> getPreferredDataVectors() {
    Collection<DesignElementDataVector> result = new HashSet<>();
    List<BioAssayDimension> dimensions = this.getBioAssayDimensions();
    List<QuantitationType> qtypes = this.getPreferredQTypes();
    for (DesignElementDataVector vector : vectors) {
        if (!(vector instanceof ProcessedExpressionDataVector) && dimensions.contains(vector.getBioAssayDimension()) && qtypes.contains(vector.getQuantitationType()))
            result.add(vector);
    }
    return result;
}
Also used : BioAssayDimension(ubic.gemma.model.expression.bioAssayData.BioAssayDimension) ProcessedExpressionDataVector(ubic.gemma.model.expression.bioAssayData.ProcessedExpressionDataVector) DesignElementDataVector(ubic.gemma.model.expression.bioAssayData.DesignElementDataVector) QuantitationType(ubic.gemma.model.common.quantitationtype.QuantitationType) StandardQuantitationType(ubic.gemma.model.common.quantitationtype.StandardQuantitationType)

Example 13 with ProcessedExpressionDataVector

use of ubic.gemma.model.expression.bioAssayData.ProcessedExpressionDataVector in project Gemma by PavlidisLab.

the class QuantitationTypeData method getProcessedDataVectors.

/**
 * @return Collection of <em>ProcessedExpressionDataVector</em>s.
 */
private Collection<ProcessedExpressionDataVector> getProcessedDataVectors() {
    if (this.processedDataVectors != null) {
        return this.processedDataVectors;
    }
    Collection<ProcessedExpressionDataVector> result = new HashSet<>();
    List<BioAssayDimension> dimensions = this.getBioAssayDimensions();
    List<QuantitationType> qtypes = this.getPreferredQTypes();
    for (DesignElementDataVector vector : vectors) {
        if (vector instanceof ProcessedExpressionDataVector && dimensions.contains(vector.getBioAssayDimension()) && qtypes.contains(vector.getQuantitationType()))
            result.add((ProcessedExpressionDataVector) vector);
    }
    return result;
}
Also used : BioAssayDimension(ubic.gemma.model.expression.bioAssayData.BioAssayDimension) ProcessedExpressionDataVector(ubic.gemma.model.expression.bioAssayData.ProcessedExpressionDataVector) DesignElementDataVector(ubic.gemma.model.expression.bioAssayData.DesignElementDataVector) QuantitationType(ubic.gemma.model.common.quantitationtype.QuantitationType) StandardQuantitationType(ubic.gemma.model.common.quantitationtype.StandardQuantitationType)

Example 14 with ProcessedExpressionDataVector

use of ubic.gemma.model.expression.bioAssayData.ProcessedExpressionDataVector in project Gemma by PavlidisLab.

the class ProcessedExpressionDataVectorCreateHelperServiceImpl method updateRanks.

/**
 * @return expression ranks based on computed intensities
 */
@Override
public ExpressionExperiment updateRanks(ExpressionExperiment ee) {
    ee = expressionExperimentDao.thaw(ee);
    Collection<ProcessedExpressionDataVector> processedVectors = ee.getProcessedExpressionDataVectors();
    processedExpressionDataVectorService.thaw(processedVectors);
    StopWatch timer = new StopWatch();
    timer.start();
    ExpressionDataDoubleMatrix intensities = this.loadIntensities(ee, processedVectors);
    if (intensities == null) {
        return ee;
    }
    ProcessedExpressionDataVectorCreateHelperServiceImpl.log.info("Load intensities: " + timer.getTime() + "ms");
    Collection<ProcessedExpressionDataVector> updatedVectors = this.computeRanks(processedVectors, intensities);
    if (updatedVectors == null) {
        ProcessedExpressionDataVectorCreateHelperServiceImpl.log.info("Could not get preferred data vectors, not updating ranks data");
        return ee;
    }
    ProcessedExpressionDataVectorCreateHelperServiceImpl.log.info("Updating ranks data for " + updatedVectors.size() + " vectors ...");
    this.processedExpressionDataVectorService.update(updatedVectors);
    ProcessedExpressionDataVectorCreateHelperServiceImpl.log.info("Done");
    return ee;
}
Also used : ProcessedExpressionDataVector(ubic.gemma.model.expression.bioAssayData.ProcessedExpressionDataVector) StopWatch(org.apache.commons.lang3.time.StopWatch)

Example 15 with ProcessedExpressionDataVector

use of ubic.gemma.model.expression.bioAssayData.ProcessedExpressionDataVector in project Gemma by PavlidisLab.

the class ProcessedExpressionDataVectorCreateHelperServiceImpl method computeRanks.

private Collection<ProcessedExpressionDataVector> computeRanks(Collection<ProcessedExpressionDataVector> processedDataVectors, ExpressionDataDoubleMatrix intensities) {
    DoubleArrayList ranksByMean = this.getRanks(intensities, ProcessedExpressionDataVectorDao.RankMethod.mean);
    assert ranksByMean != null;
    DoubleArrayList ranksByMax = this.getRanks(intensities, ProcessedExpressionDataVectorDao.RankMethod.max);
    assert ranksByMax != null;
    for (ProcessedExpressionDataVector vector : processedDataVectors) {
        CompositeSequence de = vector.getDesignElement();
        if (intensities.getRow(de) == null) {
            ProcessedExpressionDataVectorCreateHelperServiceImpl.log.warn("No intensity value for " + de + ", rank for vector will be null");
            vector.setRankByMean(null);
            vector.setRankByMax(null);
            continue;
        }
        Integer i = intensities.getRowIndex(de);
        double rankByMean = ranksByMean.get(i) / ranksByMean.size();
        double rankByMax = ranksByMax.get(i) / ranksByMax.size();
        vector.setRankByMean(rankByMean);
        vector.setRankByMax(rankByMax);
    }
    return processedDataVectors;
}
Also used : ProcessedExpressionDataVector(ubic.gemma.model.expression.bioAssayData.ProcessedExpressionDataVector) DoubleArrayList(cern.colt.list.DoubleArrayList) CompositeSequence(ubic.gemma.model.expression.designElement.CompositeSequence)

Aggregations

ProcessedExpressionDataVector (ubic.gemma.model.expression.bioAssayData.ProcessedExpressionDataVector)26 QuantitationType (ubic.gemma.model.common.quantitationtype.QuantitationType)10 BioAssayDimension (ubic.gemma.model.expression.bioAssayData.BioAssayDimension)9 Test (org.junit.Test)8 AbstractGeoServiceTest (ubic.gemma.core.loader.expression.geo.AbstractGeoServiceTest)8 GeoDomainObjectGeneratorLocal (ubic.gemma.core.loader.expression.geo.GeoDomainObjectGeneratorLocal)8 CompositeSequence (ubic.gemma.model.expression.designElement.CompositeSequence)7 AlreadyExistsInSystemException (ubic.gemma.core.loader.util.AlreadyExistsInSystemException)6 BioAssay (ubic.gemma.model.expression.bioAssay.BioAssay)6 ByteArrayConverter (ubic.basecode.io.ByteArrayConverter)5 ExpressionDataDoubleMatrix (ubic.gemma.core.datastructure.matrix.ExpressionDataDoubleMatrix)5 DesignElementDataVector (ubic.gemma.model.expression.bioAssayData.DesignElementDataVector)5 RawExpressionDataVector (ubic.gemma.model.expression.bioAssayData.RawExpressionDataVector)5 ExpressionExperiment (ubic.gemma.model.expression.experiment.ExpressionExperiment)5 HashSet (java.util.HashSet)4 BioMaterial (ubic.gemma.model.expression.biomaterial.BioMaterial)4 File (java.io.File)3 StandardQuantitationType (ubic.gemma.model.common.quantitationtype.StandardQuantitationType)3 ArrayDesign (ubic.gemma.model.expression.arrayDesign.ArrayDesign)3 DoubleArrayList (cern.colt.list.DoubleArrayList)2