Search in sources :

Example 36 with DatabaseEntry

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);
}
Also used : Gene(ubic.gemma.model.genome.Gene) ExternalDatabase(ubic.gemma.model.common.description.ExternalDatabase) Taxon(ubic.gemma.model.genome.Taxon) DatabaseEntry(ubic.gemma.model.common.description.DatabaseEntry) Test(org.junit.Test) BaseSpringContextTest(ubic.gemma.core.testing.BaseSpringContextTest)

Example 37 with DatabaseEntry

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);
}
Also used : ExternalDatabase(ubic.gemma.model.common.description.ExternalDatabase) DatabaseEntry(ubic.gemma.model.common.description.DatabaseEntry)

Aggregations

DatabaseEntry (ubic.gemma.model.common.description.DatabaseEntry)37 ExternalDatabase (ubic.gemma.model.common.description.ExternalDatabase)11 GeneProduct (ubic.gemma.model.genome.gene.GeneProduct)8 HashSet (java.util.HashSet)6 Test (org.junit.Test)6 ExpressionExperiment (ubic.gemma.model.expression.experiment.ExpressionExperiment)6 Gene (ubic.gemma.model.genome.Gene)6 BioSequence (ubic.gemma.model.genome.biosequence.BioSequence)6 Taxon (ubic.gemma.model.genome.Taxon)5 BaseSpringContextTest (ubic.gemma.core.testing.BaseSpringContextTest)4 BioSequence2GeneProduct (ubic.gemma.model.association.BioSequence2GeneProduct)4 CompositeSequence (ubic.gemma.model.expression.designElement.CompositeSequence)4 HashMap (java.util.HashMap)3 BibliographicReference (ubic.gemma.model.common.description.BibliographicReference)3 AnnotationAssociation (ubic.gemma.model.genome.sequenceAnalysis.AnnotationAssociation)3 IOException (java.io.IOException)2 ArrayList (java.util.ArrayList)2 Before (org.junit.Before)2 AlreadyExistsInSystemException (ubic.gemma.core.loader.util.AlreadyExistsInSystemException)2 BioAssay (ubic.gemma.model.expression.bioAssay.BioAssay)2