use of ubic.gemma.model.genome.Gene in project Gemma by PavlidisLab.
the class GeneServiceTest method testFindByAccessionOther.
@Test
public void testFindByAccessionOther() {
Gene gene = Gene.Factory.newInstance();
Integer id = Integer.parseInt(RandomStringUtils.randomNumeric(5));
gene.setNcbiGeneId(id);
gene.setName(GeneServiceTest.TEST_GENE_NAME);
ExternalDatabase ensembl = edbs.findByName("Ensembl");
DatabaseEntry dbe = DatabaseEntry.Factory.newInstance();
dbe.setAccession("E129458");
dbe.setExternalDatabase(ensembl);
gene.getAccessions().add(dbe);
Taxon human = taxonService.findByCommonName("human");
gene.setTaxon(human);
geneDao.create(gene);
Gene g = geneDao.findByAccession("E129458", ensembl);
assertNotNull(g);
assertEquals(g, gene);
geneDao.remove(gene);
}
use of ubic.gemma.model.genome.Gene in project Gemma by PavlidisLab.
the class GeneServiceTest method testGetByGeneAlias.
@Test
public void testGetByGeneAlias() {
Gene gene = Gene.Factory.newInstance();
Integer id = Integer.parseInt(RandomStringUtils.randomNumeric(5));
gene.setNcbiGeneId(id);
gene.setName(GeneServiceTest.TEST_GENE_NAME);
Collection<GeneAlias> aliases = new ArrayList<>();
GeneAlias alias = GeneAlias.Factory.newInstance();
alias.setId((long) 1);
alias.setAlias("GRIN1");
aliases.add(alias);
gene.setAliases(aliases);
Collection<Gene> genes = geneDao.findByAlias("GRIN1");
assertNotNull(genes);
}
use of ubic.gemma.model.genome.Gene in project Gemma by PavlidisLab.
the class GeneServiceTest method testFindEvenThoughHaveSameSymbol.
@Test
public void testFindEvenThoughHaveSameSymbol() {
Gene gene = Gene.Factory.newInstance();
Integer id = Integer.parseInt(RandomStringUtils.randomNumeric(5));
gene.setNcbiGeneId(id);
gene.setName(GeneServiceTest.TEST_GENE_NAME);
gene.setOfficialName(GeneServiceTest.TEST_GENE_NAME);
gene.setOfficialSymbol(GeneServiceTest.TEST_GENE_NAME);
Taxon human = taxonService.findByCommonName("human");
gene.setTaxon(human);
PhysicalLocation pl1 = PhysicalLocation.Factory.newInstance();
Chromosome chromosome = new Chromosome("X", null, this.getTestPersistentBioSequence(), human);
chromosome = (Chromosome) persisterHelper.persist(chromosome);
pl1.setChromosome(chromosome);
pl1.setNucleotide(10000010L);
pl1.setNucleotideLength(1001);
pl1.setStrand("-");
gene.setPhysicalLocation(pl1);
gene = geneDao.create(gene);
Long idWeWant = gene.getId();
Gene gene2 = Gene.Factory.newInstance();
gene2.setNcbiGeneId(null);
gene2.setName(GeneServiceTest.TEST_GENE_NAME);
gene2.setOfficialName(GeneServiceTest.TEST_GENE_NAME);
gene2.setOfficialSymbol(GeneServiceTest.TEST_GENE_NAME);
gene2.setTaxon(human);
PhysicalLocation pl2 = PhysicalLocation.Factory.newInstance();
Chromosome chromosome2 = new Chromosome("Y", null, this.getTestPersistentBioSequence(), human);
chromosome2 = (Chromosome) persisterHelper.persist(chromosome2);
pl2.setChromosome(chromosome2);
pl2.setChromosome(chromosome);
pl2.setNucleotide(10000010L);
pl2.setNucleotideLength(1001);
pl2.setStrand("-");
gene2.setPhysicalLocation(pl2);
gene2 = geneDao.create(gene2);
gene.setId(null);
Gene g = geneDao.find(gene);
assertNotNull(g);
assertEquals(idWeWant, g.getId());
geneDao.remove(g);
geneDao.remove(gene2);
}
use of ubic.gemma.model.genome.Gene in project Gemma by PavlidisLab.
the class GeneCoreServiceTest method testSearchGenes.
@Test
public void testSearchGenes() {
Gene gene = Gene.Factory.newInstance();
Integer id = Integer.parseInt(RandomStringUtils.randomNumeric(5));
gene.setNcbiGeneId(id);
gene.setName("test_search");
gene.setOfficialName("test_search");
gene.setOfficialSymbol("test_search");
Taxon human = taxonService.findByCommonName("human");
gene.setTaxon(human);
PhysicalLocation pl1 = PhysicalLocation.Factory.newInstance();
Chromosome chromosome = new Chromosome("X", null, this.getTestPersistentBioSequence(), human);
chromosome = (Chromosome) persisterHelper.persist(chromosome);
pl1.setChromosome(chromosome);
pl1.setNucleotide(10000010L);
pl1.setNucleotideLength(1001);
pl1.setStrand("-");
gene.setPhysicalLocation(pl1);
gene = geneDao.create(gene);
Collection<GeneValueObject> searchResults = geneCoreService.searchGenes("test_search", 1L);
assertNotNull(searchResults);
GeneValueObject gvo = searchResults.iterator().next();
assertNotNull(gvo);
geneDao.remove(gene);
}
use of ubic.gemma.model.genome.Gene in project Gemma by PavlidisLab.
the class ArrayDesignProbeMapperServiceImpl method checkForAlias.
private GeneProduct checkForAlias(GeneProduct geneProduct) {
Collection<GeneProduct> candidates = geneProductService.findByName(geneProduct.getName(), geneProduct.getGene().getTaxon());
if (candidates.isEmpty())
return null;
Gene gene = geneProduct.getGene();
for (GeneProduct existing2 : candidates) {
Collection<GeneAlias> aliases = existing2.getGene().getAliases();
for (GeneAlias geneAlias : aliases) {
if (geneAlias.getAlias().equalsIgnoreCase(gene.getOfficialSymbol())) {
/*
* So, our gene products match, and the genes match but via an alias. That's pretty solid.
*/
ArrayDesignProbeMapperServiceImpl.log.info("Associated gene product " + geneProduct + " has a match in Gemma through an aliased gene: " + existing2);
return existing2;
}
}
}
return null;
}
Aggregations