Class Genes (NCBI Entrez API)

Gets gene’s info from NCBI entrez API (PubMed)

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:


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 all previously cached genes data so all information from this moment will be requested from NCBI server


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