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;
}
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());
}
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);
}
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;
}
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);
}
Aggregations