use of ubic.gemma.model.genome.Taxon 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.Taxon 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.Taxon in project Gemma by PavlidisLab.
the class BlatAssociationServiceTest method testFindBioSequence.
@Test
public final void testFindBioSequence() {
BioSequence bs = BioSequence.Factory.newInstance();
Taxon t = Taxon.Factory.newInstance();
// has to match what the testpersistent object is.
t.setScientificName("Mus musculus");
t.setIsSpecies(true);
t.setIsGenesUsable(true);
bs.setSequence(testSequence);
bs.setTaxon(t);
bs.setName(testSequenceName);
BioSequence bsIn = this.bioSequenceService.find(bs);
assertNotNull("Did not find " + bs, bsIn);
Collection<BlatAssociation> res = this.blatAssociationService.find(bs);
assertEquals("Was seeking blatresults for sequence " + testSequenceName, 1, res.size());
}
use of ubic.gemma.model.genome.Taxon in project Gemma by PavlidisLab.
the class ArrayDesignServiceTest method testGetTaxon.
/*
* Test retrieving one taxa for an arraydesign where hibernate query is restricted to return just 1 taxon.
*/
@Test
public void testGetTaxon() {
ad = (ArrayDesign) persisterHelper.persist(ad);
Taxon tax = arrayDesignService.getTaxa(ad.getId()).iterator().next();
assertEquals(ArrayDesignServiceTest.DEFAULT_TAXON, tax.getScientificName());
}
use of ubic.gemma.model.genome.Taxon in project Gemma by PavlidisLab.
the class ExpressionExperimentSetServiceTest method setUp.
@Before
public void setUp() {
// need persistent entities so that experiment's taxon can be
// queried from database during methods being tested
Taxon tax1 = this.getTaxon("human");
Taxon taxMouse = this.getTaxon("mouse");
ee1 = this.getTestPersistentExpressionExperiment(tax1);
ee2 = this.getTestPersistentExpressionExperiment(tax1);
eeMouse = this.getTestPersistentExpressionExperiment(taxMouse);
// Make experiment set
Collection<ExpressionExperiment> ees = new HashSet<>();
ees.add(ee1);
ees.add(ee2);
eeSet = ExpressionExperimentSet.Factory.newInstance();
eeSet.setName("CreateTest");
eeSet.setDescription("CreateDesc");
eeSet.getExperiments().addAll(ees);
eeSet.setTaxon(tax1);
eeSet = expressionExperimentSetService.create(eeSet);
eeSetAutoGen = expressionExperimentSetService.initAutomaticallyGeneratedExperimentSet(ees, tax1);
eeSetAutoGen = expressionExperimentSetService.create(eeSetAutoGen);
}
Aggregations