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