use of ubic.gemma.model.expression.bioAssayData.RawExpressionDataVector in project Gemma by PavlidisLab.
the class DataUpdater method addAffyData.
/**
* For 3' arrays. This only works for single-platform experiments.
*
* @param ee ee
* @param pathToAptOutputFile file
*/
public void addAffyData(ExpressionExperiment ee, String pathToAptOutputFile) throws IOException {
Collection<ArrayDesign> ads = experimentService.getArrayDesignsUsed(ee);
if (ads.size() > 1) {
throw new IllegalArgumentException("Can't handle experiments with more than one platform when passing APT output file.");
}
ArrayDesign ad = ads.iterator().next();
ad = arrayDesignService.thaw(ad);
ee = experimentService.thawLite(ee);
AffyPowerToolsProbesetSummarize apt = new AffyPowerToolsProbesetSummarize();
Collection<RawExpressionDataVector> vectors = apt.processData(ee, pathToAptOutputFile, ad);
if (vectors.isEmpty()) {
throw new IllegalStateException("No vectors were returned for " + ee);
}
experimentService.replaceRawVectors(ee, vectors);
this.audit(ee, "Data vector input from APT output file " + pathToAptOutputFile + " on " + ad, true);
this.postprocess(ee);
}
use of ubic.gemma.model.expression.bioAssayData.RawExpressionDataVector in project Gemma by PavlidisLab.
the class ExperimentPlatformSwitchHelperServiceImpl method persist.
@Override
@Transactional
public void persist(ExpressionExperiment ee, ArrayDesign arrayDesign) {
expressionExperimentService.update(ee);
analysisUtilService.deleteOldAnalyses(ee);
procVectorService.update(ee.getProcessedExpressionDataVectors());
rawVectorService.update(ee.getRawExpressionDataVectors());
this.audit(ee, "Switch to use " + arrayDesign.getShortName());
for (RawExpressionDataVector v : ee.getRawExpressionDataVectors()) {
if (!arrayDesign.equals(v.getDesignElement().getArrayDesign())) {
throw new IllegalStateException("A raw vector for QT =" + v.getQuantitationType() + " was not correctly switched to the target platform " + arrayDesign);
}
}
ExperimentPlatformSwitchHelperServiceImpl.log.info(// flush of transaction happens after this, can take a while.
"Completing switching " + ee);
}
use of ubic.gemma.model.expression.bioAssayData.RawExpressionDataVector in project Gemma by PavlidisLab.
the class TwoChannelMissingValuesTest method testMissingValueGSE11017.
/**
* Was giving all missing values.
*/
@Test
public void testMissingValueGSE11017() throws Exception {
ExpressionExperiment old = eeService.findByShortName("GSE11017");
if (old != null)
eeService.remove(old);
InputStream is = new GZIPInputStream(this.getClass().getResourceAsStream("/data/loader/expression/geo/GSE11017.soft.gz"));
GeoFamilyParser parser = new GeoFamilyParser();
parser.parse(is);
GeoSeries series = ((GeoParseResult) parser.getResults().iterator().next()).getSeriesMap().get("GSE11017");
DatasetCombiner datasetCombiner = new DatasetCombiner();
GeoSampleCorrespondence correspondence = datasetCombiner.findGSECorrespondence(series);
series.setSampleCorrespondence(correspondence);
Object result = this.gc.convert(series);
assertNotNull(result);
ExpressionExperiment expExp = (ExpressionExperiment) ((Collection<?>) result).iterator().next();
expExp = persisterHelper.persist(expExp, persisterHelper.prepare(expExp));
Collection<RawExpressionDataVector> calls = tcmv.computeMissingValues(expExp, 2.0, new ArrayList<Double>());
// print( calls );
assertEquals(20, calls.size());
boolean hasNewQT = false;
Collection<QuantitationType> qts = eeService.getQuantitationTypes(expExp);
for (QuantitationType qt : qts) {
if (qt.getType().equals(StandardQuantitationType.PRESENTABSENT)) {
hasNewQT = true;
break;
}
}
assertTrue(hasNewQT);
ExpressionDataMatrixBuilder builder = new ExpressionDataMatrixBuilder(calls);
ExpressionDataBooleanMatrix missingValues = builder.getMissingValueData();
assertTrue(missingValues.getQuantitationTypes().iterator().next().getDescription().contains("signal threshold"));
Boolean[][] mm = missingValues.getRawMatrix();
boolean hasPresent = false;
for (Boolean[] aMm : mm) {
for (Boolean anAMm : aMm) {
if (anAMm) {
hasPresent = true;
break;
}
}
}
assertTrue(hasPresent);
}
use of ubic.gemma.model.expression.bioAssayData.RawExpressionDataVector in project Gemma by PavlidisLab.
the class TwoChannelMissingValuesTest method testMissingValueGSE523.
@Test
public final void testMissingValueGSE523() throws Exception {
ExpressionExperiment old = eeService.findByShortName("GSE523");
if (old != null)
eeService.remove(old);
InputStream is = new GZIPInputStream(this.getClass().getResourceAsStream("/data/loader/expression/geo/GSE523_family.soft.gz"));
GeoFamilyParser parser = new GeoFamilyParser();
parser.parse(is);
GeoSeries series = ((GeoParseResult) parser.getResults().iterator().next()).getSeriesMap().get("GSE523");
DatasetCombiner datasetCombiner = new DatasetCombiner();
GeoSampleCorrespondence correspondence = datasetCombiner.findGSECorrespondence(series);
series.setSampleCorrespondence(correspondence);
Object result = this.gc.convert(series);
assertNotNull(result);
ExpressionExperiment expExp = (ExpressionExperiment) ((Collection<?>) result).iterator().next();
expExp = persisterHelper.persist(expExp, persisterHelper.prepare(expExp));
Collection<RawExpressionDataVector> calls = tcmv.computeMissingValues(expExp, 2.0, new ArrayList<Double>());
assertEquals(30, calls.size());
}
use of ubic.gemma.model.expression.bioAssayData.RawExpressionDataVector in project Gemma by PavlidisLab.
the class LinkAnalysisServiceTest method testLoadAnalyzeSaveAndCoexpSearch.
@Test
public void testLoadAnalyzeSaveAndCoexpSearch() {
ee = this.getTestPersistentCompleteExpressionExperimentWithSequences();
processedExpressionDataVectorService.computeProcessedExpressionData(ee);
tableMaintenanceUtil.disableEmail();
tableMaintenanceUtil.updateGene2CsEntries();
linkAnalysisConfig.setCdfCut(0.1);
linkAnalysisConfig.setSingularThreshold(SingularThreshold.cdfcut);
linkAnalysisConfig.setProbeDegreeThreshold(25);
linkAnalysisConfig.setCheckCorrelationDistribution(false);
linkAnalysisConfig.setCheckForBatchEffect(false);
filterConfig.setIgnoreMinimumSampleThreshold(true);
// first time.
// noinspection UnusedAssignment // we still want to do this for the testing sake
LinkAnalysis la = linkAnalysisService.process(ee, filterConfig, linkAnalysisConfig);
// test remove is clean; to check this properly requires checking the db.
linkAnalysisPersisterService.deleteAnalyses(ee);
this.checkUnsupportedLinksHaveNoSupport();
assertEquals(0, geneCoexpressionService.getCoexpression(ee, true).size());
la = linkAnalysisService.process(ee, filterConfig, linkAnalysisConfig);
CoexpressionAnalysis analysisObj = la.getAnalysisObj();
assertEquals(151, analysisObj.getNumberOfElementsAnalyzed().intValue());
assertTrue(analysisObj.getNumberOfLinks() > 0);
assertNotNull(analysisObj.getCoexpCorrelationDistribution());
Collection<BioAssaySet> ees = new HashSet<>();
ees.add(ee);
this.updateNodeDegree();
int totalLinksFirstPass = this.checkResults(ees, 1);
// should be ~1140.
assertTrue(totalLinksFirstPass > 1000);
// test redo
linkAnalysisService.process(ee, filterConfig, linkAnalysisConfig);
this.updateNodeDegree();
int totalLinksRedo = this.checkResults(ees, 1);
assertEquals(totalLinksFirstPass, totalLinksRedo);
// now add another experiment that has overlapping links (same data...
Map<CompositeSequence, byte[]> dataMap = new HashMap<>();
ee = eeService.thaw(ee);
for (RawExpressionDataVector v : ee.getRawExpressionDataVectors()) {
dataMap.put(v.getDesignElement(), v.getData());
}
ExpressionExperiment ee2 = this.getTestPersistentCompleteExpressionExperimentWithSequences(ee);
// eeService.thawRawAndProcessed( ee2 );
for (RawExpressionDataVector v : ee2.getRawExpressionDataVectors()) {
assert dataMap.get(v.getDesignElement()) != null;
v.setData(dataMap.get(v.getDesignElement()));
}
eeService.update(ee2);
processedExpressionDataVectorService.computeProcessedExpressionData(ee2);
linkAnalysisService.process(ee2, filterConfig, linkAnalysisConfig);
this.updateNodeDegree();
// expect to get at least one links with support >1
ees.add(ee2);
this.checkResults(ees, 2);
}
Aggregations