def load_ncbi_info(self): if not self.ncbi_id: return info = GeneInfoDB().select_gene_info(self.ncbi_id) for attr, value in zip(self.__slots__, info): if attr == 'db_refs': value = parse_sources(value) elif attr == 'synonyms': value = parse_synonyms(value) setattr(self, attr, value)
def _init_gene_info(self, organism): for gene in GeneInfoDB().select_genes_by_organism(organism): gene_obj = Gene() for attr, value in zip(gene_obj.__slots__, gene): if attr == 'db_refs': value = parse_sources(value) elif attr == 'synonyms': value = parse_synonyms(value) setattr(gene_obj, attr, value) self[gene_obj.gene_id] = gene_obj
def load_ncbi_info(self): """ Populate :class:`Gene` with data from NCBI gene database """ if not self.ncbi_id: return info = GeneInfoDB().select_gene_info(self.ncbi_id) for attr, value in zip(self.__slots__, info): if attr == 'db_refs': value = parse_sources(value) elif attr == 'synonyms': value = parse_synonyms(value) setattr(self, attr, value)
def parse_gene_record(parent_tax, mapper, gene_record): gene = gene_matcher_tuple(parent_tax, gene_record[gene_id], gene_record[symbol], parse_synonyms(gene_record[synonyms]), parse_sources(gene_record[source]), gene_record[locus_tag]) # construct gene mapper mapper[MAP_SYMBOLS][gene.symbol].append(gene) mapper[MAP_LOCUS][gene.locus_tag].append(gene) mapper[MAP_GENE_IDS][gene.gene_id].append(gene) for gene_synonym in gene.synonyms: mapper[MAP_SYNONYMS][gene_synonym].append(gene) for source_id in gene.sources.values(): mapper[MAP_SOURCES][source_id].append(gene)
def parse_gene_record(parent_tax, mapper, gene_record): gene = {MAP_TAX_ID: parent_tax, MAP_GENE_ID: gene_record[gene_id], MAP_SYMBOL: gene_record[symbol], MAP_SYNONYMS: parse_synonyms(gene_record[synonyms]), MAP_SOURCES: parse_sources(gene_record[sources]), MAP_LOCUS: gene_record[locus_tag], MAP_NOMENCLATURE: gene_record[nomenclature] } # construct gene mapper mapper[MAP_SYMBOL][gene[MAP_SYMBOL]].append(gene) mapper[MAP_LOCUS][gene[MAP_LOCUS]].append(gene) mapper[MAP_GENE_ID][gene[MAP_GENE_ID]].append(gene) mapper[MAP_NOMENCLATURE][gene[MAP_NOMENCLATURE]].append(gene) for gene_synonym in gene[MAP_SYNONYMS]: mapper[MAP_SYNONYMS][gene_synonym].append(gene) for source_id in gene[MAP_SOURCES].values(): mapper[MAP_SOURCES][source_id].append(gene)