Skip to main content

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' ]
})

Release files for biomart 0.9.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for biomart 0.9.2
File Size Uploaded
biomart-0.9.2.tar.gz 8.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for biomart 0.9.2
File Interpreter ABI Platform
biomart-0.9.2-py3-none-any.whl Python 3 none any Details

Total release size: 20.8 kB

Release files / biomart-0.9.2.tar.gz

Download URL biomart-0.9.2.tar.gz
Size 8.4 kB
Tags Source
SHA-256 checksum
How to use checksums
a75e53b1bea4abae0b3a9deab389333ea00f2f88c75f66ab332002ee30862619
BLAKE2b-256 checksum
How to use checksums
32e14cf2bab581d3bd3f450ffd5e02ba2b6a696de169b63a7ebacfafb04b3425
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / biomart-0.9.2-py3-none-any.whl

Download URL biomart-0.9.2-py3-none-any.whl
Size 12.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
69fd29b42efac99370951eed3f9ece9ae9b01868e85d104d9877f8cb99e7bd0f
BLAKE2b-256 checksum
How to use checksums
d3b7684fabf2c8d695a5a85b65101405435611b78cbb6e013782bab7ed4b2e9a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.9.2 This release

2 release files

0.9.1

2 release files

0.9.0

1 release file

0.8.0

1 release file

0.7.2

1 release file

0.7.1

1 release file

0.7.0

1 release file

0.6.0

1 release file

0.5.0

1 release file

0.4.1

1 release file

0.4.0

1 release file

0.3.0

1 release file

0.2.0

1 release file

0.1.0

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page