The BioThings python client is an easy-to-use Python wrapper to access any of the Biothings.api -based backend services including those for MyGene.info, MyVariant.info, MyChem.info and more! It was built from abstracting and unifying a lot of code from across the different APIs making it both the descendent and eventual replacement of existing BioThings API python clients like MyGene.py and MyVariant.py. With extensibility in mind, this new biothings_client can be the universal python client for future BioThings APIs or any other user APIs built with the BioThings SDK!
For ease of installation, the client can be obtained from PyPI and installed like any other PyPI package.
pip install biothings_client
Other installation methods are also available, and you can get the latest release from the github repo
Once installed, you can use it to pull different annotions from the different biothings APIs. For example, you could pull gene annotations by first calling the gene client within biothings:
mg = biothings_client.get_client("gene") and then using the client as you would the MyGene python client.
To clarify, here's a side-by-side comparison for pulling gene and variant annotations using the BioThings python client vs using both the MyGene and MyVariant python clients.
|MyGene and MyVariant client
|pip install biothings_client
|pip install mygene
pip install myvariant
mg = biothings_client.get_client("gene")
mv = biothings_client.get_client("variant")
mg = mygene.MyGeneInfo()
mv = myvariant.MyVariantInfo()
One key difference is that the BioThings client allows pythonic access to APIs that do not currently have standalone python clients. For example, drug or chemical annotations from the MyChem.info API can be pulled by calling the chem client within the BioThings client.
For ease, you can call the chem client either using the term
drug as so:
chem_client = biothings_client.get_client("chem") or
drug_client = biothings_client.get_client("drug").
Additionally, you can use the
taxon clients in a similar fashion. Learn more about the BioThings client from the documentation.
Now go forth and query!