Package 'BioThingsClient.R'

Title: BioThings Client (https://github.com/biothings/BioThingsClient.R)
Description: This is a unified R client for all "BioThings APIs" (more at http://biothings.io). BioThings APIs are a collection of high-performance APIs for variety of aggregated entity-type specific annotations, such as genes, variants, chemicals, drugs etc. (so called "BioThings"). It also provides a SDK (BioThings SDK) for users to build their own BioThings API for any biological entity types. This client provides a generic R library for existing BioThings APIs as well as the new BioThings APIs will be created in the future, either by us or users.
Authors: Thomas Johnson <[email protected]>
Maintainer: Thomas Johnson <[email protected]>
License: Apache License 2.0
Version: 0.99.1
Built: 2026-06-11 04:18:48 UTC
Source: https://github.com/biothings/BioThingsClient.R

Help Index


BioThings API Client Configuration

Description

This is a list that containts configuration information for each Biothings API:

Usage

biothings_clients

Format

An object of class list of length 4.

Details

BioThings APIs:

To integrate a new API into the package, be sure to update this in addition to generating the associated methods from getThing and getThings.


BioThingsClient

Description

An S4 Class to access BioThings APIs.

BioThings APIs:

Value

An S4 class object of the class Biothings.

Slots

client

A client configuration list.

version

The version of the BioThings package.

verbose

logical.

debug

logical.

Examples

biothings <- BioThingsClient("gene")
slot(biothings, "verbose") <- FALSE # default is TRUE
biothings

btFields

Description

Get field metadata information from BioThings API field metadata endpoints

Usage

btFields(biothings, ...)

## S4 method for signature 'BioThingsClient'
btFields(biothings, ...)

## S4 method for signature 'character'
btFields(biothings, ...)

Arguments

biothings

A BioThings class object

...

Additional API parameters. See API documentation.

Value

A list of results from the metadata fields endpoint

Examples

fields <- btFields("gene")
head(fields)

Get items from BioThings APIs

Description

Use gene, taxon, variant, chemical and other IDs to get annotation information from BioThings APIs.

Usage

btGet(biothings, ids, fields, ..., return.as = "records")

## S4 method for signature 'BioThingsClient'
btGet(biothings, ids, fields, ...,
  return.as = "records")

## S4 method for signature 'character'
btGet(biothings, ids, fields, ...,
  return.as = "records")

## S4 method for signature 'missing'
btGet(biothings, ids, fields, ..., return.as = "records")

Arguments

biothings

BioThings object or character .

ids

character.

fields

Specify fields to receive from API

...

Other parameters to pass to API

return.as

character.

Value

The API response in the form of the provided argument return.as

Examples

#Equivalent:

btGet("gene", "1017", fields = c("symbol","name","taxid","entrezgene"),
      return.as = "text")

btMetadata

Description

Get metadata information from BioThings API metadata endpoints

Usage

btMetadata(biothings, ...)

## S4 method for signature 'BioThingsClient'
btMetadata(biothings, ...)

## S4 method for signature 'character'
btMetadata(biothings, ...)

Arguments

biothings

A BioThings class object

...

Additional API parameters. See API documentation.

Value

A list of results from the metadata endpoint

Examples

metadata <- btMetadata("gene")
head(metadata)

btQuery

Description

Retrieve results from the query endpoint of BioThings APIs

Usage

btQuery(biothings, q, ..., fetch_all = FALSE, scopes, return.as = "records")

## S4 method for signature 'BioThingsClient'
btQuery(biothings, q, ..., fetch_all = FALSE,
  scopes, return.as = "records")

## S4 method for signature 'missing'
btQuery(biothings, q, ..., fetch_all = FALSE, scopes,
  return.as = "records")

## S4 method for signature 'character'
btQuery(biothings, q, ..., fetch_all = FALSE, scopes,
  return.as = "records")

Arguments

biothings

An S4 class BioThings object

q

A query string

...

Any parameters to pass to API

fetch_all

This returns a list of _all_ results for a query, regardless of return.as. See the API documentation.

scopes

One or more fields (separated by comma) as the search "scopes"

return.as

Type of return value

Value

Returns the API result as the provided return.as type

Examples

btQuery("gene", q = "NM_013993")
gene_client <- BioThingsClient("gene")
btQuery(gene_client, "NM_013993")