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;
}
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;
}
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;
}
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;
}
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;
}
Aggregations