use of ubic.gemma.model.common.description.ExternalDatabase in project Gemma by PavlidisLab.
the class LoadExpressionDataCli method removeIfExists.
/**
* Delete previous version of the experiment.
*
* @param accession accession
*/
private void removeIfExists(String accession) {
DatabaseEntry acDbe = DatabaseEntry.Factory.newInstance();
acDbe.setAccession(accession);
ExternalDatabase geo = ExternalDatabase.Factory.newInstance();
geo.setName("GEO");
acDbe.setExternalDatabase(geo);
Collection<ExpressionExperiment> existing = eeService.findByAccession(acDbe);
if (!existing.isEmpty()) {
AbstractCLI.log.info("Deleting existing version of " + accession);
for (ExpressionExperiment expressionExperiment : existing) {
eeService.remove(expressionExperiment);
}
}
}
use of ubic.gemma.model.common.description.ExternalDatabase in project Gemma by PavlidisLab.
the class GeneServiceTest method testFindByAccessionNcbiWithSource.
@Test
public void testFindByAccessionNcbiWithSource() {
Gene gene = Gene.Factory.newInstance();
Integer id = Integer.parseInt(RandomStringUtils.randomNumeric(5));
gene.setNcbiGeneId(id);
gene.setName(GeneServiceTest.TEST_GENE_NAME);
ExternalDatabase ncbi = edbs.findByName("Entrez Gene");
DatabaseEntry dbe = DatabaseEntry.Factory.newInstance();
// this gets ignored, because the ncbi id is part of the object.
dbe.setAccession("12345");
dbe.setExternalDatabase(ncbi);
gene.getAccessions().add(dbe);
Taxon human = taxonService.findByCommonName("human");
gene.setTaxon(human);
geneDao.create(gene);
Gene g = geneDao.findByAccession("12345", ncbi);
assertNotNull(g);
assertEquals(g, gene);
geneDao.remove(gene);
}
use of ubic.gemma.model.common.description.ExternalDatabase in project Gemma by PavlidisLab.
the class ArrayDesignServiceTest method assignExternalReference.
private void assignExternalReference(ArrayDesign toFind, String accession) {
ExternalDatabase geo = externalDatabaseService.findByName("GEO");
assert geo != null;
DatabaseEntry de = DatabaseEntry.Factory.newInstance();
de.setExternalDatabase(geo);
de.setAccession(accession);
toFind.getExternalReferences().add(de);
}
Aggregations