=============
Biomart 0.9.2
=============
Python API that consumes the biomart webservice.
What it will do:
----------------
* Show all databases of a biomart server
* Show all datasets of a biomart database
* Show attributes and filters of a biomart dataset
* Run your query formatted as a Python dict and return the Biomart response as TSV format.
What it won't do:
-----------------
* Process and return the results as JSON,XML,etc.
Usage
-----
Import Biomart module
::
from biomart import BiomartServer
Connect to a Biomart Server
::
server = BiomartServer( "http://www.biomart.org/biomart" )
# if you are behind a proxy
import os
server.http_proxy = os.environ.get('http_proxy', 'http://my_http_proxy.org')
# set verbose to True to get some messages
server.verbose = True
Interact with the biomart server
::
# show server databases
server.show_databases() # uses pprint behind the scenes
# show server datasets
server.show_datasets() # uses pprint behind the scenes
# use the 'uniprot' dataset
uniprot = server.datasets['uniprot']
# show all available filters and attributes of the 'uniprot' dataset
uniprot.show_filters() # uses pprint
uniprot.show_attributes() # uses pprint
Run a search
::
# run a search with the default attributes - equivalent to hitting "Results" on the web interface.
# this will return a lot of data.
response = uniprot.search()
response = uniprot.search( header = 1 ) # if you need the columns header
# response format is TSV
for line in response.iter_lines():
line = line.decode('utf-8')
print(line.split("\t"))
# run a count - equivalent to hitting "Count" on the web interface
response = uniprot.count()
print(response.text)
# run a search with custom filters and default attributes.
response = uniprot.search({
'filters': {
'accession': 'Q9FMA1'
}
}, header = 1 )
response = uniprot.search({
'filters': {
'accession': ['Q9FMA1', 'Q8LFJ9'] # ID-list specified accessions
}
}, header = 1 )
# run a search with custom filters and attributes (no header)
response = uniprot.search({
'filters': {
'accession': ['Q9FMA1', 'Q8LFJ9']
},
'attributes': [
'accession', 'protein_name'
]
})
Shortcut function: connect directly to a biomart dataset
*This is short in code but it might be long in time since the module needs to fetch all server's databases to find your dataset.*
::
from biomart import BiomartDataset
interpro = BiomartDataset( "http://www.biomart.org/biomart", name = 'entry' )
response = interpro.search({
'filters': { 'entry_id': 'IPR027603' },
'attributes': [ 'entry_name', 'abstract' ]
})
Raw data
{
"_id": null,
"home_page": "https://github.com/sebriois/biomart",
"name": "biomart",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "bioinformatics biomart",
"author": "Sebastien Briois",
"author_email": "sebriois@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/32/e1/4cf2bab581d3bd3f450ffd5e02ba2b6a696de169b63a7ebacfafb04b3425/biomart-0.9.2.tar.gz",
"platform": "UNKNOWN",
"description": "=============\nBiomart 0.9.2\n=============\n\nPython API that consumes the biomart webservice.\n\nWhat it will do:\n----------------\n\n* Show all databases of a biomart server\n* Show all datasets of a biomart database\n* Show attributes and filters of a biomart dataset\n* Run your query formatted as a Python dict and return the Biomart response as TSV format.\n\nWhat it won't do:\n-----------------\n\n* Process and return the results as JSON,XML,etc.\n\nUsage\n-----\n\nImport Biomart module\n::\n \n from biomart import BiomartServer\n\nConnect to a Biomart Server\n::\n \n server = BiomartServer( \"http://www.biomart.org/biomart\" )\n \n # if you are behind a proxy\n import os\n server.http_proxy = os.environ.get('http_proxy', 'http://my_http_proxy.org')\n\n # set verbose to True to get some messages\n server.verbose = True\n\nInteract with the biomart server\n::\n \n # show server databases\n server.show_databases() # uses pprint behind the scenes\n \n # show server datasets\n server.show_datasets() # uses pprint behind the scenes\n \n # use the 'uniprot' dataset\n uniprot = server.datasets['uniprot']\n\n # show all available filters and attributes of the 'uniprot' dataset\n uniprot.show_filters() # uses pprint\n uniprot.show_attributes() # uses pprint\n\n\nRun a search\n::\n\n # run a search with the default attributes - equivalent to hitting \"Results\" on the web interface.\n # this will return a lot of data.\n response = uniprot.search()\n response = uniprot.search( header = 1 ) # if you need the columns header\n \n # response format is TSV\n for line in response.iter_lines():\n line = line.decode('utf-8')\n print(line.split(\"\\t\"))\n \n # run a count - equivalent to hitting \"Count\" on the web interface\n response = uniprot.count()\n print(response.text)\n\n # run a search with custom filters and default attributes.\n response = uniprot.search({\n 'filters': {\n 'accession': 'Q9FMA1'\n }\n }, header = 1 )\n \n response = uniprot.search({\n 'filters': {\n 'accession': ['Q9FMA1', 'Q8LFJ9'] # ID-list specified accessions\n }\n }, header = 1 )\n \n # run a search with custom filters and attributes (no header)\n response = uniprot.search({\n 'filters': {\n 'accession': ['Q9FMA1', 'Q8LFJ9']\n },\n 'attributes': [\n 'accession', 'protein_name'\n ]\n })\n\n\nShortcut function: connect directly to a biomart dataset\n*This is short in code but it might be long in time since the module needs to fetch all server's databases to find your dataset.*\n::\n \n from biomart import BiomartDataset\n \n interpro = BiomartDataset( \"http://www.biomart.org/biomart\", name = 'entry' )\n \n response = interpro.search({\n 'filters': { 'entry_id': 'IPR027603' },\n 'attributes': [ 'entry_name', 'abstract' ]\n })",
"bugtrack_url": null,
"license": "BSD",
"summary": "Python API that consumes the biomart webservice",
"version": "0.9.2",
"split_keywords": [
"bioinformatics",
"biomart"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "d3b7684fabf2c8d695a5a85b65101405435611b78cbb6e013782bab7ed4b2e9a",
"md5": "2e20e4fae21340408742375b2315abf5",
"sha256": "69fd29b42efac99370951eed3f9ece9ae9b01868e85d104d9877f8cb99e7bd0f"
},
"downloads": -1,
"filename": "biomart-0.9.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "2e20e4fae21340408742375b2315abf5",
"packagetype": "bdist_wheel",
"python_version": "3.4",
"requires_python": null,
"size": 12408,
"upload_time": "2017-01-22T18:08:17",
"upload_time_iso_8601": "2017-01-22T18:08:17.977345Z",
"url": "https://files.pythonhosted.org/packages/d3/b7/684fabf2c8d695a5a85b65101405435611b78cbb6e013782bab7ed4b2e9a/biomart-0.9.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "32e14cf2bab581d3bd3f450ffd5e02ba2b6a696de169b63a7ebacfafb04b3425",
"md5": "55014e144332fc2c77fe0e675aec914e",
"sha256": "a75e53b1bea4abae0b3a9deab389333ea00f2f88c75f66ab332002ee30862619"
},
"downloads": -1,
"filename": "biomart-0.9.2.tar.gz",
"has_sig": false,
"md5_digest": "55014e144332fc2c77fe0e675aec914e",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 8391,
"upload_time": "2017-01-22T18:08:15",
"upload_time_iso_8601": "2017-01-22T18:08:15.358979Z",
"url": "https://files.pythonhosted.org/packages/32/e1/4cf2bab581d3bd3f450ffd5e02ba2b6a696de169b63a7ebacfafb04b3425/biomart-0.9.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2017-01-22 18:08:15",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "sebriois",
"github_project": "biomart",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "biomart"
}