Search in sources :

Example 1 with GeneProduct

use of ubic.gemma.model.genome.gene.GeneProduct in project Gemma by PavlidisLab.

the class PersistentDummyObjectHelper method getTestNonPersistentGeneProduct.

public static GeneProduct getTestNonPersistentGeneProduct(Gene gene) {
    GeneProduct gp = GeneProduct.Factory.newInstance();
    gp.setNcbiGi(RandomStringUtils.randomAlphanumeric(10));
    gp.setName(RandomStringUtils.randomAlphanumeric(6));
    gp.setGene(gene);
    return gp;
}
Also used : BioSequence2GeneProduct(ubic.gemma.model.association.BioSequence2GeneProduct) GeneProduct(ubic.gemma.model.genome.gene.GeneProduct)

Example 2 with GeneProduct

use of ubic.gemma.model.genome.gene.GeneProduct in project Gemma by PavlidisLab.

the class ProbeMapperTest method testLocateGeneOnWrongStrand.

/*
     * Tests a sequence alignment that hits a gene, but the alignment is on the wrong strand; show that ignoring the
     * strand works.
     */
public void testLocateGeneOnWrongStrand() {
    Collection<GeneProduct> products = humangp.findRefGenesByLocation("6", 32916471L, 32918445L, null);
    TestCase.assertEquals(1, products.size());
    GeneProduct gprod = products.iterator().next();
    // oka 2/2011
    TestCase.assertEquals("HLA-DMA", gprod.getGene().getOfficialSymbol());
}
Also used : GeneProduct(ubic.gemma.model.genome.gene.GeneProduct)

Example 3 with GeneProduct

use of ubic.gemma.model.genome.gene.GeneProduct in project Gemma by PavlidisLab.

the class ExternalFileGeneLoaderServiceTest method testLoad.

/*
     * Test method for
     * {@link ubic.gemma.core.loader.genome.gene.ExternalFileGeneLoaderServiceImpl#load(java.lang.String, java.lang.String)}.
     * Tests that 2 genes are loaded sucessfully into Gemma.
     */
@Test
public void testLoad() throws Exception {
    int numbersGeneLoaded = externalFileGeneLoaderService.load(geneFile, TAXON_NAME);
    assertEquals(2, numbersGeneLoaded);
    Collection<Gene> geneCollection = geneService.findByOfficialSymbol("ZYXMMMM");
    Gene gene = geneCollection.iterator().next();
    gene = geneService.thaw(gene);
    Collection<GeneProduct> geneProducts = gene.getProducts();
    assertEquals(TAXON_NAME, gene.getTaxon().getCommonName());
    // same as the symbol
    assertEquals("ZYXMMMM", gene.getName());
    assertEquals("ZYXMMMM", gene.getOfficialSymbol());
    assertEquals("zyxin", gene.getOfficialName());
    assertEquals(1, geneProducts.size());
    GeneProduct prod = geneProducts.iterator().next();
    assertEquals("Gene product placeholder", prod.getDescription());
    // should not involve any updates if we try loading it again.
    numbersGeneLoaded = externalFileGeneLoaderService.load(geneFile, TAXON_NAME);
    assertEquals(0, numbersGeneLoaded);
    // show that we add a product if the gene exists, but is missing one.
    GeneProduct gp = gene.getProducts().iterator().next();
    gene.getProducts().clear();
    geneProductService.remove(gp);
    geneService.update(gene);
    assertEquals(0, geneService.getProducts(gene.getId()).size());
    numbersGeneLoaded = externalFileGeneLoaderService.load(geneFile, TAXON_NAME);
    assertEquals(1, numbersGeneLoaded);
    assertEquals(1, geneService.getProducts(gene.getId()).size());
    // should not involve any updates if we try loading it again as it is now complete.
    numbersGeneLoaded = externalFileGeneLoaderService.load(geneFile, TAXON_NAME);
    assertEquals(0, numbersGeneLoaded);
}
Also used : GeneProduct(ubic.gemma.model.genome.gene.GeneProduct) Gene(ubic.gemma.model.genome.Gene) Test(org.junit.Test) BaseSpringContextTest(ubic.gemma.core.testing.BaseSpringContextTest)

Example 4 with GeneProduct

use of ubic.gemma.model.genome.gene.GeneProduct in project Gemma by PavlidisLab.

the class GoldenPathSequenceAnalysis method findAssociations.

/**
 * Given a physical location, identify overlapping genes or predicted genes.
 *
 * @param chromosome The chromosome name (the organism is set by the constructor)
 * @param queryStart The start base of the region to query (the start of the alignment to the genome)
 * @param queryEnd The end base of the region to query (the end of the alignment to the genome)
 * @param starts Locations of alignment block starts in target. (comma-delimited from blat)
 * @param sizes Sizes of alignment blocks (comma-delimited from blat)
 * @param strand Either + or - indicating the strand to look on, or null to search both strands.
 * @param method The constant representing the method to use to locate the 3' distance.
 * @param config configuration
 * @return A list of BioSequence2GeneProduct objects. The distance stored by a ThreePrimeData will be 0 if the
 *         sequence overhangs the found genes (rather than providing a negative distance). If no genes are found,
 *         the result is null; These are transient instances, not from Gemma's database
 */
public Collection<BlatAssociation> findAssociations(String chromosome, Long queryStart, Long queryEnd, String starts, String sizes, String strand, ThreePrimeDistanceMethod method, ProbeMapperConfig config) {
    if (GoldenPath.log.isDebugEnabled())
        GoldenPath.log.debug("Seeking gene overlaps with: chrom=" + chromosome + " start=" + queryStart + " end=" + queryEnd + " strand=" + strand);
    if (queryEnd < queryStart)
        throw new IllegalArgumentException("End must not be less than start");
    /*
         * These are transient instances only
         */
    Collection<GeneProduct> geneProducts = new HashSet<>();
    if (config.isUseRefGene()) {
        // starting with refgene means we can get the correct transcript name etc.
        geneProducts.addAll(this.findRefGenesByLocation(chromosome, queryStart, queryEnd, strand));
    }
    if (config.isUseKnownGene()) {
        // get known genes as well, in case all we got was an intron. Currently does not work with rat (rn6)
        geneProducts.addAll(this.findKnownGenesByLocation(chromosome, queryStart, queryEnd, strand));
    }
    if (geneProducts.size() == 0)
        return null;
    Collection<BlatAssociation> results = new HashSet<>();
    for (GeneProduct geneProduct : geneProducts) {
        if (GoldenPath.log.isDebugEnabled())
            GoldenPath.log.debug(geneProduct);
        BlatAssociation blatAssociation = this.computeLocationInGene(chromosome, queryStart, queryEnd, starts, sizes, geneProduct, method, config);
        /*
             * We check against the actual threshold later. We can't fully check it now because not all the slots are
             * populated yet.
             */
        if (config.getMinimumExonOverlapFraction() > 0.0 && blatAssociation.getOverlap() == 0) {
            GoldenPath.log.debug("Result failed to meet exon overlap threshold (0)");
            continue;
        }
        results.add(blatAssociation);
    }
    return results;
}
Also used : BioSequence2GeneProduct(ubic.gemma.model.association.BioSequence2GeneProduct) GeneProduct(ubic.gemma.model.genome.gene.GeneProduct) BlatAssociation(ubic.gemma.model.genome.sequenceAnalysis.BlatAssociation) HashSet(java.util.HashSet)

Example 5 with GeneProduct

use of ubic.gemma.model.genome.gene.GeneProduct in project Gemma by PavlidisLab.

the class GoldenPathSequenceAnalysis method setBlocks.

/**
 * Handle the format used by the all_mrna and other GoldenPath tables, which go by sizes of blocks and their starts,
 * not the starts and ends.
 * Be sure to pass the right Blob arguments!
 *
 * @param gene gene
 * @param blockSizes sizes
 * @param blockStarts starts
 */
private void setBlocks(Gene gene, Blob blockSizes, Blob blockStarts) throws SQLException {
    if (blockSizes == null || blockStarts == null)
        return;
    String exonSizes = SQLUtils.blobToString(blockSizes);
    String exonStarts = SQLUtils.blobToString(blockStarts);
    int[] exonSizeInts = SequenceManipulation.blatLocationsToIntArray(exonSizes);
    int[] exonStartInts = SequenceManipulation.blatLocationsToIntArray(exonStarts);
    assert exonSizeInts.length == exonStartInts.length;
    GeneProduct gp = GeneProduct.Factory.newInstance();
    Chromosome chromosome = null;
    if (gene.getPhysicalLocation() != null)
        chromosome = gene.getPhysicalLocation().getChromosome();
    Collection<PhysicalLocation> exons = this.blocksToPhysicalLocations(exonSizeInts, exonStartInts, chromosome);
    gp.setExons(exons);
    // this isn't right?
    gp.setName(gene.getNcbiGeneId().toString());
    Collection<GeneProduct> products = new HashSet<>();
    products.add(gp);
    gene.setProducts(products);
}
Also used : BioSequence2GeneProduct(ubic.gemma.model.association.BioSequence2GeneProduct) GeneProduct(ubic.gemma.model.genome.gene.GeneProduct) Chromosome(ubic.gemma.model.genome.Chromosome) PhysicalLocation(ubic.gemma.model.genome.PhysicalLocation) HashSet(java.util.HashSet)

Aggregations

GeneProduct (ubic.gemma.model.genome.gene.GeneProduct)41 Gene (ubic.gemma.model.genome.Gene)20 HashSet (java.util.HashSet)16 BioSequence2GeneProduct (ubic.gemma.model.association.BioSequence2GeneProduct)12 DatabaseEntry (ubic.gemma.model.common.description.DatabaseEntry)8 BlatAssociation (ubic.gemma.model.genome.sequenceAnalysis.BlatAssociation)8 Test (org.junit.Test)6 BaseSpringContextTest (ubic.gemma.core.testing.BaseSpringContextTest)5 BioSequence (ubic.gemma.model.genome.biosequence.BioSequence)5 AnnotationAssociation (ubic.gemma.model.genome.sequenceAnalysis.AnnotationAssociation)5 HashMap (java.util.HashMap)4 PhysicalLocation (ubic.gemma.model.genome.PhysicalLocation)4 Criteria (org.hibernate.Criteria)3 CompositeSequence (ubic.gemma.model.expression.designElement.CompositeSequence)3 IOException (java.io.IOException)2 ArrayList (java.util.ArrayList)2 Collection (java.util.Collection)2 GeneProductValueObject (ubic.gemma.model.genome.gene.GeneProductValueObject)2 BufferedReader (java.io.BufferedReader)1 FileReader (java.io.FileReader)1