Search in sources :

Example 71 with QuantitationType

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

the class ReplaceDataCli method doWork.

@Override
protected Exception doWork(String[] args) {
    Exception exception = super.processCommandLine(args);
    if (exception != null) {
        return exception;
    }
    DataUpdater dataUpdater = this.getBean(DataUpdater.class);
    if (this.expressionExperiments.size() > 1) {
        throw new IllegalArgumentException("Sorry, This CLI can only deal with one experiment at a time.");
    }
    ExpressionExperiment ee = (ExpressionExperiment) this.expressionExperiments.iterator().next();
    Collection<ArrayDesign> arrayDesignsUsed = this.eeService.getArrayDesignsUsed(ee);
    if (arrayDesignsUsed.size() > 1) {
        throw new IllegalArgumentException("Sorry, can only process single-platform data sets with this tool.");
    }
    ArrayDesign targetArrayDesign = arrayDesignsUsed.iterator().next();
    Collection<QuantitationType> qts = eeService.getPreferredQuantitationType(ee);
    if (qts.size() > 1) {
        throw new IllegalArgumentException("Experiment must have just one preferred quantitation type to replace data for");
    }
    QuantitationType qt = qts.iterator().next();
    if (qt == null) {
        throw new IllegalArgumentException("Experiment must have a preferred quantitation type to replace data for");
    }
    try {
        DoubleMatrixReader reader = new DoubleMatrixReader();
        DoubleMatrix<String, String> data = reader.read(file);
        dataUpdater.replaceData(ee, targetArrayDesign, qt, data);
    } catch (IOException e) {
        AbstractCLI.log.error("Failed while processing " + ee, e);
        return e;
    }
    return null;
}
Also used : ArrayDesign(ubic.gemma.model.expression.arrayDesign.ArrayDesign) DataUpdater(ubic.gemma.core.loader.expression.geo.DataUpdater) IOException(java.io.IOException) QuantitationType(ubic.gemma.model.common.quantitationtype.QuantitationType) ExpressionExperiment(ubic.gemma.model.expression.experiment.ExpressionExperiment) IOException(java.io.IOException) DoubleMatrixReader(ubic.basecode.io.reader.DoubleMatrixReader)

Example 72 with QuantitationType

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

the class DesignElementDataVectorServiceTest method testFindByQt.

@Test
public void testFindByQt() throws Exception {
    try {
        geoService.setGeoDomainObjectGenerator(new GeoDomainObjectGeneratorLocal(this.getTestFileBasePath("gse432Short")));
        Collection<?> results = geoService.fetchAndLoad("GSE432", false, true, false);
        newee = (ExpressionExperiment) results.iterator().next();
    } catch (AlreadyExistsInSystemException e) {
        newee = (ExpressionExperiment) e.getData();
    }
    newee.setShortName(RandomStringUtils.randomAlphabetic(12));
    expressionExperimentService.update(newee);
    newee = this.expressionExperimentService.thawLite(newee);
    RawExpressionDataVectorService rawService = this.getBean(RawExpressionDataVectorService.class);
    QuantitationType qt = null;
    for (QuantitationType q : newee.getQuantitationTypes()) {
        if (q.getIsPreferred()) {
            qt = q;
            break;
        }
    }
    assertNotNull("QT is null", qt);
    Collection<? extends DesignElementDataVector> preferredVectors = rawService.findRawAndProcessed(qt);
    assertNotNull(preferredVectors);
    assertEquals(40, preferredVectors.size());
}
Also used : RawExpressionDataVectorService(ubic.gemma.persistence.service.expression.bioAssayData.RawExpressionDataVectorService) AlreadyExistsInSystemException(ubic.gemma.core.loader.util.AlreadyExistsInSystemException) QuantitationType(ubic.gemma.model.common.quantitationtype.QuantitationType) ExpressionExperiment(ubic.gemma.model.expression.experiment.ExpressionExperiment) GeoDomainObjectGeneratorLocal(ubic.gemma.core.loader.expression.geo.GeoDomainObjectGeneratorLocal) AbstractGeoServiceTest(ubic.gemma.core.loader.expression.geo.AbstractGeoServiceTest) Test(org.junit.Test)

Example 73 with QuantitationType

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

the class QuantitationTypeDaoImpl method find.

@Override
public QuantitationType find(QuantitationType quantitationType) {
    Criteria queryObject = this.getSessionFactory().getCurrentSession().createCriteria(QuantitationType.class);
    BusinessKey.addRestrictions(queryObject, quantitationType);
    return (QuantitationType) queryObject.uniqueResult();
}
Also used : Criteria(org.hibernate.Criteria) QuantitationType(ubic.gemma.model.common.quantitationtype.QuantitationType)

Example 74 with QuantitationType

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

the class ExpressionExperimentController method setPreferredAndReprocessed.

/**
 * Check for multiple "preferred" qts and reprocessing.
 *
 * @param ee          ee
 * @param finalResult result
 * @return ee details vo
 */
private ExpressionExperimentDetailsValueObject setPreferredAndReprocessed(ExpressionExperimentDetailsValueObject finalResult, ExpressionExperiment ee) {
    Collection<QuantitationType> quantitationTypes = expressionExperimentService.getQuantitationTypes(ee);
    boolean dataReprocessedFromRaw = false;
    int countPreferred = 0;
    for (QuantitationType qt : quantitationTypes) {
        if (qt.getIsPreferred()) {
            countPreferred++;
        }
        if (qt.getIsMaskedPreferred() != null && qt.getIsMaskedPreferred() && qt.getIsRecomputedFromRawData()) {
            dataReprocessedFromRaw = true;
        }
    }
    finalResult.setHasMultiplePreferredQuantitationTypes(countPreferred > 1);
    finalResult.setReprocessedFromRawData(dataReprocessedFromRaw);
    return finalResult;
}
Also used : 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