mgnify_get: Get MGnify info via the API

View source: R/mgnify_api.R

mgnify_getR Documentation

Get MGnify info via the API

Description

MGnify API: https://www.ebi.ac.uk/metagenomics/api/v1/

Usage

mgnify_get(
  accession = NULL,
  section = c("samples", "studies", "analyses", "biomes", "experiment-types"),
  search = NULL,
  lineage = NULL,
  instrument_platform = NULL,
  instrument_model = NULL,
  query = list(),
  max_pages = 1,
  base_url = "https://www.ebi.ac.uk/metagenomics/api/v1/",
  cache_file = "mgnify_request.RDS",
  cache_break = 10,
  use_cache = TRUE,
  ...
)

Arguments

accession

Study accession (primary or secondary). If provided, just info returned for that study.

section

Section of the API to query.

search

General keyword search to filter records.

lineage

Filter by lineage (eg., "root:Host-associated:Human").

query

List of additional queries provided to httr::GET.

max_pages

The maximum number of pages of records to return.

base_url

MGnify API base url

cache_file

File name to cache (checkpoint) the results. Useful for big queries in case the job is interuppted.

cache_break

Write cache file every N pages.

use_cache

Read the cache file, if it exists?

...

Parameters passed to httr::GET

instrutment_platform

Sequencing instrument platform (eg., "ILLUMINA").

instrutment_model

Sequencing instrument model (eg., "HiSeq" or "MiSeq").

Details

This function can query any "section" of the API (eg., "studies" or "samples").

Main filtering options are listed in the function (eg., lineage). More queries can be provides as a list via the query parameter. Note that not all filtering options for work each section. To see all filtering options for each section, click the "Filters" button at https://www.ebi.ac.uk/metagenomics/api/v1/samples

To prevent accidental big queries, only 1 page of results is returned by default (max_pages).

Value

data.frame

Examples

mgnify_get()
mgnify_get(search='soil')
mgnify_get(section='biomes')
mgnify_get(section='experiment-types')
mgnify_get(accession = 'ERP009004', section='studies')
mgnify_get(lineage='root:Host-associated', instrument_platform = 'ILLUMINA',
            instrument_model = 'HiSeq', max_pages=8)
mgnify_get(accession = 'SRS2472313')

leylabmpi/LeyLabRMisc documentation built on Nov. 3, 2022, 3:45 p.m.