use of ubic.gemma.model.expression.arrayDesign.ArrayDesign in project Gemma by PavlidisLab.
the class PlatformArg method getExperiments.
/**
* Retrieves the Datasets of the Platform that this argument represents.
*
* @param service service that will be used to retrieve the persistent AD object.
* @param eeService service to use to retrieve the EEs.
* @return a collection of Datasets that the platform represented by this argument contains.
*/
public Collection<ExpressionExperimentValueObject> getExperiments(ArrayDesignService service, ExpressionExperimentService eeService, int limit, int offset) {
ArrayDesign ad = this.getPersistentObject(service);
ArrayList<ObjectFilter[]> filters = new ArrayList<>(1);
filters.add(new ObjectFilter[] { new ObjectFilter("id", ad.getId(), ObjectFilter.is, ObjectFilter.DAO_AD_ALIAS) });
return eeService.loadValueObjectsPreFilter(offset, limit, "id", true, filters);
}
use of ubic.gemma.model.expression.arrayDesign.ArrayDesign in project Gemma by PavlidisLab.
the class PersistentDummyObjectHelper method getTestExpressionExperimentWithAllDependencies.
public ExpressionExperiment getTestExpressionExperimentWithAllDependencies(ExpressionExperiment prototype) {
ExpressionExperiment ee = ExpressionExperiment.Factory.newInstance();
ee.setShortName(RandomStringUtils.randomNumeric(PersistentDummyObjectHelper.RANDOM_STRING_LENGTH));
ee.setName("Expression Experiment " + RandomStringUtils.randomNumeric(PersistentDummyObjectHelper.RANDOM_STRING_LENGTH));
ee.setDescription("A test expression experiment");
ee.setSource("https://www.ncbi.nlm.nih.gov/geo/");
DatabaseEntry de1 = this.getTestPersistentDatabaseEntry(PersistentDummyObjectHelper.geo);
ee.setAccession(de1);
LocalFile file = LocalFile.Factory.newInstance();
try {
file.setLocalURL(new URL("file:///just/a/placeholder/" + ee.getShortName()));
} catch (MalformedURLException e) {
log.error("Malformed URL");
}
ee.setRawDataFile(file);
Collection<FactorValue> allFactorValues = new HashSet<>();
ExperimentalDesign ed = this.getExperimentalDesign(allFactorValues);
Collection<BioMaterial> bioMaterials = this.getBioMaterials(allFactorValues);
ee.setExperimentalDesign(ed);
ee.setOwner(this.getTestPersistentContact());
List<ArrayDesign> arrayDesignsUsed = new ArrayList<>(eeService.getArrayDesignsUsed(prototype));
Collection<BioAssay> bioAssays = new HashSet<>();
Collection<QuantitationType> quantitationTypes = this.addQuantitationTypes(new HashSet<QuantitationType>());
eeService.thaw(prototype);
Collection<RawExpressionDataVector> vectors = new HashSet<>();
for (ArrayDesign ad : arrayDesignsUsed) {
List<BioAssay> bas = this.getBioAssays(bioMaterials, ad);
bioAssays.addAll(bas);
ad = this.adService.thaw(ad);
vectors.addAll(this.getDesignElementDataVectors(ee, quantitationTypes, bas, ad));
}
ee.setBioAssays(bioAssays);
assert quantitationTypes.size() > 0;
ee.setQuantitationTypes(quantitationTypes);
ee.setRawExpressionDataVectors(vectors);
ArrayDesignsForExperimentCache c = persisterHelper.prepare(ee);
ee = persisterHelper.persist(ee, c);
return ee;
}
use of ubic.gemma.model.expression.arrayDesign.ArrayDesign in project Gemma by PavlidisLab.
the class PersistentDummyObjectHelper method getTestExpressionExperimentWithAllDependencies.
/**
* Add an expressionExperiment to the database for testing purposes. Includes associations
*
* @param doSequence Should the array design get all the sequence information filled in? (true = slower)
* @return EE
*/
public ExpressionExperiment getTestExpressionExperimentWithAllDependencies(boolean doSequence) {
ExpressionExperiment ee = ExpressionExperiment.Factory.newInstance();
ee.setShortName(RandomStringUtils.randomAlphanumeric(PersistentDummyObjectHelper.RANDOM_STRING_LENGTH));
ee.setName("Expression Experiment " + RandomStringUtils.randomNumeric(PersistentDummyObjectHelper.RANDOM_STRING_LENGTH));
ee.setDescription("A test expression experiment");
ee.setSource("https://www.ncbi.nlm.nih.gov/geo/");
DatabaseEntry de1 = this.getTestPersistentDatabaseEntry(PersistentDummyObjectHelper.geo);
ee.setAccession(de1);
LocalFile file = LocalFile.Factory.newInstance();
try {
file.setLocalURL(new URL("file:///just/a/placeholder/" + ee.getShortName()));
} catch (MalformedURLException e) {
log.error("Malformed URL");
}
ee.setRawDataFile(file);
ArrayDesign adA = this.getTestPersistentArrayDesign(this.getTestElementCollectionSize(), false, doSequence);
ArrayDesign adB = this.getTestPersistentArrayDesign(this.getTestElementCollectionSize(), false, doSequence);
Collection<FactorValue> allFactorValues = new HashSet<>();
ExperimentalDesign ed = this.getExperimentalDesign(allFactorValues);
ee.setExperimentalDesign(ed);
ee.setOwner(this.getTestPersistentContact());
Collection<BioAssay> bioAssays = new HashSet<>();
Collection<BioMaterial> bioMaterials = this.getBioMaterials(allFactorValues);
List<BioAssay> bioAssaysA = this.getBioAssays(bioMaterials, adA);
List<BioAssay> bioAssaysB = this.getBioAssays(bioMaterials, adB);
bioAssays.addAll(bioAssaysA);
bioAssays.addAll(bioAssaysB);
ee.setBioAssays(bioAssays);
log.debug("expression experiment => design element data vectors");
Collection<RawExpressionDataVector> vectors = new HashSet<>();
Collection<QuantitationType> quantitationTypes = this.addQuantitationTypes(new HashSet<QuantitationType>());
assert quantitationTypes.size() > 0;
vectors.addAll(this.getDesignElementDataVectors(ee, quantitationTypes, bioAssaysA, adA));
vectors.addAll(this.getDesignElementDataVectors(ee, quantitationTypes, bioAssaysB, adB));
ee.setQuantitationTypes(quantitationTypes);
ee.setRawExpressionDataVectors(vectors);
ArrayDesignsForExperimentCache c = persisterHelper.prepare(ee);
ee = persisterHelper.persist(ee, c);
return ee;
}
use of ubic.gemma.model.expression.arrayDesign.ArrayDesign in project Gemma by PavlidisLab.
the class DiffExMetaAnalyzerServiceTest method extraTests1.
private void extraTests1(ExpressionExperiment ds1) {
Collection<Gene> geneCollection = geneService.findByOfficialSymbol("ACTA2");
assertTrue(!geneCollection.isEmpty());
Gene g = geneCollection.iterator().next();
assertNotNull(g);
long count = geneService.getCompositeSequenceCountById(g.getId());
assertTrue(count != 0);
Collection<CompositeSequence> compSequences = geneService.getCompositeSequencesById(g.getId());
assertTrue(compSequences.size() != 0);
Collection<CompositeSequence> collection = compositeSequenceService.findByGene(g);
assertEquals(1, collection.size());
ArrayDesign ad = experimentService.getArrayDesignsUsed(ds1).iterator().next();
collection = compositeSequenceService.findByGene(g, ad);
assertEquals(1, collection.size());
Collection<CompositeSequence> css = compositeSequenceService.findByName("200974_at");
assertTrue(!css.isEmpty());
CompositeSequence cs = css.iterator().next();
Collection<Gene> genes = compositeSequenceService.getGenes(cs);
assertEquals(1, genes.size());
assertEquals(g, genes.iterator().next());
tableMaintenanceUtil.disableEmail();
tableMaintenanceUtil.updateGene2CsEntries();
Map<CompositeSequence, Collection<Gene>> gm = compositeSequenceService.getGenes(css);
assertEquals(1, gm.size());
assertEquals(g, gm.values().iterator().next().iterator().next());
}
use of ubic.gemma.model.expression.arrayDesign.ArrayDesign in project Gemma by PavlidisLab.
the class DiffExMetaAnalyzerServiceTest method addGenes.
/**
* Add gene annotations. Requires removing old sequence associations.
*/
private void addGenes() throws Exception {
// fill this in with whatever.
ExternalDatabase genbank = edService.findByName("genbank");
assert genbank != null;
Taxon human = taxonService.findByCommonName("human");
assert human != null;
File annotationFile = new File(this.getClass().getResource("/data/loader/expression/geo/meta-analysis/human.probes.for.import.txt").toURI());
ArrayDesign gpl96 = arrayDesignService.findByShortName("GPL96");
assertNotNull(gpl96);
ArrayDesign gpl97 = arrayDesignService.findByShortName("GPL97");
assertNotNull(gpl97);
arrayDesignService.removeBiologicalCharacteristics(gpl96);
arrayDesignProbeMapperService.processArrayDesign(gpl96, human, annotationFile, genbank, false);
arrayDesignService.removeBiologicalCharacteristics(gpl97);
arrayDesignProbeMapperService.processArrayDesign(gpl97, human, annotationFile, genbank, false);
tableMaintenanceUtil.updateGene2CsEntries();
}
Aggregations