Search in sources :

Example 11 with DesignElementDataVector

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;
}
Also used : BioAssayDimension(ubic.gemma.model.expression.bioAssayData.BioAssayDimension) DesignElementDataVector(ubic.gemma.model.expression.bioAssayData.DesignElementDataVector) QuantitationType(ubic.gemma.model.common.quantitationtype.QuantitationType) StandardQuantitationType(ubic.gemma.model.common.quantitationtype.StandardQuantitationType)

Example 12 with DesignElementDataVector

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;
}
Also used : TechnologyType(ubic.gemma.model.expression.arrayDesign.TechnologyType) DesignElementDataVector(ubic.gemma.model.expression.bioAssayData.DesignElementDataVector) QuantitationType(ubic.gemma.model.common.quantitationtype.QuantitationType) StandardQuantitationType(ubic.gemma.model.common.quantitationtype.StandardQuantitationType) CompositeSequence(ubic.gemma.model.expression.designElement.CompositeSequence)

Example 13 with DesignElementDataVector

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;
}
Also used : BioAssayDimension(ubic.gemma.model.expression.bioAssayData.BioAssayDimension) ArrayDesign(ubic.gemma.model.expression.arrayDesign.ArrayDesign) DesignElementDataVector(ubic.gemma.model.expression.bioAssayData.DesignElementDataVector)

Example 14 with DesignElementDataVector

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;
}
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 15 with DesignElementDataVector

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);
}
Also used : BioSequence2GeneProduct(ubic.gemma.model.association.BioSequence2GeneProduct) CompositeSequence(ubic.gemma.model.expression.designElement.CompositeSequence) Gene(ubic.gemma.model.genome.Gene) DesignElementDataVector(ubic.gemma.model.expression.bioAssayData.DesignElementDataVector)

Aggregations

DesignElementDataVector (ubic.gemma.model.expression.bioAssayData.DesignElementDataVector)33 QuantitationType (ubic.gemma.model.common.quantitationtype.QuantitationType)18 CompositeSequence (ubic.gemma.model.expression.designElement.CompositeSequence)18 BioAssayDimension (ubic.gemma.model.expression.bioAssayData.BioAssayDimension)15 ByteArrayConverter (ubic.basecode.io.ByteArrayConverter)9 StandardQuantitationType (ubic.gemma.model.common.quantitationtype.StandardQuantitationType)9 BioAssay (ubic.gemma.model.expression.bioAssay.BioAssay)8 RawExpressionDataVector (ubic.gemma.model.expression.bioAssayData.RawExpressionDataVector)6 ArrayDesign (ubic.gemma.model.expression.arrayDesign.ArrayDesign)5 ProcessedExpressionDataVector (ubic.gemma.model.expression.bioAssayData.ProcessedExpressionDataVector)5 Collection (java.util.Collection)3 HashMap (java.util.HashMap)2 HashSet (java.util.HashSet)2 Test (org.junit.Test)2 BioMaterial (ubic.gemma.model.expression.biomaterial.BioMaterial)2 ExpressionExperiment (ubic.gemma.model.expression.experiment.ExpressionExperiment)2 InputStream (java.io.InputStream)1 GZIPInputStream (java.util.zip.GZIPInputStream)1 StopWatch (org.apache.commons.lang3.time.StopWatch)1 DetachedCriteria (org.hibernate.criterion.DetachedCriteria)1