Class Genes (NCBI Entrez API)

Gets gene’s info from NCBI entrez API (PubMed) https://www.ncbi.nlm.nih.gov/

Downloads only necessary part of Entrez response, just enough to get all the tags you interested in (parameter fields, values from GeneFields). So we do not wait for full 2Mb entrez response but only for first 5-6Kb.

The easiest way to use - global genes object pre-created globally in this module:

entrez.genes[‘ppara’][GeneFields.summary]

If we use genes[] it searches for gene name case-insensitive (see canonical_gene_name). On other hand, all methods in the class search for gene name case-sensitive.

Caches results inside the class instance.

class httpstreamxml.entrez.Genes(fields=None, timeout=2, max_bytes_to_fetch=10240, api_key=None)
clear_cache()

Clear all previously cached genes data so all information from this moment will be requested from NCBI server

get_gene_details_by_id(gene_id)

Download gene’s details from NCBI entrez API, using gene’s ID - see get_gene_id to obtain it

class httpstreamxml.entrez.GeneFields

Mapping of gene fields to tag names in entrez’s result XML

Usage example

from httpstreamxml import entrez


print(entrez.genes['myo5b'][entrez.GeneFields.description])