Search in sources :

Example 1 with GeneAlias

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

the class ArrayDesignProbeMapperServiceImpl method checkForAlias.

private GeneProduct checkForAlias(GeneProduct geneProduct) {
    Collection<GeneProduct> candidates = geneProductService.findByName(geneProduct.getName(), geneProduct.getGene().getTaxon());
    if (candidates.isEmpty())
        return null;
    Gene gene = geneProduct.getGene();
    for (GeneProduct existing2 : candidates) {
        Collection<GeneAlias> aliases = existing2.getGene().getAliases();
        for (GeneAlias geneAlias : aliases) {
            if (geneAlias.getAlias().equalsIgnoreCase(gene.getOfficialSymbol())) {
                /*
                     * So, our gene products match, and the genes match but via an alias. That's pretty solid.
                     */
                ArrayDesignProbeMapperServiceImpl.log.info("Associated gene product " + geneProduct + " has a match in Gemma through an aliased gene: " + existing2);
                return existing2;
            }
        }
    }
    return null;
}
Also used : GeneProduct(ubic.gemma.model.genome.gene.GeneProduct) Gene(ubic.gemma.model.genome.Gene) GeneAlias(ubic.gemma.model.genome.gene.GeneAlias)

Example 2 with GeneAlias

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

the class NcbiGeneConverter method convert.

public Gene convert(NCBIGeneInfo info) {
    Gene gene = Gene.Factory.newInstance();
    gene.setNcbiGeneId(Integer.parseInt(info.getGeneId()));
    gene.setName(info.getDefaultSymbol());
    gene.setOfficialSymbol(info.getDefaultSymbol());
    gene.setOfficialName(info.getDescription());
    gene.setEnsemblId(info.getEnsemblId());
    /*
         * NOTE we allow multiple discontinued or previous ids, separated by commas. This is a hack to account for cases
         * uncovered recently...can be minimized by running this regularly.
         */
    if (info.getHistory() != null) {
        assert info.getHistory().getCurrentId() == null || info.getGeneId().equals(info.getHistory().getCurrentId());
        assert info.getHistory().getPreviousIds() != null;
        if (!info.getHistory().getPreviousIds().isEmpty()) {
            String previousIds = StringUtils.join(info.getHistory().getPreviousIds(), ",");
            gene.setPreviousNcbiId(previousIds);
        }
    } else if (StringUtils.isNotBlank(info.getDiscontinuedId())) {
        if (NcbiGeneConverter.log.isDebugEnabled())
            NcbiGeneConverter.log.debug("Gene matches a gene that was discontinued: " + gene + " matches gene that had id " + info.getDiscontinuedId());
        gene.setPreviousNcbiId(info.getDiscontinuedId());
    }
    gene.setDescription("Imported from NCBI gene; Nomenclature status: " + info.getNomenclatureStatus());
    Taxon t = Taxon.Factory.newInstance();
    t.setNcbiId(info.getTaxId());
    t.setIsGenesUsable(false);
    t.setIsSpecies(true);
    gene.setTaxon(t);
    /*
         * We are going to stop maintaining this information
         */
    PhysicalLocation pl = PhysicalLocation.Factory.newInstance();
    Chromosome chrom = new Chromosome(info.getChromosome(), t);
    pl.setChromosome(chrom);
    gene.setPhysicalLocation(pl);
    Collection<GeneAlias> aliases = gene.getAliases();
    for (String alias : info.getSynonyms()) {
        GeneAlias newAlias = GeneAlias.Factory.newInstance();
        newAlias.setAlias(alias);
        aliases.add(newAlias);
    }
    for (String dbname : info.getDbXrefs().keySet()) {
        if (!dbname.equalsIgnoreCase("Ensembl"))
            continue;
        String identifier = info.getDbXrefs().get(dbname);
        DatabaseEntry crossref = DatabaseEntry.Factory.newInstance();
        crossref.setAccession(identifier);
        crossref.setExternalDatabase(NcbiGeneConverter.getEnsembl());
        gene.getAccessions().add(crossref);
    }
    return gene;
}
Also used : Gene(ubic.gemma.model.genome.Gene) GeneAlias(ubic.gemma.model.genome.gene.GeneAlias) Taxon(ubic.gemma.model.genome.Taxon) Chromosome(ubic.gemma.model.genome.Chromosome) DatabaseEntry(ubic.gemma.model.common.description.DatabaseEntry) PhysicalLocation(ubic.gemma.model.genome.PhysicalLocation)

Aggregations

Gene (ubic.gemma.model.genome.Gene)2 GeneAlias (ubic.gemma.model.genome.gene.GeneAlias)2 DatabaseEntry (ubic.gemma.model.common.description.DatabaseEntry)1 Chromosome (ubic.gemma.model.genome.Chromosome)1 PhysicalLocation (ubic.gemma.model.genome.PhysicalLocation)1 Taxon (ubic.gemma.model.genome.Taxon)1 GeneProduct (ubic.gemma.model.genome.gene.GeneProduct)1