use of ubic.gemma.model.expression.bioAssay.BioAssay in project Gemma by PavlidisLab.
the class BatchInfoParser method getBatchInfo.
public Map<BioMaterial, Date> getBatchInfo(ExpressionExperiment ee, Collection<LocalFile> files) {
Map<String, BioAssay> assayAccessions = this.getAccessionToBioAssayMap(ee);
if (assayAccessions.isEmpty()) {
throw new UnsupportedOperationException("Couldn't get any scan date information, could not determine provider or it is not supported for " + ee.getShortName());
}
Map<BioAssay, File> bioAssays2Files = this.matchBioAssaysToRawDataFiles(files, assayAccessions);
/*
* Check if we should go on
*/
if (bioAssays2Files.size() < assayAccessions.size()) {
if (bioAssays2Files.size() > 0) {
/*
* Missing a few for some reason.
*/
for (BioAssay ba : bioAssays2Files.keySet()) {
if (!assayAccessions.containsKey(ba.getAccession().getAccession())) {
BatchInfoParser.log.warn("Missing raw data file for " + ba + " on " + ee.getShortName());
}
}
}
throw new IllegalStateException("Did not get enough raw files :got " + bioAssays2Files.size() + ", expected " + assayAccessions.size() + " while processing " + ee.getShortName());
}
return this.getBatchInformationFromFiles(bioAssays2Files);
}
use of ubic.gemma.model.expression.bioAssay.BioAssay in project Gemma by PavlidisLab.
the class GeoDatasetServiceTest method testFetchAndLoadGSE13657.
/*
* Left out quantitation types due to bug in how quantitation types were cached during persisting, if the QTs didn't
* have descriptions.
*/
@Test
public void testFetchAndLoadGSE13657() throws Exception {
try {
geoService.setGeoDomainObjectGenerator(new GeoDomainObjectGeneratorLocal(this.getTestFileBasePath()));
Collection<?> results = geoService.fetchAndLoad("GSE13657", false, true, false);
ee = (ExpressionExperiment) results.iterator().next();
} catch (AlreadyExistsInSystemException e) {
log.info("Test skipped because GSE13657 was already loaded - clean the DB before running the test");
return;
}
ee = this.eeService.thawLite(ee);
aclTestUtils.checkEEAcls(ee);
Collection<QuantitationType> qts = eeService.getQuantitationTypes(ee);
assertEquals(13, qts.size());
// make sure we got characteristics and treatments for both channels.
for (BioAssay ba : ee.getBioAssays()) {
BioMaterial bm = ba.getSampleUsed();
assertNotNull(bm);
log.info(bm + " " + bm.getDescription());
assertEquals(9, bm.getCharacteristics().size());
}
}
use of ubic.gemma.model.expression.bioAssay.BioAssay in project Gemma by PavlidisLab.
the class GeoDatasetServiceTest method testMatrixValue.
private void testMatrixValue(ExpressionExperiment exp, ExpressionDataMatrix<Double> matrix, String probeToTest, String sampleToTest, double expectedValue) {
CompositeSequence soughtDesignElement = null;
BioAssay soughtBioAssay = null;
Collection<RawExpressionDataVector> vectors = exp.getRawExpressionDataVectors();
for (DesignElementDataVector vector : vectors) {
CompositeSequence de = vector.getDesignElement();
if (de.getName().equals(probeToTest)) {
soughtDesignElement = de;
}
BioAssayDimension bad = vector.getBioAssayDimension();
for (BioAssay ba : bad.getBioAssays()) {
if (ba.getAccession().getAccession().equals(sampleToTest)) {
soughtBioAssay = ba;
}
}
}
if (soughtDesignElement == null || soughtBioAssay == null)
fail("didn't find values for " + sampleToTest);
Double actualValue = matrix.get(soughtDesignElement, soughtBioAssay);
assertNotNull("No value for " + soughtBioAssay, actualValue);
assertEquals(expectedValue, actualValue, 0.00001);
}
use of ubic.gemma.model.expression.bioAssay.BioAssay in project Gemma by PavlidisLab.
the class ExperimentalDesignImporterTest method testParseWhereExtraValue.
/*
* test case where the design file has extra information not relevant to the current samples.
*/
@Test
public final void testParseWhereExtraValue() throws Exception {
try (InputStream is = this.getClass().getResourceAsStream("/data/loader/expression/experimentalDesignTestExtra.txt")) {
experimentalDesignImporter.importDesign(ee, is);
}
ee = this.eeService.thawLite(ee);
Collection<BioMaterial> bms = new HashSet<>();
for (BioAssay ba : ee.getBioAssays()) {
BioMaterial bm = ba.getSampleUsed();
bms.add(bm);
}
this.aclTestUtils.checkEEAcls(ee);
this.checkResults(bms);
}
use of ubic.gemma.model.expression.bioAssay.BioAssay in project Gemma by PavlidisLab.
the class TwoChannelMissingValuesTest method print.
/**
* Debug code.
*/
@SuppressWarnings("unused")
private void print(Collection<RawExpressionDataVector> calls) {
ByteArrayConverter bac = new ByteArrayConverter();
BioAssayDimension dim = calls.iterator().next().getBioAssayDimension();
System.err.print("\n");
for (BioAssay bas : dim.getBioAssays()) {
System.err.print("\t" + bas);
}
System.err.print("\n");
for (DesignElementDataVector vector : calls) {
System.err.print(vector.getDesignElement());
byte[] dat = vector.getData();
boolean[] row = bac.byteArrayToBooleans(dat);
for (boolean b : row) {
System.err.print("\t" + b);
}
System.err.print("\n");
}
}
Aggregations