use of ubic.gemma.model.common.description.DatabaseEntry 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.DatabaseEntry 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