use of ubic.gemma.model.expression.bioAssayData.DesignElementDataVector in project Gemma by PavlidisLab.
the class QuantitationTypeData method getMissingValueQTypes.
private List<QuantitationType> getMissingValueQTypes() {
List<QuantitationType> result = new ArrayList<>();
List<BioAssayDimension> dimensions = this.getBioAssayDimensions();
for (BioAssayDimension dim : dimensions) {
for (DesignElementDataVector vector : vectors) {
if (!vector.getBioAssayDimension().equals(dim))
continue;
QuantitationType qType = vector.getQuantitationType();
if (!qType.getType().equals(StandardQuantitationType.PRESENTABSENT))
continue;
// ArrayDesign adUsed = arrayDesignForVector( vector );
// if ( arrayDesign != null && !adUsed.equals( arrayDesign ) ) continue;
// if we get here, we're in the right place.
result.add(qType);
// on to the next dimension.
break;
}
}
return result;
}
use of ubic.gemma.model.expression.bioAssayData.DesignElementDataVector in project Gemma by PavlidisLab.
the class QuantitationTypeData method isTwoColor.
private boolean isTwoColor() {
for (DesignElementDataVector v : vectors) {
CompositeSequence d = v.getDesignElement();
TechnologyType technologyType = d.getArrayDesign().getTechnologyType();
if (technologyType.equals(TechnologyType.ONECOLOR) || technologyType.equals(TechnologyType.NONE)) {
continue;
}
QuantitationType qt = v.getQuantitationType();
if ((qt.getIsPreferred() || qt.getIsMaskedPreferred()) && qt.getIsRatio()) {
return true;
}
}
return false;
}
use of ubic.gemma.model.expression.bioAssayData.DesignElementDataVector in project Gemma by PavlidisLab.
the class QuantitationTypeData method getBioAssayDimensions.
/**
* @return a single BioAssayDimension except if there are multiple array designs used in the experiment.
*/
public List<BioAssayDimension> getBioAssayDimensions() {
List<BioAssayDimension> result = new ArrayList<>();
if (dimMap.keySet().size() > 0) {
result.addAll(dimMap.values());
return result;
}
if (this.vectors.isEmpty()) {
throw new IllegalStateException("No vectors, no bioassay dimensions");
}
ExpressionDataMatrixBuilder.log.debug("Checking all vectors to get bioAssayDimensions");
Collection<BioAssayDimension> dimensions = new HashSet<>();
for (DesignElementDataVector vector : vectors) {
ArrayDesign adUsed = this.arrayDesignForVector(vector);
if (!dimMap.containsKey(adUsed)) {
dimMap.put(adUsed, vector.getBioAssayDimension());
}
dimensions.add(vector.getBioAssayDimension());
}
ExpressionDataMatrixBuilder.log.debug("got " + dimensions.size() + " bioAssayDimensions");
result.addAll(dimensions);
return result;
}
use of ubic.gemma.model.expression.bioAssayData.DesignElementDataVector 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.expression.bioAssayData.DesignElementDataVector in project Gemma by PavlidisLab.
the class LinkAnalysisServiceImpl method getProbe2GeneMap.
/**
* Fills in the probe2gene map for the linkAnalysis. Note that the collection DOES NOT contain probes that have NO
* genes mapped
*
* @param eeDoubleMatrix - used to make sure we don't use probes from vectors that are removed?
*/
private void getProbe2GeneMap(LinkAnalysis la, Collection<ProcessedExpressionDataVector> dataVectors, ExpressionDataDoubleMatrix eeDoubleMatrix) {
Collection<CompositeSequence> probesForVectors = new HashSet<>();
for (DesignElementDataVector v : dataVectors) {
CompositeSequence cs = v.getDesignElement();
if (eeDoubleMatrix.getRow(cs) != null)
probesForVectors.add(cs);
}
Map<CompositeSequence, Collection<BioSequence2GeneProduct>> specificityData = csService.getGenesWithSpecificity(probesForVectors);
assert !specificityData.isEmpty();
/*
* Convert the specificity
*/
Map<CompositeSequence, Set<Gene>> probeToGeneMap = new HashMap<>();
for (CompositeSequence cs : specificityData.keySet()) {
Collection<BioSequence2GeneProduct> bioSequenceToGeneProducts = specificityData.get(cs);
if (!probeToGeneMap.containsKey(cs)) {
probeToGeneMap.put(cs, new HashSet<Gene>());
}
for (BioSequence2GeneProduct bioSequence2GeneProduct : bioSequenceToGeneProducts) {
Gene gene = bioSequence2GeneProduct.getGeneProduct().getGene();
probeToGeneMap.get(cs).add(gene);
}
}
/*
* Remove the probes that have no mapping
*/
int startingSize = probeToGeneMap.size();
int numRemoved = 0;
for (Iterator<CompositeSequence> it = probeToGeneMap.keySet().iterator(); it.hasNext(); ) {
CompositeSequence cs = it.next();
if (probeToGeneMap.get(cs).isEmpty()) {
it.remove();
numRemoved++;
}
}
if (numRemoved > 0) {
LinkAnalysisServiceImpl.log.info(numRemoved + "/" + startingSize + " elements had no genes mapped and were removed.");
}
// assert !probeToGeneMap.isEmpty();
if (probeToGeneMap.isEmpty()) {
throw new IllegalStateException("No probes are mapped to genes; example=" + probeToGeneMap.keySet().iterator().next());
}
la.setProbeToGeneMap(probeToGeneMap);
}
Aggregations