use of ubic.gemma.model.genome.Taxon in project Gemma by PavlidisLab.
the class GemmaClassicHomePageController method updateCounts.
public void updateCounts() {
Map<String, Long> stats = new HashMap<String, Long>();
long bioAssayCount = bioAssayService.countAll();
long arrayDesignCount = arrayDesignService.countAll();
/*
* Sort taxa by name.
*/
TreeMap<Taxon, Long> eesPerTaxon = new TreeMap<Taxon, Long>(new Comparator<Taxon>() {
@Override
public int compare(Taxon o1, Taxon o2) {
return o1.getScientificName().compareTo(o2.getScientificName());
}
});
eesPerTaxon.putAll(expressionExperimentService.getPerTaxonCount());
long expressionExperimentCount = 0;
long otherTaxaEECount = 0;
for (Iterator<Taxon> it = eesPerTaxon.keySet().iterator(); it.hasNext(); ) {
Taxon t = it.next();
Long c = eesPerTaxon.get(t);
// TODO problem with this is we want to make a link to them.
if (c < 10) {
// temporary, hide 'uncommon' taxa from this table. See bug 2052
otherTaxaEECount += c;
it.remove();
}
expressionExperimentCount += c;
}
if (otherTaxaEECount > 0) {
// eesPerTaxon.put( otherTaxa, otherTaxaEECount );
}
WhatsNew wn = whatsNewService.retrieveReport();
stats.put("bioAssayCount", bioAssayCount);
stats.put("arrayDesignCount", arrayDesignCount);
mav.addObject("stats", stats);
mav.addObject("taxonCount", eesPerTaxon);
mav.addObject("expressionExperimentCount", expressionExperimentCount);
if (wn != null && wn.getDate() != null) {
mav.addObject("whatsNew", wn);
}
}
use of ubic.gemma.model.genome.Taxon in project Gemma by PavlidisLab.
the class BioSequenceImplTest method testEqualsTaxon.
public void testEqualsTaxon() {
BioSequence a = BioSequence.Factory.newInstance();
BioSequence b = BioSequence.Factory.newInstance();
a.setName("foo");
b.setName("foo");
a.setSequence("AAAAAAAAAAAAAAAA");
b.setSequence("AAAAAAAAAAAAAAAA");
Taxon m = Taxon.Factory.newInstance();
m.setIsSpecies(true);
m.setIsGenesUsable(true);
m.setScientificName("Mus musculus");
Taxon h = Taxon.Factory.newInstance();
h.setIsSpecies(true);
h.setIsGenesUsable(true);
h.setScientificName("Homo sapiens");
a.setTaxon(m);
b.setTaxon(h);
TestCase.assertTrue(!a.equals(b));
}
use of ubic.gemma.model.genome.Taxon in project Gemma by PavlidisLab.
the class GeneServiceImplTest method setUp.
@Before
public void setUp() throws Exception {
geneDaoMock = createMock(GeneDaoImpl.class);
svc = new GeneServiceImpl(geneDaoMock);
Taxon t = Taxon.Factory.newInstance();
t.setCommonName("moose");
t.setScientificName("moose");
t.setIsSpecies(true);
t.setIsGenesUsable(true);
// tDAO.create( t );
g = Gene.Factory.newInstance();
g.setOfficialName("rabble");
g.setOfficialSymbol("rab");
allThree.add(g);
justRab.add(g);
g2 = Gene.Factory.newInstance();
g2.setOfficialName("rabblebong");
g2.setTaxon(t);
allThree.add(g2);
g3 = Gene.Factory.newInstance();
g3.setOfficialName("rabble");
g3.setNcbiGeneId(12345);
g3.setOfficialSymbol("rab3");
g3.setId((long) 1234);
// For testing need to add physical locations to the gene products of a given gene.
Chromosome chromosome = new Chromosome("fakeChromosome", t);
FieldUtils.writeField(chromosome, "id", 54321L, true);
// Gene product 1 (Min=100 max=200)
PhysicalLocation ploc1 = PhysicalLocation.Factory.newInstance();
ploc1.setChromosome(chromosome);
ploc1.setStrand(GeneServiceImplTest.STRAND);
ploc1.setNucleotide((long) 100);
ploc1.setNucleotideLength(100);
GeneProduct gp1 = GeneProduct.Factory.newInstance();
gp1.setPhysicalLocation(ploc1);
gp1.setGene(g3);
gp1.setName("gp1");
// gene product 2 (min=110 max = 210)
PhysicalLocation ploc2 = PhysicalLocation.Factory.newInstance();
ploc2.setChromosome(chromosome);
ploc2.setStrand(GeneServiceImplTest.STRAND);
ploc2.setNucleotide((long) 110);
ploc2.setNucleotideLength(100);
GeneProduct gp2 = GeneProduct.Factory.newInstance();
gp2.setPhysicalLocation(ploc2);
gp2.setGene(g3);
gp2.setName("gp2");
// Gene Product 3 (min=90 max=140)
PhysicalLocation ploc3 = PhysicalLocation.Factory.newInstance();
ploc3.setChromosome(chromosome);
ploc3.setStrand(GeneServiceImplTest.STRAND);
ploc3.setNucleotide((long) 90);
ploc3.setNucleotideLength(50);
GeneProduct gp3 = GeneProduct.Factory.newInstance();
gp3.setPhysicalLocation(ploc3);
gp3.setGene(g3);
gp3.setName("gp3");
// Gene Product 4 (wrong strand should get regected, min 10 max 210)
PhysicalLocation ploc4 = PhysicalLocation.Factory.newInstance();
ploc4.setChromosome(chromosome);
ploc4.setStrand("-");
ploc4.setNucleotide((long) 10);
ploc4.setNucleotideLength(200);
GeneProduct gp4 = GeneProduct.Factory.newInstance();
gp4.setPhysicalLocation(ploc4);
gp4.setGene(g3);
gp4.setName("wrong strand gp4");
gp4.setId((long) 3456);
// Gene Product 5 (right strand wrong chromosome should get regected, min 20 max 220)
Chromosome wrongChromosome = new Chromosome("wrongFakeChromosome", t);
FieldUtils.writeField(chromosome, "id", 43215L, true);
PhysicalLocation ploc5 = PhysicalLocation.Factory.newInstance();
ploc5.setChromosome(wrongChromosome);
ploc5.setStrand(GeneServiceImplTest.STRAND);
ploc5.setNucleotide((long) 20);
ploc5.setNucleotideLength(200);
GeneProduct gp5 = GeneProduct.Factory.newInstance();
gp5.setPhysicalLocation(ploc5);
gp5.setGene(g3);
gp5.setName("wrong chromosome gp5");
gp5.setId((long) 4567);
Collection<GeneProduct> gps = new ArrayList<>();
gps.add(gp1);
gps.add(gp2);
gps.add(gp4);
gps.add(gp5);
gps.add(gp3);
g3.setProducts(gps);
allThree.add(g3);
justRabble.add(g3);
}
use of ubic.gemma.model.genome.Taxon in project Gemma by PavlidisLab.
the class ArrayDesignServiceTest method testGetTaxaOneTaxonForArray.
/*
* Test retrieving one taxa for an arraydesign where hibernate query is not restricted to return just 1 taxon.
*/
@Test
public void testGetTaxaOneTaxonForArray() {
ad = (ArrayDesign) persisterHelper.persist(ad);
Collection<Taxon> taxa = arrayDesignService.getTaxa(ad.getId());
assertEquals(1, taxa.size());
Taxon tax = taxa.iterator().next();
assertEquals(ArrayDesignServiceTest.DEFAULT_TAXON, tax.getScientificName());
}
use of ubic.gemma.model.genome.Taxon in project Gemma by PavlidisLab.
the class GeneServiceTest method testLoadGenes.
@Test
public void testLoadGenes() {
Taxon human = taxonService.findByCommonName("human");
Gene gene = Gene.Factory.newInstance();
Integer id = Integer.parseInt(RandomStringUtils.randomNumeric(5));
gene.setNcbiGeneId(id);
gene.setName("Ma_Gene");
gene.setDescription("Lost in space");
gene.setTaxon(human);
geneDao.create(gene);
Collection<Gene> genes = geneDao.loadAll(human);
assertNotNull(genes);
assertTrue(genes.contains(gene));
geneDao.remove(gene);
}
Aggregations