Search in sources :

Example 91 with CompositeSequence

use of ubic.gemma.model.expression.designElement.CompositeSequence in project Gemma by PavlidisLab.

the class ArrayDesignMergeServiceImpl method createMerged.

/**
 * @param mergeWithExisting i.e., "add", assuming arrayDesign is already a merged design.
 */
private ArrayDesign createMerged(ArrayDesign arrayDesign, Collection<ArrayDesign> otherArrayDesigns, Map<BioSequence, Collection<CompositeSequence>> globalBsMap, String newName, String newShortName, boolean mergeWithExisting) {
    ArrayDesign result = this.formMergedDesign(arrayDesign, otherArrayDesigns, newName, newShortName, mergeWithExisting);
    Collection<CompositeSequence> newProbes = this.makeNewProbes(result, globalBsMap, mergeWithExisting);
    result = mergeServiceHelper.persistMerging(result, arrayDesign, otherArrayDesigns, mergeWithExisting, newProbes);
    arrayDesignReportService.generateArrayDesignReport(result.getId());
    return result;
}
Also used : ArrayDesign(ubic.gemma.model.expression.arrayDesign.ArrayDesign) CompositeSequence(ubic.gemma.model.expression.designElement.CompositeSequence)

Example 92 with CompositeSequence

use of ubic.gemma.model.expression.designElement.CompositeSequence in project Gemma by PavlidisLab.

the class CompositeSequenceParser method parseOneLine.

@Override
public CompositeSequence parseOneLine(String line) {
    String[] tokens = StringUtils.splitPreserveAllTokens(line, '\t');
    if (tokens.length != 3) {
        return null;
    }
    String probeid = tokens[0];
    String genbankAcc = tokens[1];
    String description = tokens[2];
    CompositeSequence result = CompositeSequence.Factory.newInstance();
    result.setName(probeid);
    result.setDescription(description);
    DatabaseEntry dbEntry = ExternalDatabaseUtils.getGenbankAccession(genbankAcc);
    BioSequence biologicalCharacteristic = BioSequence.Factory.newInstance();
    // this will be changed later, typically.
    biologicalCharacteristic.setName(genbankAcc);
    // this will be changed later, typically.
    biologicalCharacteristic.setDescription(description + " (From platform source)");
    biologicalCharacteristic.setSequenceDatabaseEntry(dbEntry);
    result.setBiologicalCharacteristic(biologicalCharacteristic);
    return result;
}
Also used : BioSequence(ubic.gemma.model.genome.biosequence.BioSequence) DatabaseEntry(ubic.gemma.model.common.description.DatabaseEntry) CompositeSequence(ubic.gemma.model.expression.designElement.CompositeSequence)

Example 93 with CompositeSequence

use of ubic.gemma.model.expression.designElement.CompositeSequence 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 94 with CompositeSequence

use of ubic.gemma.model.expression.designElement.CompositeSequence in project Gemma by PavlidisLab.

the class ExpressionDataDoubleMatrix method getRows.

@Override
public Double[][] getRows(List<CompositeSequence> designElements) {
    if (designElements == null) {
        return null;
    }
    Double[][] result = new Double[designElements.size()][];
    int i = 0;
    for (CompositeSequence element : designElements) {
        Double[] rowResult = this.getRow(element);
        result[i] = rowResult;
        i++;
    }
    return result;
}
Also used : CompositeSequence(ubic.gemma.model.expression.designElement.CompositeSequence)

Example 95 with CompositeSequence

use of ubic.gemma.model.expression.designElement.CompositeSequence in project Gemma by PavlidisLab.

the class ExpressionDataIntegerMatrix method createMatrix.

/**
 * Fill in the data
 *
 * @return DoubleMatrixNamed
 */
private IntegerMatrix<CompositeSequence, Integer> createMatrix(Collection<? extends DesignElementDataVector> vectors, int maxSize) {
    int numRows = this.rowDesignElementMapByInteger.keySet().size();
    IntegerMatrix<CompositeSequence, Integer> mat = new IntegerMatrix<>(numRows, maxSize);
    for (int j = 0; j < mat.columns(); j++) {
        mat.addColumnName(j);
    }
    // initialize the matrix to 0
    for (int i = 0; i < mat.rows(); i++) {
        for (int j = 0; j < mat.columns(); j++) {
            mat.set(i, j, 0);
        }
    }
    ByteArrayConverter bac = new ByteArrayConverter();
    Map<Integer, CompositeSequence> rowNames = new TreeMap<>();
    for (DesignElementDataVector vector : vectors) {
        CompositeSequence designElement = vector.getDesignElement();
        assert designElement != null : "No design element for " + vector;
        Integer rowIndex = this.rowElementMap.get(designElement);
        assert rowIndex != null;
        rowNames.put(rowIndex, designElement);
        byte[] bytes = vector.getData();
        int[] vals = bac.byteArrayToInts(bytes);
        BioAssayDimension dimension = vector.getBioAssayDimension();
        Collection<BioAssay> bioAssays = dimension.getBioAssays();
        assert bioAssays.size() == vals.length : "Expected " + vals.length + " got " + bioAssays.size();
        Iterator<BioAssay> it = bioAssays.iterator();
        this.setMatBioAssayValues(mat, rowIndex, ArrayUtils.toObject(vals), bioAssays, it);
    }
    for (int i = 0; i < mat.rows(); i++) {
        mat.addRowName(rowNames.get(i));
    }
    ExpressionDataIntegerMatrix.log.debug("Created a " + mat.rows() + " x " + mat.columns() + " matrix");
    return mat;
}
Also used : ByteArrayConverter(ubic.basecode.io.ByteArrayConverter) CompositeSequence(ubic.gemma.model.expression.designElement.CompositeSequence) BioAssayDimension(ubic.gemma.model.expression.bioAssayData.BioAssayDimension) IntegerMatrix(ubic.basecode.dataStructure.matrix.IntegerMatrix) DesignElementDataVector(ubic.gemma.model.expression.bioAssayData.DesignElementDataVector) BioAssay(ubic.gemma.model.expression.bioAssay.BioAssay)

Aggregations

CompositeSequence (ubic.gemma.model.expression.designElement.CompositeSequence)206 ArrayDesign (ubic.gemma.model.expression.arrayDesign.ArrayDesign)43 BioSequence (ubic.gemma.model.genome.biosequence.BioSequence)40 Gene (ubic.gemma.model.genome.Gene)32 Test (org.junit.Test)30 BioMaterial (ubic.gemma.model.expression.biomaterial.BioMaterial)19 ExpressionDataDoubleMatrix (ubic.gemma.core.datastructure.matrix.ExpressionDataDoubleMatrix)18 BioAssay (ubic.gemma.model.expression.bioAssay.BioAssay)18 DesignElementDataVector (ubic.gemma.model.expression.bioAssayData.DesignElementDataVector)18 RawExpressionDataVector (ubic.gemma.model.expression.bioAssayData.RawExpressionDataVector)18 StopWatch (org.apache.commons.lang3.time.StopWatch)17 HashSet (java.util.HashSet)15 BioAssayDimension (ubic.gemma.model.expression.bioAssayData.BioAssayDimension)15 CompositeSequenceValueObject (ubic.gemma.model.expression.designElement.CompositeSequenceValueObject)15 ArrayList (java.util.ArrayList)14 QuantitationType (ubic.gemma.model.common.quantitationtype.QuantitationType)14 BaseSpringContextTest (ubic.gemma.core.testing.BaseSpringContextTest)13 Taxon (ubic.gemma.model.genome.Taxon)12 Collection (java.util.Collection)11 ByteArrayConverter (ubic.basecode.io.ByteArrayConverter)11