Search in sources :

Example 1 with GeneServiceImpl

use of ubic.gemma.core.genome.gene.service.GeneServiceImpl 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);
}
Also used : GeneServiceImpl(ubic.gemma.core.genome.gene.service.GeneServiceImpl) Taxon(ubic.gemma.model.genome.Taxon) ArrayList(java.util.ArrayList) Chromosome(ubic.gemma.model.genome.Chromosome) GeneDaoImpl(ubic.gemma.persistence.service.genome.GeneDaoImpl) PhysicalLocation(ubic.gemma.model.genome.PhysicalLocation) Before(org.junit.Before)

Aggregations

ArrayList (java.util.ArrayList)1 Before (org.junit.Before)1 GeneServiceImpl (ubic.gemma.core.genome.gene.service.GeneServiceImpl)1 Chromosome (ubic.gemma.model.genome.Chromosome)1 PhysicalLocation (ubic.gemma.model.genome.PhysicalLocation)1 Taxon (ubic.gemma.model.genome.Taxon)1 GeneDaoImpl (ubic.gemma.persistence.service.genome.GeneDaoImpl)1