πŸ” Explore MGnify Biomes 🏞#

Open In Colab

Introduction#

The GOLD ecosystem classifications organize environmental samples into a hierarchical taxonomy of biome typesβ€”from broad categories like β€œEngineered” to specific environments like β€œPlant rhizosphere.”

This demo will show you how to:

  1. Query biomes β€” Discover available biome classifications and explore the hierarchy

  2. Preview before fetching β€” Use filtering and preview methods to confirm your query before retrieving full results

  3. Access results flexibly β€” Retrieve biome data as lists, DataFrames, or hierarchical trees

  4. Navigate relationships β€” Follow links between biomes and associated studies

By the end, we hope you’ll be comfortable querying the MGnify biome resource to find relevant studies.

# uncomment below if colab
#!pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple mgnipy
#!pip install asyncio

We can initiate using mgnipy.MGnipy or proxies.Biomes

The start: Preparing queries#

Option 1. mgnipy.MGnipy#

The MGnipy client offers a unified interface to access various MGnify API endpoints, including biomes. This approach is convenient if you want to manage multiple types of queries or resources through a single client object.

  • Instantiate MGnipy to configure your API access and manage requests.

  • Use .biomes to create a biome query with your desired parameters.

  • Use list_parameters() to see all available filters and options.

  • The filter() method allows you to refine your query further.

  • The explain() method previews the constructed API URLs and the first few results.

This method has an additional helper function to list and describe available resources

from mgnipy import MGnipy

# init
mg = MGnipy(
    # configuration
)

# access proxy
biomes = mg.biomes
print("Initial url: ", biomes.request_url)
Initial url:  https://www.ebi.ac.uk/metagenomics/api/v2/biomes?page=1
mg.describe_resources("biomes")
List all biomes

List all biomes in the MGnify database.

Supported parameters:
- biome_lineage: (None | str | Unset) The lineage to match, including all descendant biomes
- max_depth: (int | None | Unset) Maximum depth of the biome lineage to include, e.g. `root` is 1 and `root:Host-Associated:Human` is level 3
- page: (int | Unset) Default: 1.
- page_size: (int | None | Unset)

If you would like to know what params are supported for the endpoint there is a helper method you can use: .list_supported_params()

# if not sure what kwargs suupported
print("Supported kwargs for biomes: ", biomes.list_supported_params())
Supported kwargs for biomes:  ['biome_lineage', 'max_depth', 'page', 'page_size']

also like describe_resources() there is a describe_endpoint()

biomes.describe_endpoint(as_dict=True)
{'title': 'List all biomes',
 'description': 'List all biomes in the MGnify database.',
 'args': {'biome_lineage': '(None | str | Unset) The lineage to match, including all descendant biomes',
  'max_depth': '(int | None | Unset) Maximum depth of the biome lineage to include, e.g. `root` is 1 and `root:Host-Associated:Human` is level 3',
  'page': '(int | Unset) Default: 1.',
  'page_size': '(int | None | Unset)'},
 'raises': 'errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.\n    httpx.TimeoutException: If the request takes longer than Client.timeout.',
 'returns': 'NinjaPaginationResponseSchemaBiome',
 'examples': '',
 'notes': '',
 'schema_link': 'https://www.ebi.ac.uk/metagenomics/api/v2/openapi.json'}

and then can pass as kwargs to .filter()

biomes = biomes.filter(
    page_size=15,
    max_depth=6,
)
print("Filtered url: ", biomes.request_url)
Filtered url:  https://www.ebi.ac.uk/metagenomics/api/v2/biomes?max_depth=6&page=1&page_size=15

Option 2. Proxies#

The Biomes proxy provides a direct way to query biome information from the MGnify API. You can customize your query using various parameters such as page_size and max_depth to control the number of results and the depth of the biome hierarchy. You can use the same filtering and previewing methods as with the proxy, such as filter(), list_parameters(), and explain().

from mgnipy.V2.proxies import Biomes

biomes = Biomes(
    page_size=50,
)
print("Init url: ", biomes.request_url)
# if not sure what kwargs suupported
print("Supported kwargs for biomes: ", biomes.list_supported_params())
# and then
biomes = biomes.filter(
    page_size=15,
    max_depth=6,
)
print("Filtered url: ", biomes.request_url)
Init url:  https://www.ebi.ac.uk/metagenomics/api/v2/biomes?page=1&page_size=50
Supported kwargs for biomes:  ['biome_lineage', 'max_depth', 'page', 'page_size']
Filtered url:  https://www.ebi.ac.uk/metagenomics/api/v2/biomes?max_depth=6&page=1&page_size=15

Previewing your requests#

There is an optional intermediary step to

  • .preview() the first page of results, or

  • .dry_run() to print the number of pages and records to request

  • .explain() to print the planned request urls before .get()ting all the result pages.

biomes.explain(head=5)
# or
# biomes.dry_run()
# or
# biomes.preview()
Planning the API call with params:
{'page_size': 15, 'max_depth': 6}
Total pages to retrieve: 33
Total records to retrieve: 492
https://www.ebi.ac.uk/metagenomics/api/v2/biomes?max_depth=6&page=1&page_size=15
https://www.ebi.ac.uk/metagenomics/api/v2/biomes?max_depth=6&page=2&page_size=15
https://www.ebi.ac.uk/metagenomics/api/v2/biomes?max_depth=6&page=3&page_size=15
https://www.ebi.ac.uk/metagenomics/api/v2/biomes?max_depth=6&page=4&page_size=15
https://www.ebi.ac.uk/metagenomics/api/v2/biomes?max_depth=6&page=5&page_size=15

Carry out requests#

If happy with the plan, proceed with the async or sync get requests.

# asynchronously get the data
await biomes.aget()
Retrieving pages:   0%|          | 0/33 [00:00<?, ?it/s]
Retrieving pages:   3%|β–Ž         | 1/33 [00:00<00:31,  1.01it/s]
Retrieving pages:  18%|β–ˆβ–Š        | 6/33 [00:01<00:04,  6.67it/s]
Retrieving pages:  33%|β–ˆβ–ˆβ–ˆβ–Ž      | 11/33 [00:01<00:01, 11.52it/s]
Retrieving pages:  48%|β–ˆβ–ˆβ–ˆβ–ˆβ–Š     | 16/33 [00:01<00:01, 15.96it/s]
Retrieving pages:  64%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Ž   | 21/33 [00:01<00:00, 19.60it/s]
Retrieving pages:  79%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‰  | 26/33 [00:01<00:00, 22.50it/s]
Retrieving pages:  94%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–| 31/33 [00:01<00:00, 24.65it/s]
Retrieving pages: 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 33/33 [00:02<00:00, 16.18it/s]

Exploring the results#

Different means to access the retireved results

as a list#

biomes.to_list()[:5]
[{'biome_name': 'Algoconsortia',
  'lineage': 'root:Engineered:Lab enrichment:Defined media:Marine media:Algoconsortia'},
 {'biome_name': 'Undefined media',
  'lineage': 'root:Engineered:Lab enrichment:Undefined media'},
 {'biome_name': 'Lab Synthesis', 'lineage': 'root:Engineered:Lab Synthesis'},
 {'biome_name': 'Genetic cross',
  'lineage': 'root:Engineered:Lab Synthesis:Genetic cross'},
 {'biome_name': 'Modeled', 'lineage': 'root:Engineered:Modeled'}]

as a pandas dataframe#

biomes.to_df().head()
biome_name biome_lineage
0 Algoconsortia root:Engineered:Lab enrichment:Defined media:M...
1 Undefined media root:Engineered:Lab enrichment:Undefined media
2 Lab Synthesis root:Engineered:Lab Synthesis
3 Genetic cross root:Engineered:Lab Synthesis:Genetic cross
4 Modeled root:Engineered:Modeled

as a dictionary#

where each key is a page

# look at first 5 records of page 1
biomes.results[1][:5]
[{'biome_name': 'root', 'lineage': 'root'},
 {'biome_name': 'Control', 'lineage': 'root:Control'},
 {'biome_name': 'Engineered', 'lineage': 'root:Engineered'},
 {'biome_name': 'Biogas plant', 'lineage': 'root:Engineered:Biogas plant'},
 {'biome_name': 'Wet fermentation',
  'lineage': 'root:Engineered:Biogas plant:Wet fermentation'}]

Specific to the biomes, results can also be visualized as a tree β€œprint” β€œhshow” or β€œvshow”

biomes.show_tree()

Hide code cell output

root
β”œβ”€β”€ Engineered
β”‚   β”œβ”€β”€ Lab enrichment
β”‚   β”‚   β”œβ”€β”€ Defined media
β”‚   β”‚   β”‚   β”œβ”€β”€ Marine media
β”‚   β”‚   β”‚   β”‚   └── Algoconsortia
β”‚   β”‚   β”‚   β”œβ”€β”€ Aerobic media
β”‚   β”‚   β”‚   └── Anaerobic media
β”‚   β”‚   └── Undefined media
β”‚   β”œβ”€β”€ Lab Synthesis
β”‚   β”‚   └── Genetic cross
β”‚   β”œβ”€β”€ Modeled
β”‚   β”‚   β”œβ”€β”€ Simulated communities (DNA mixture)
β”‚   β”‚   β”œβ”€β”€ Simulated communities (microbial mixture)
β”‚   β”‚   β”œβ”€β”€ Simulated communities (sequence read mixture)
β”‚   β”‚   └── Sanger
β”‚   β”œβ”€β”€ Solid waste
β”‚   β”‚   β”œβ”€β”€ Composting
β”‚   β”‚   β”‚   β”œβ”€β”€ Bioreactor
β”‚   β”‚   β”‚   β”œβ”€β”€ Grass
β”‚   β”‚   β”‚   β”‚   └── Bioreactor
β”‚   β”‚   β”‚   └── Wood
β”‚   β”‚   β”‚       └── Bioreactor
β”‚   β”‚   β”œβ”€β”€ Landfill
β”‚   β”‚   └── Solid animal waste
β”‚   β”œβ”€β”€ Wastewater
β”‚   β”‚   β”œβ”€β”€ Activated Sludge
β”‚   β”‚   β”œβ”€β”€ Industrial wastewater
β”‚   β”‚   β”‚   β”œβ”€β”€ Agricultural wastewater
β”‚   β”‚   β”‚   β”œβ”€β”€ Landfill leachate
β”‚   β”‚   β”‚   β”œβ”€β”€ Mine water
β”‚   β”‚   β”‚   β”œβ”€β”€ Petrochemical
β”‚   β”‚   β”‚   └── Pulp and paper wastewater
β”‚   β”‚   β”œβ”€β”€ Nutrient removal
β”‚   β”‚   β”‚   β”œβ”€β”€ Biological phosphorus removal
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ Activated sludge
β”‚   β”‚   β”‚   β”‚   └── Bioreactor
β”‚   β”‚   β”‚   β”œβ”€β”€ Dissolved organics (aerobic)
β”‚   β”‚   β”‚   β”œβ”€β”€ Activated sludge
β”‚   β”‚   β”‚   β”œβ”€β”€ Dissolved organics (anaerobic)
β”‚   β”‚   β”‚   └── Nitrogen removal
β”‚   β”‚   β”‚       └── Anammox
β”‚   β”‚   └── Water and sludge
β”‚   β”œβ”€β”€ Biotransformation
β”‚   β”‚   β”œβ”€β”€ Mixed alcohol bioreactor
β”‚   β”‚   β”œβ”€β”€ Microbial enhanced oil recovery
β”‚   β”‚   └── Microbial solubilization of coal
β”‚   β”œβ”€β”€ Built environment
β”‚   β”œβ”€β”€ Food production
β”‚   β”‚   β”œβ”€β”€ Dairy products
β”‚   β”‚   β”œβ”€β”€ Fermented beverages
β”‚   β”‚   β”œβ”€β”€ Fermented seafood
β”‚   β”‚   β”œβ”€β”€ Fermented vegetables
β”‚   β”‚   └── Silage fermentation
β”‚   β”œβ”€β”€ Industrial production
β”‚   β”‚   └── Engineered product
β”‚   β”œβ”€β”€ Biogas plant
β”‚   β”‚   └── Wet fermentation
β”‚   β”œβ”€β”€ Bioreactor
β”‚   β”‚   └── Continuous culture
β”‚   β”‚       β”œβ”€β”€ Marine intertidal flat sediment inoculum
β”‚   β”‚       β”‚   └── Wadden Sea-Germany
β”‚   β”‚       └── Marine sediment inoculum
β”‚   β”‚           └── Wadden Sea-Germany
β”‚   └── Bioremediation
β”‚       β”œβ”€β”€ Hydrocarbon
β”‚       β”‚   └── Benzene
β”‚       β”‚       └── Bioreactor
β”‚       β”œβ”€β”€ Metal
β”‚       β”œβ”€β”€ Persistent organic pollutants (POP)
β”‚       β”œβ”€β”€ Polycyclic aromatic hydrocarbons
β”‚       β”œβ”€β”€ Terephthalate
β”‚       β”‚   └── Wastewater
β”‚       β”‚       β”œβ”€β”€ Activated sludge
β”‚       β”‚       └── Bioreactor
β”‚       └── Tetrachloroethylene and derivatives
β”‚           β”œβ”€β”€ Chloroethene
β”‚           β”‚   └── Bioreactor
β”‚           └── Tetrachloroethylene
β”‚               └── Bioreactor
β”œβ”€β”€ Control
β”œβ”€β”€ Environmental
β”‚   β”œβ”€β”€ Air
β”‚   β”‚   β”œβ”€β”€ Indoor Air
β”‚   β”‚   └── Outdoor Air
β”‚   β”œβ”€β”€ Aquatic
β”‚   β”‚   β”œβ”€β”€ Aquaculture
β”‚   β”‚   β”œβ”€β”€ Estuary
β”‚   β”‚   β”‚   └── Sediment
β”‚   β”‚   β”œβ”€β”€ Freshwater
β”‚   β”‚   β”‚   β”œβ”€β”€ Drinking water
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ Chlorinated
β”‚   β”‚   β”‚   β”‚   └── Delivery networks
β”‚   β”‚   β”‚   β”œβ”€β”€ Groundwater
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ Acid Mine Drainage
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ Biofilm
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ Cave water
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ Coalbed water
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ Contaminated
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ Mine
β”‚   β”‚   β”‚   β”‚   └── Mine drainage
β”‚   β”‚   β”‚   β”œβ”€β”€ Ice
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ Glacial lake
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ Glacier
β”‚   β”‚   β”‚   β”‚   └── Ice accretions
β”‚   β”‚   β”‚   β”œβ”€β”€ Pond
β”‚   β”‚   β”‚   β”‚   └── Sediment
β”‚   β”‚   β”‚   β”œβ”€β”€ Sediment
β”‚   β”‚   β”‚   β”œβ”€β”€ Storm water
β”‚   β”‚   β”‚   β”‚   └── Drainage pipe biofilm
β”‚   β”‚   β”‚   β”œβ”€β”€ Subglacial lake
β”‚   β”‚   β”‚   β”œβ”€β”€ Wetlands
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ Bog
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ Marsh
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ Sediment
β”‚   β”‚   β”‚   β”‚   └── Swamp
β”‚   β”‚   β”‚   β”œβ”€β”€ Lake
β”‚   β”‚   β”‚   β”œβ”€β”€ Lentic
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ Epilimnion
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ Hypolimnion
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ Limnetic zone
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ Littoral zone
β”‚   β”‚   β”‚   β”‚   └── Sediment
β”‚   β”‚   β”‚   β”œβ”€β”€ Lotic
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ Acidic
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ Low land river systems
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ Microbial mats
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ Mid stream
β”‚   β”‚   β”‚   β”‚   └── Sediment
β”‚   β”‚   β”‚   └── Microbialites
β”‚   β”‚   β”œβ”€β”€ Lentic
β”‚   β”‚   β”‚   └── Brackish
β”‚   β”‚   β”œβ”€β”€ Marine
β”‚   β”‚   β”‚   β”œβ”€β”€ Brackish
β”‚   β”‚   β”‚   β”œβ”€β”€ Coastal
β”‚   β”‚   β”‚   β”‚   └── Sediment
β”‚   β”‚   β”‚   β”œβ”€β”€ Cold seeps
β”‚   β”‚   β”‚   β”‚   └── Sediment
β”‚   β”‚   β”‚   β”œβ”€β”€ Fossil
β”‚   β”‚   β”‚   β”‚   └── Whale fall
β”‚   β”‚   β”‚   β”œβ”€β”€ Hydrothermal vents
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ Black smokers
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ Diffuse flow
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ Microbial mats
β”‚   β”‚   β”‚   β”‚   └── Sediment
β”‚   β”‚   β”‚   β”œβ”€β”€ Intertidal zone
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ Beach
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ Coral reef
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ Estuary
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ Mangrove swamp
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ Microbialites
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ Oil-contaminated
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ Salt marsh
β”‚   β”‚   β”‚   β”‚   └── Sediment
β”‚   β”‚   β”‚   β”œβ”€β”€ Marginal Sea
β”‚   β”‚   β”‚   β”œβ”€β”€ Neritic zone
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ Oil-contaminated sediment
β”‚   β”‚   β”‚   β”‚   └── Sediment
β”‚   β”‚   β”‚   β”œβ”€β”€ Oceanic
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ Abyssal plane
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ Aphotic zone
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ Benthic
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ Oil-contaminated
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ Oil-contaminated sediments
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ Photic zone
β”‚   β”‚   β”‚   β”‚   └── Sediment
β”‚   β”‚   β”‚   β”œβ”€β”€ Oil-contaminated sediment
β”‚   β”‚   β”‚   β”œβ”€β”€ Oil field
β”‚   β”‚   β”‚   β”‚   └── bore hole
β”‚   β”‚   β”‚   β”œβ”€β”€ Oil seeps
β”‚   β”‚   β”‚   β”œβ”€β”€ Pelagic
β”‚   β”‚   β”‚   β”œβ”€β”€ Sediment
β”‚   β”‚   β”‚   β”œβ”€β”€ Volcanic
β”‚   β”‚   β”‚   └── Wetlands
β”‚   β”‚   β”‚       └── Sediment
β”‚   β”‚   β”œβ”€β”€ Meromictic lake
β”‚   β”‚   β”œβ”€β”€ Non-marine Saline and Alkaline
β”‚   β”‚   β”‚   β”œβ”€β”€ Alkaline
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ Carbonate
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ Microbial mats
β”‚   β”‚   β”‚   β”‚   └── Sediment
β”‚   β”‚   β”‚   β”œβ”€β”€ Hypersaline
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ Microbial mats
β”‚   β”‚   β”‚   β”‚   └── Sediment
β”‚   β”‚   β”‚   β”œβ”€β”€ Near-boiling (>90C)
β”‚   β”‚   β”‚   β”œβ”€β”€ Saline
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ Athalassic
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ Epilimnion
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ Hypolimnion
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ Microbial mats
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ Sediment
β”‚   β”‚   β”‚   β”‚   └── Thalassic
β”‚   β”‚   β”‚   └── Salt crystallizer pond
β”‚   β”‚   β”‚       └── Microbial mats
β”‚   β”‚   β”œβ”€β”€ Sediment
β”‚   β”‚   └── Thermal springs
β”‚   β”‚       β”œβ”€β”€ Hot (42-90C)
β”‚   β”‚       β”œβ”€β”€ Acidic
β”‚   β”‚       β”œβ”€β”€ Alkaline
β”‚   β”‚       β”œβ”€β”€ Neutral
β”‚   β”‚       β”œβ”€β”€ Sediment
β”‚   β”‚       β”œβ”€β”€ Near-boiling (>90C)
β”‚   β”‚       β”œβ”€β”€ Tepid (25-34C)
β”‚   β”‚       └── Warm (34-42C)
β”‚   └── Terrestrial
β”‚       β”œβ”€β”€ Agricultural field
β”‚       β”œβ”€β”€ Asphalt lakes
β”‚       β”‚   └── Tar
β”‚       β”œβ”€β”€ Deep subsurface
β”‚       β”‚   └── Clay
β”‚       β”œβ”€β”€ Geologic
β”‚       β”‚   └── Mine
β”‚       β”œβ”€β”€ Oil reservoir
β”‚       β”œβ”€β”€ Rock-dwelling (subaerial biofilm)
β”‚       β”œβ”€β”€ Soil
β”‚       β”‚   β”œβ”€β”€ Agricultural
β”‚       β”‚   β”œβ”€β”€ Boreal forest
β”‚       β”‚   β”œβ”€β”€ Clay
β”‚       β”‚   β”‚   β”œβ”€β”€ Agricultural land
β”‚       β”‚   β”‚   β”œβ”€β”€ Contaminated
β”‚       β”‚   β”‚   β”œβ”€β”€ Grasslands
β”‚       β”‚   β”‚   └── Oil-contaminated
β”‚       β”‚   β”œβ”€β”€ Contaminated
β”‚       β”‚   β”œβ”€β”€ Crop
β”‚       β”‚   β”‚   └── Agricultural land
β”‚       β”‚   β”œβ”€β”€ Desert
β”‚       β”‚   β”œβ”€β”€ Forest soil
β”‚       β”‚   β”œβ”€β”€ Grasslands
β”‚       β”‚   β”œβ”€β”€ Loam
β”‚       β”‚   β”‚   β”œβ”€β”€ Agricultural
β”‚       β”‚   β”‚   β”œβ”€β”€ Contaminated
β”‚       β”‚   β”‚   β”œβ”€β”€ Forest soil
β”‚       β”‚   β”‚   └── Grasslands
β”‚       β”‚   β”œβ”€β”€ Wetlands
β”‚       β”‚   β”‚   └── Permafrost
β”‚       β”‚   β”œβ”€β”€ Mine
β”‚       β”‚   β”œβ”€β”€ Mine drainage
β”‚       β”‚   β”œβ”€β”€ Oil-contaminated
β”‚       β”‚   β”œβ”€β”€ Permafrost
β”‚       β”‚   β”œβ”€β”€ Sand
β”‚       β”‚   β”‚   β”œβ”€β”€ Desert
β”‚       β”‚   β”‚   β”œβ”€β”€ Forest soil
β”‚       β”‚   β”‚   β”œβ”€β”€ Grasslands
β”‚       β”‚   β”‚   └── Oil-contaminated
β”‚       β”‚   β”œβ”€β”€ Shrubland
β”‚       β”‚   β”œβ”€β”€ Silt
β”‚       β”‚   β”œβ”€β”€ Tropical rainforest
β”‚       β”‚   β”œβ”€β”€ Uranium contaminated
β”‚       β”‚   └── Viriome
β”‚       └── Volcanic
β”‚           └── Fumaroles
β”œβ”€β”€ Host-associated
β”‚   β”œβ”€β”€ Algae
β”‚   β”‚   β”œβ”€β”€ Brown Algae
β”‚   β”‚   β”œβ”€β”€ Green algae
β”‚   β”‚   β”‚   └── Ectosymbionts
β”‚   β”‚   └── Red algae
β”‚   β”‚       └── Ectosymbionts 
β”‚   β”œβ”€β”€ Amphibia
β”‚   β”‚   β”œβ”€β”€ Digestive system
β”‚   β”‚   └── Excretory system
β”‚   β”œβ”€β”€ Animal
β”‚   β”‚   β”œβ”€β”€ Circulatory system
β”‚   β”‚   β”œβ”€β”€ Digestive system
β”‚   β”‚   β”‚   └── Fecal
β”‚   β”‚   β”œβ”€β”€ Fossil
β”‚   β”‚   β”‚   β”œβ”€β”€ Bone
β”‚   β”‚   β”‚   └── Feces
β”‚   β”‚   β”œβ”€β”€ Reproductive system
β”‚   β”‚   β”œβ”€β”€ Respiratory system
β”‚   β”‚   └── Skin
β”‚   β”œβ”€β”€ Annelida
β”‚   β”‚   β”œβ”€β”€ Digestive system
β”‚   β”‚   β”‚   └── Digestive tube
β”‚   β”‚   β”‚       └── Extracellular symbionts
β”‚   β”‚   β”œβ”€β”€ Integument
β”‚   β”‚   β”‚   β”œβ”€β”€ Cuticle
β”‚   β”‚   β”‚   β”‚   └── Epibionts
β”‚   β”‚   β”‚   └── Subcuticular space
β”‚   β”‚   β”‚       └── Extracellular symbionts
β”‚   β”‚   β”œβ”€β”€ Intracellular endosymbionts
β”‚   β”‚   β”‚   └── Trophosome
β”‚   β”‚   └── Reproductive system
β”‚   β”‚       └── Egg capsule
β”‚   β”‚           └── Extracellular
β”‚   β”œβ”€β”€ Arthropoda
β”‚   β”‚   β”œβ”€β”€ Digestive system
β”‚   β”‚   β”‚   β”œβ”€β”€ Foregut
β”‚   β”‚   β”‚   β”œβ”€β”€ Gut
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ P3 segment
β”‚   β”‚   β”‚   β”‚   └── Proctodeal segment
β”‚   β”‚   β”‚   β”œβ”€β”€ Hindgut
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ P1 segment
β”‚   β”‚   β”‚   β”‚   └── P3 segment
β”‚   β”‚   β”‚   β”œβ”€β”€ Midgut
β”‚   β”‚   β”‚   └── Oral
β”‚   β”‚   β”‚       └── Saliva
β”‚   β”‚   β”œβ”€β”€ Integument
β”‚   β”‚   β”‚   └── Cuticle
β”‚   β”‚   β”‚       └── Thoracic segments
β”‚   β”‚   β”œβ”€β”€ Intracellular endosymbionts
β”‚   β”‚   β”‚   β”œβ”€β”€ Primary
β”‚   β”‚   β”‚   β”‚   └── Bacteriomes
β”‚   β”‚   β”‚   └── Secondary
β”‚   β”‚   β”œβ”€β”€ Oral cavity
β”‚   β”‚   β”œβ”€β”€ Respiratory system
β”‚   β”‚   β”‚   └── Gills
β”‚   β”‚   β”œβ”€β”€ Symbiotic fungal gardens and galleries
β”‚   β”‚   β”‚   β”œβ”€β”€ Fungus gallery
β”‚   β”‚   β”‚   └── Fungus garden
β”‚   β”‚   β”‚       └── Garden dump
β”‚   β”‚   └── Venom gland
β”‚   β”‚       └── Venom
β”‚   β”œβ”€β”€ Fish
β”‚   β”‚   β”œβ”€β”€ Digestive system
β”‚   β”‚   β”‚   β”œβ”€β”€ Foregut
β”‚   β”‚   β”‚   β”‚   └── Uncharacterized
β”‚   β”‚   β”‚   └── Intestine
β”‚   β”‚   β”œβ”€β”€ Excretory system
β”‚   β”‚   β”‚   └── Kidneys
β”‚   β”‚   β”œβ”€β”€ Reproductive system
β”‚   β”‚   β”œβ”€β”€ Skin
β”‚   β”‚   β”‚   └── Slime
β”‚   β”‚   └── Circulatory system
β”‚   β”‚       └── Blood
β”‚   β”œβ”€β”€ Fungi
β”‚   β”œβ”€β”€ Human
β”‚   β”‚   β”œβ”€β”€ Circulatory system
β”‚   β”‚   β”‚   └── Blood
β”‚   β”‚   β”œβ”€β”€ Digestive system
β”‚   β”‚   β”‚   β”œβ”€β”€ Hindgut
β”‚   β”‚   β”‚   β”‚   └── Rectum
β”‚   β”‚   β”‚   β”œβ”€β”€ Intestine
β”‚   β”‚   β”‚   β”œβ”€β”€ Large intestine
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ Fecal
β”‚   β”‚   β”‚   β”‚   └── Sigmoid colon
β”‚   β”‚   β”‚   └── Oral
β”‚   β”‚   β”‚       β”œβ”€β”€ Attached Keratinized gingiva
β”‚   β”‚   β”‚       β”œβ”€β”€ buccal mucosa
β”‚   β”‚   β”‚       β”œβ”€β”€ hard palate
β”‚   β”‚   β”‚       β”œβ”€β”€ Palatine tonsils
β”‚   β”‚   β”‚       β”œβ”€β”€ Periodontal pockets
β”‚   β”‚   β”‚       β”œβ”€β”€ Saliva
β”‚   β”‚   β”‚       β”œβ”€β”€ Subgingival plaque
β”‚   β”‚   β”‚       β”œβ”€β”€ Supragingival plaque
β”‚   β”‚   β”‚       β”œβ”€β”€ Throat
β”‚   β”‚   β”‚       └── tongue dorsum
β”‚   β”‚   β”œβ”€β”€ Excretory system
β”‚   β”‚   β”‚   └── Urethra
β”‚   β”‚   β”‚       └── Urine
β”‚   β”‚   β”œβ”€β”€ Fossil
β”‚   β”‚   β”‚   └── Bone
β”‚   β”‚   β”œβ”€β”€ Lympathic system
β”‚   β”‚   β”‚   └── Lymph nodes
β”‚   β”‚   β”œβ”€β”€ Milk
β”‚   β”‚   β”œβ”€β”€ Nervous system
β”‚   β”‚   β”‚   └── Cerebrospinal fluid
β”‚   β”‚   β”œβ”€β”€ Reproductive system
β”‚   β”‚   β”‚   β”œβ”€β”€ Female
β”‚   β”‚   β”‚   └── Vagina
β”‚   β”‚   β”‚       β”œβ”€β”€ Introitus
β”‚   β”‚   β”‚       β”œβ”€β”€ Midpoint vagina
β”‚   β”‚   β”‚       └── posterior fornix
β”‚   β”‚   β”œβ”€β”€ Skin
β”‚   β”‚   β”‚   β”œβ”€β”€ Naris
β”‚   β”‚   β”‚   β”œβ”€β”€ retroauricular crease
β”‚   β”‚   β”‚   β”œβ”€β”€ Umbilicus
β”‚   β”‚   β”‚   β”œβ”€β”€ Volar forearm
β”‚   β”‚   β”‚   β”œβ”€β”€ Axilla
β”‚   β”‚   β”‚   └── Medial distal leg
β”‚   β”‚   β”‚       └── Venous leg ulcers
β”‚   β”‚   └── Respiratory system
β”‚   β”‚       β”œβ”€β”€ Nasopharyngeal
β”‚   β”‚       β”‚   β”œβ”€β”€ anterior nares
β”‚   β”‚       β”‚   β”œβ”€β”€ Nasal cavity
β”‚   β”‚       β”‚   └── Pharynx
β”‚   β”‚       └── Pulmonary system
β”‚   β”‚           β”œβ”€β”€ Lung
β”‚   β”‚           β”œβ”€β”€ Sputum
β”‚   β”‚           β”œβ”€β”€ Trachea
β”‚   β”‚           └── Viriome
β”‚   β”œβ”€β”€ Birds
β”‚   β”‚   β”œβ”€β”€ Digestive system
β”‚   β”‚   β”‚   β”œβ”€β”€ Fecal
β”‚   β”‚   β”‚   β”œβ”€β”€ Small intestine
β”‚   β”‚   β”‚   β”‚   └── Duodenal
β”‚   β”‚   β”‚   β”œβ”€β”€ Ceca
β”‚   β”‚   β”‚   β”‚   └── Lumen
β”‚   β”‚   β”‚   β”œβ”€β”€ Crop
β”‚   β”‚   β”‚   β”‚   └── Lumen
β”‚   β”‚   β”‚   └── Digestive tube
β”‚   β”‚   β”‚       └── Cecum
β”‚   β”‚   β”œβ”€β”€ Reproductive system
β”‚   β”‚   β”œβ”€β”€ Respiratory system
β”‚   β”‚   β”‚   └── Lungs
β”‚   β”‚   └── Circulatory system
β”‚   β”‚       └── Blood
β”‚   β”œβ”€β”€ Cnidaria
β”‚   β”œβ”€β”€ Echinodermata
β”‚   β”œβ”€β”€ Endosymbionts
β”‚   β”‚   └── Fungi
β”‚   β”‚       └── Endosymbionts
β”‚   β”œβ”€β”€ Mammals
β”‚   β”‚   β”œβ”€β”€ Circulatory system
β”‚   β”‚   β”‚   └── Blood
β”‚   β”‚   β”œβ”€β”€ Digestive system
β”‚   β”‚   β”‚   β”œβ”€β”€ Fecal
β”‚   β”‚   β”‚   β”‚   └── Uncharacterized
β”‚   β”‚   β”‚   β”œβ”€β”€ Foregut
β”‚   β”‚   β”‚   β”‚   └── Rumen
β”‚   β”‚   β”‚   β”œβ”€β”€ Large intestine
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ Cecum
β”‚   β”‚   β”‚   β”‚   └── Fecal
β”‚   β”‚   β”‚   β”œβ”€β”€ Midgut
β”‚   β”‚   β”‚   β”œβ”€β”€ Oral cavity
β”‚   β”‚   β”‚   β”‚   └── Buccal mucosa
β”‚   β”‚   β”‚   └── Stomach
β”‚   β”‚   β”‚       β”œβ”€β”€ Endoperitrophic space
β”‚   β”‚   β”‚       └── Rumen
β”‚   β”‚   β”œβ”€β”€ Excretory system
β”‚   β”‚   β”‚   └── Urine
β”‚   β”‚   β”œβ”€β”€ Gastrointestinal tract
β”‚   β”‚   β”‚   └── Intestine
β”‚   β”‚   β”‚       └── Fecal
β”‚   β”‚   β”œβ”€β”€ Lymphatic
β”‚   β”‚   β”‚   └── Lymph nodes
β”‚   β”‚   β”œβ”€β”€ Milk
β”‚   β”‚   β”œβ”€β”€ Nervous system
β”‚   β”‚   β”‚   └── Brain
β”‚   β”‚   β”œβ”€β”€ Reproductive system
β”‚   β”‚   β”œβ”€β”€ Respiratory system
β”‚   β”‚   β”‚   β”œβ”€β”€ Nasopharyngeal
β”‚   β”‚   β”‚   β”‚   └── Nasal cavity
β”‚   β”‚   β”‚   └── Pulmonary system
β”‚   β”‚   β”‚       └── Viriome
β”‚   β”‚   └── Skin
β”‚   β”œβ”€β”€ Insecta
β”‚   β”‚   └── Digestive system
β”‚   β”œβ”€β”€ Invertebrates
β”‚   β”‚   β”œβ”€β”€ Bryozoans
β”‚   β”‚   β”‚   └── Gymnolaemates
β”‚   β”‚   β”œβ”€β”€ Cnidaria
β”‚   β”‚   β”‚   └── Coral
β”‚   β”‚   └── Echinodermata
β”‚   β”‚       └── Sea Urchin
β”‚   β”œβ”€β”€ Microbial
β”‚   β”‚   β”œβ”€β”€ Bacteria
β”‚   β”‚   └── Dinoflagellates
β”‚   β”‚       └── Endosymbionts
β”‚   β”œβ”€β”€ Mollusca
β”‚   β”‚   β”œβ”€β”€ Digestive system
β”‚   β”‚   β”‚   β”œβ”€β”€ Ceca
β”‚   β”‚   β”‚   β”‚   └── Uncharacterized
β”‚   β”‚   β”‚   └── Glands
β”‚   β”‚   β”œβ”€β”€ Respiratory system
β”‚   β”‚   β”‚   └── Gills
β”‚   β”‚   β”‚       β”œβ”€β”€ Extracellular
β”‚   β”‚   β”‚       └── Intracellular
β”‚   β”‚   └── Shell
β”‚   β”œβ”€β”€ Plants
β”‚   β”‚   β”œβ”€β”€ Phylloplane
β”‚   β”‚   β”‚   β”œβ”€β”€ Endophytes
β”‚   β”‚   β”‚   └── Epiphytes
β”‚   β”‚   β”œβ”€β”€ Rhizome
β”‚   β”‚   β”‚   └── Epiphytes
β”‚   β”‚   β”œβ”€β”€ Rhizoplane
β”‚   β”‚   β”‚   β”œβ”€β”€ Endophytes
β”‚   β”‚   β”‚   β”œβ”€β”€ Epiphytes
β”‚   β”‚   β”‚   └── Soil
β”‚   β”‚   β”œβ”€β”€ Rhizosphere
β”‚   β”‚   β”‚   β”œβ”€β”€ Epiphytes
β”‚   β”‚   β”‚   β”œβ”€β”€ Forest soil
β”‚   β”‚   β”‚   └── Soil
β”‚   β”‚   └── Root
β”‚   β”œβ”€β”€ Porifera
β”‚   β”œβ”€β”€ Protists
β”‚   β”œβ”€β”€ Protozoa
β”‚   β”œβ”€β”€ Reptile
β”‚   β”‚   └── Oral cavity
β”‚   β”‚       └── Venom gland
β”‚   β”‚           └── Venom
β”‚   β”œβ”€β”€ Spiralia
β”‚   └── Tunicates
β”‚       └── Ascidians
└── Mixed

Extra: Finding studies for a given biome#

# getting the biome_detail for a specific biome
a_biome = biomes["root:Engineered:Biogas plant:Wet fermentation"]
# what relationships can we traverse from biome detail?
a_biome.list_relationships()
Retrieving pages:   0%|          | 0/1 [00:00<?, ?it/s]
Retrieving pages: 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 1/1 [00:00<00:00, 16131.94it/s]
['studies']
# lazily access the studies list related to this biome (basically prepping query)
their_studies_list = a_biome.studies

# preview the requests that will be made to get the studies list
their_studies_list.explain()

# asynchronously get the studies list
await their_studies_list.aget()

# look at results
their_studies_list.to_df().head()
Planning the API call with params:
{'biome_lineage': 'root:Engineered:Biogas plant:Wet fermentation'}
Total pages to retrieve: 1
Total records to retrieve: 12
https://www.ebi.ac.uk/metagenomics/api/v2/studies?biome_lineage=root%3AEngineered%3ABiogas+plant%3AWet+fermentation&page=1
Retrieving pages:   0%|          | 0/1 [00:00<?, ?it/s]
Retrieving pages: 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 1/1 [00:00<00:00,  1.71it/s]
Retrieving pages: 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 1/1 [00:00<00:00,  1.71it/s]
accession ena_accessions title biome updated_at
0 MGYS00000364 [ERP005249, PRJEB5813] Metagenome sequencing of biogas plant operatin... {'biome_name': 'Wet fermentation', 'lineage': ... 2026-04-27T16:48:24.092000+00:00
1 MGYS00001584 [ERP008939, PRJEB7938] Functional redundant and similar microbial com... {'biome_name': 'Wet fermentation', 'lineage': ... 2026-04-28T05:52:47.418000+00:00
2 MGYS00001776 [ERP023030, PRJEB20841] Extraction and sequencing methodology affects ... {'biome_name': 'Wet fermentation', 'lineage': ... 2026-04-28T07:55:07.516000+00:00
3 MGYS00001781 [ERP023045, PRJEB20855] Whole shotgun metagenome sequencing of AD micr... {'biome_name': 'Wet fermentation', 'lineage': ... 2026-04-28T07:56:52.466000+00:00
4 MGYS00001815 [SRP027584, PRJNA212723] Substrate variations triggered the emergent of... {'biome_name': 'Wet fermentation', 'lineage': ... 2026-04-28T08:15:54.407000+00:00