use of ubic.gemma.model.common.quantitationtype.QuantitationType in project Gemma by PavlidisLab.
the class GeoConverterTest method testConvertGSE2982.
@SuppressWarnings("unchecked")
@Test
public void testConvertGSE2982() throws Exception {
InputStream is = new GZIPInputStream(this.getClass().getResourceAsStream("/data/loader/expression/geo/gse2982Short/GSE2982_family.soft.gz"));
GeoFamilyParser parser = new GeoFamilyParser();
parser.parse(is);
GeoSeries series = ((GeoParseResult) parser.getResults().iterator().next()).getSeriesMap().get("GSE2982");
DatasetCombiner datasetCombiner = new DatasetCombiner();
GeoSampleCorrespondence correspondence = datasetCombiner.findGSECorrespondence(series);
series.setSampleCorrespondence(correspondence);
Object result = this.gc.convert(series);
assertNotNull(result);
Collection<ExpressionExperiment> ees = (Collection<ExpressionExperiment>) result;
assertEquals(1, ees.size());
ExpressionExperiment ee = ees.iterator().next();
boolean ok = false;
for (RawExpressionDataVector dedv : ee.getRawExpressionDataVectors()) {
QuantitationType qt = dedv.getQuantitationType();
if (qt.getIsPreferred()) {
ok = true;
assertEquals("VALUE", qt.getName());
assertEquals(StandardQuantitationType.AMOUNT, qt.getType());
assertTrue(qt.getIsRatio());
}
}
assertTrue(ok);
}
use of ubic.gemma.model.common.quantitationtype.QuantitationType in project Gemma by PavlidisLab.
the class GeoConverterTest method testConvertGSE5091.
/*
* Problem with QT being interpreted as String instead of Double.
*/
@SuppressWarnings("unchecked")
@Test
public void testConvertGSE5091() throws Exception {
GeoFamilyParser parser = new GeoFamilyParser();
try (InputStream is = new GZIPInputStream(this.getClass().getResourceAsStream("/data/loader/expression/geo/GSE5091Short/GSE5091_family.soft.gz"))) {
parser.parse(is);
}
GeoSeries series = ((GeoParseResult) parser.getResults().iterator().next()).getSeriesMap().get("GSE5091");
DatasetCombiner datasetCombiner = new DatasetCombiner();
GeoSampleCorrespondence correspondence = datasetCombiner.findGSECorrespondence(series);
series.setSampleCorrespondence(correspondence);
Object result = this.gc.convert(series);
assertNotNull(result);
Collection<ExpressionExperiment> ees = (Collection<ExpressionExperiment>) result;
assertEquals(1, ees.size());
ExpressionExperiment ee = ees.iterator().next();
Collection<QuantitationType> quantitationTypes = ee.getQuantitationTypes();
for (QuantitationType quantitationType : quantitationTypes) {
// log.info(quantitationType);
if (quantitationType.getName().equals("VALUE")) {
/*
* Here's the problem. Of course it works fine...
*/
assertEquals(PrimitiveType.DOUBLE, quantitationType.getRepresentation());
assertTrue(quantitationType.getIsPreferred());
return;
}
}
fail("Expected to find 'VALUE' with type Double");
}
use of ubic.gemma.model.common.quantitationtype.QuantitationType in project Gemma by PavlidisLab.
the class GeoConverterTest method testConvertDataIntegers.
@Test
public void testConvertDataIntegers() {
List<Object> testList = new ArrayList<>();
testList.add("1");
testList.add("2929202");
testList.add("-394949");
QuantitationType qt = QuantitationType.Factory.newInstance();
qt.setRepresentation(PrimitiveType.INT);
byte[] actualResult = gc.convertData(testList, qt);
int[] revertedResult = bac.byteArrayToInts(actualResult);
assertEquals(revertedResult[0], 1);
assertEquals(revertedResult[1], 2929202);
assertEquals(revertedResult[2], -394949);
}
use of ubic.gemma.model.common.quantitationtype.QuantitationType in project Gemma by PavlidisLab.
the class MatrixConversionTest method testColumnMapping.
public final void testColumnMapping() {
Collection<QuantitationType> quantTypes = new HashSet<>();
QuantitationType quantType = PersistentDummyObjectHelper.getTestNonPersistentQuantitationType();
quantType.setId(0L);
quantTypes.add(quantType);
Collection<DesignElementDataVector> vectors = this.getDesignElementDataVectors(quantTypes);
ExpressionDataDoubleMatrix mat = new ExpressionDataDoubleMatrix(vectors);
MatrixConversionTest.log.debug(vectors.size() + " vectors");
TestCase.assertEquals(MatrixConversionTest.NUM_CS, mat.rows());
TestCase.assertEquals(MatrixConversionTest.NUM_BIOMATERIALS, mat.columns());
for (int j = 0; j < mat.rows(); j++) {
// System.err.print( mat.getRowElement( j ) );
for (int i = 0; i < mat.columns(); i++) {
Double r = mat.get(j, i);
TestCase.assertNotNull("No value for at index " + i, r);
TestCase.assertTrue("Expected " + i + ", got " + r, i == r.intValue() || r.equals(Double.NaN));
}
}
}
use of ubic.gemma.model.common.quantitationtype.QuantitationType in project Gemma by PavlidisLab.
the class TwoChannelMissingValueCLI method processExperiment.
private boolean processExperiment(ExpressionExperiment ee) {
Collection<QuantitationType> types = eeService.getQuantitationTypes(ee);
ee = this.eeService.thawLite(ee);
if (!force && this.noNeedToRun(ee, MissingValueAnalysisEvent.class))
return false;
QuantitationType previousMissingValueQt = null;
for (QuantitationType qType : types) {
if (qType.getType() == StandardQuantitationType.PRESENTABSENT) {
if (previousMissingValueQt != null) {
AbstractCLI.log.warn("More than one present/absent quantitationtype!");
}
previousMissingValueQt = qType;
}
}
if (previousMissingValueQt != null && !force) {
AbstractCLI.log.warn(ee + " already has missing value vectors, skipping");
return false;
}
if (force && previousMissingValueQt != null) {
AbstractCLI.log.info("Removing old present/absent data");
rawService.removeDataForQuantitationType(previousMissingValueQt);
procService.removeDataForQuantitationType(previousMissingValueQt);
quantitationTypeService.remove(previousMissingValueQt);
}
AbstractCLI.log.info("Got " + ee + ", thawing...");
AbstractCLI.log.info("Computing missing value data..");
Collection<RawExpressionDataVector> missingValueVectors = tcmv.computeMissingValues(ee, s2n, this.extraMissingValueIndicators);
if (missingValueVectors.size() == 0) {
AbstractCLI.log.warn("No missing value vectors computed");
return false;
}
try {
preprocessorService.process(ee, true);
} catch (PreprocessingException e) {
AbstractCLI.log.error("Error during postprocessing of " + ee + " , make sure additional steps are completed", e);
}
return true;
}
Aggregations