Search in sources :

Example 36 with QuantitationType

use of ubic.gemma.model.common.quantitationtype.QuantitationType 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 37 with QuantitationType

use of ubic.gemma.model.common.quantitationtype.QuantitationType in project Gemma by PavlidisLab.

the class BaseExpressionDataMatrix method selectVectors.

Collection<DesignElementDataVector> selectVectors(Collection<? extends DesignElementDataVector> vectors, QuantitationType quantitationType) {
    this.quantitationTypes.add(quantitationType);
    Collection<DesignElementDataVector> vectorsOfInterest = new LinkedHashSet<>();
    int i = 0;
    for (DesignElementDataVector vector : vectors) {
        QuantitationType vectorQuantitationType = vector.getQuantitationType();
        if (vectorQuantitationType.equals(quantitationType)) {
            if (this.expressionExperiment == null)
                this.expressionExperiment = vector.getExpressionExperiment();
            vectorsOfInterest.add(vector);
            this.getQuantitationTypes().add(vectorQuantitationType);
            CompositeSequence designElement = vector.getDesignElement();
            bioAssayDimensions.put(designElement, vector.getBioAssayDimension());
            this.addToRowMaps(i, designElement);
            i++;
        }
    }
    return vectorsOfInterest;
}
Also used : DesignElementDataVector(ubic.gemma.model.expression.bioAssayData.DesignElementDataVector) QuantitationType(ubic.gemma.model.common.quantitationtype.QuantitationType) CompositeSequence(ubic.gemma.model.expression.designElement.CompositeSequence)

Example 38 with QuantitationType

use of ubic.gemma.model.common.quantitationtype.QuantitationType in project Gemma by PavlidisLab.

the class CommonPersister method persistQuantitationType.

QuantitationType persistQuantitationType(QuantitationType qType) {
    if (qType == null)
        return null;
    if (!this.isTransient(qType))
        return qType;
    int key;
    if (qType.getName() == null)
        throw new IllegalArgumentException("QuantitationType must have a name");
    key = qType.getName().hashCode();
    if (qType.getDescription() != null)
        key += qType.getDescription().hashCode();
    if (quantitationTypeCache.containsKey(key)) {
        return quantitationTypeCache.get(key);
    }
    /*
         * Note: we use 'create' here instead of 'findOrCreate' because we don't want quantitation types shared across
         * experiments.
         */
    QuantitationType qt = quantitationTypeDao.create(qType);
    quantitationTypeCache.put(key, qt);
    return qt;
}
Also used : QuantitationType(ubic.gemma.model.common.quantitationtype.QuantitationType)

Example 39 with QuantitationType

use of ubic.gemma.model.common.quantitationtype.QuantitationType in project Gemma by PavlidisLab.

the class ExpressionPersister method fillInDesignElementDataVectorAssociations.

private BioAssayDimension fillInDesignElementDataVectorAssociations(DesignElementDataVector dataVector, ArrayDesignsForExperimentCache c) {
    // we should have done this already.
    assert dataVector.getDesignElement() != null && !this.isTransient(dataVector.getDesignElement());
    BioAssayDimension bioAssayDimension = this.getBioAssayDimensionFromCacheOrCreate(dataVector, c);
    assert !this.isTransient(bioAssayDimension);
    dataVector.setBioAssayDimension(bioAssayDimension);
    assert dataVector.getQuantitationType() != null;
    QuantitationType qt = this.persistQuantitationType(dataVector.getQuantitationType());
    qt = (QuantitationType) this.getSessionFactory().getCurrentSession().merge(qt);
    dataVector.setQuantitationType(qt);
    return bioAssayDimension;
}
Also used : BioAssayDimension(ubic.gemma.model.expression.bioAssayData.BioAssayDimension) QuantitationType(ubic.gemma.model.common.quantitationtype.QuantitationType)

Example 40 with QuantitationType

use of ubic.gemma.model.common.quantitationtype.QuantitationType in project Gemma by PavlidisLab.

the class ExpressionExperimentFilter method isLogTransformed.

/**
 * @param eeDoubleMatrix the matrix
 * @return true if the data looks like it is already log transformed, false otherwise. This is based on the
 * quantitation types and, as a check, looking at the data itself.
 */
private boolean isLogTransformed(ExpressionDataDoubleMatrix eeDoubleMatrix) {
    Collection<QuantitationType> quantitationTypes = eeDoubleMatrix.getQuantitationTypes();
    for (QuantitationType qt : quantitationTypes) {
        ScaleType scale = qt.getScale();
        if (scale.equals(ScaleType.LN) || scale.equals(ScaleType.LOG10) || scale.equals(ScaleType.LOG2) || scale.equals(ScaleType.LOGBASEUNKNOWN)) {
            ExpressionExperimentFilter.log.info("Quantitationtype says the data is already log transformed");
            return true;
        }
    }
    if (this.isTwoColor()) {
        ExpressionExperimentFilter.log.info("Data is from a two-color array, assuming it is log transformed");
        return true;
    }
    for (int i = 0; i < eeDoubleMatrix.rows(); i++) {
        for (int j = 0; j < eeDoubleMatrix.columns(); j++) {
            double v = eeDoubleMatrix.get(i, j);
            if (v > 20) {
                ExpressionExperimentFilter.log.info("Data has large values, doesn't look log transformed");
                return false;
            }
        }
    }
    ExpressionExperimentFilter.log.info("Data looks log-transformed, but not sure...assuming it is");
    return true;
}
Also used : ScaleType(ubic.gemma.model.common.quantitationtype.ScaleType) QuantitationType(ubic.gemma.model.common.quantitationtype.QuantitationType)

Aggregations

QuantitationType (ubic.gemma.model.common.quantitationtype.QuantitationType)74 StandardQuantitationType (ubic.gemma.model.common.quantitationtype.StandardQuantitationType)30 BioAssayDimension (ubic.gemma.model.expression.bioAssayData.BioAssayDimension)20 DesignElementDataVector (ubic.gemma.model.expression.bioAssayData.DesignElementDataVector)18 Test (org.junit.Test)16 CompositeSequence (ubic.gemma.model.expression.designElement.CompositeSequence)14 RawExpressionDataVector (ubic.gemma.model.expression.bioAssayData.RawExpressionDataVector)13 ExpressionExperiment (ubic.gemma.model.expression.experiment.ExpressionExperiment)11 BaseSpringContextTest (ubic.gemma.core.testing.BaseSpringContextTest)10 ProcessedExpressionDataVector (ubic.gemma.model.expression.bioAssayData.ProcessedExpressionDataVector)10 ArrayDesign (ubic.gemma.model.expression.arrayDesign.ArrayDesign)8 BioMaterial (ubic.gemma.model.expression.biomaterial.BioMaterial)7 AbstractGeoServiceTest (ubic.gemma.core.loader.expression.geo.AbstractGeoServiceTest)6 GeoDomainObjectGeneratorLocal (ubic.gemma.core.loader.expression.geo.GeoDomainObjectGeneratorLocal)6 BioAssay (ubic.gemma.model.expression.bioAssay.BioAssay)6 InputStream (java.io.InputStream)5 GZIPInputStream (java.util.zip.GZIPInputStream)5 GeoSeries (ubic.gemma.core.loader.expression.geo.model.GeoSeries)5 AlreadyExistsInSystemException (ubic.gemma.core.loader.util.AlreadyExistsInSystemException)5 ByteArrayConverter (ubic.basecode.io.ByteArrayConverter)4