Skip to content

omnilab/kegg API reference

Floor
Provider · Omnilab
Version
1.x
Conformance suite
not wired
Verified for real
Its README does not say
Licence
MIT
composer require omnilab/kegg:1.x-dev

Read from the package's own PHP files at the commit d54f5d36a8be: its namespaces, classes, interfaces and enums, their public constants, properties and methods with their PHPDoc, and the options its factories take. Nothing of it is run.

Omnilab\Kegg

  • KeggSource class

    KEGG, the Kyoto Encyclopedia of Genes and Genomes (Kanehisa Laboratories), through its REST API at rest.kegg.jp: a compound ("C07481", caffeine), a drug ("D00528"), a reaction ("R00200"), a pathway map ("map00010", "hsa00010") or an enzyme ("2.7.1.40") by its KEGG identifier - names, formula, masses, a reaction's equation, a pathway's class and description, an enzyme's class and systematic name; the same thing in other bases (CAS, ChEBI, ChEMBL, Rhea) as identifiers; the reactions, pathways, enzymes and compounds it is tied to as related things -; a compound by its ChEBI id (KEGG's conv); a search of the configured databases (find).

    5 methods · 2 constants

  • KeggSourceFactory class

    KEGG: compounds, drugs, reactions, pathways and enzymes by their KEGG identifiers, their cross-references, and a search - no key, but KEGG's API is for academic use by academic users only (see the README).

    3 options

Omnilab\Kegg

KeggSource class

final class KeggSource extends HttpSource KeggSource.php:36

KEGG, the Kyoto Encyclopedia of Genes and Genomes (Kanehisa Laboratories), through its REST API at rest.kegg.jp: a compound ("C07481", caffeine), a drug ("D00528"), a reaction ("R00200"), a pathway map ("map00010", "hsa00010") or an enzyme ("2.7.1.40") by its KEGG identifier - names, formula, masses, a reaction's equation, a pathway's class and description, an enzyme's class and systematic name; the same thing in other bases (CAS, ChEBI, ChEMBL, Rhea) as identifiers; the reactions, pathways, enzymes and compounds it is tied to as related things -; a compound by its ChEBI id (KEGG's conv); a search of the configured databases (find).

KEGG's API is for academic use by academic users only (non-academic use needs a licence from Pathway Solutions); three calls a second at most, or KEGG blocks the caller: 0.34 s between two calls by default. One call an entity (two from a ChEBI id), one a database searched.

const BASE_URI = 'https://rest.kegg.jp/'
const DATABASES = ['compound' => Domain::CHEMISTRY, 'drug' => Domain::CHEMISTRY, 'reaction' => Domain::CHEMISTRY, 'pathway' => Domain::BIOLOGY, 'enzyme' => Domain::BIOLOGY]

The databases find can search, and the domain each belongs to.

KeggSource::__construct()

public function __construct(HttpClientInterface $http, readonly array $databases = ['compound'], string $baseUri = self::BASE_URI, array $headers = [], float $throttle = 0.34)
$databases

what search() searches, in this order (compound, drug, reaction, pathway, enzyme)

KeggSource::getName()

public function getName(): string

KeggSource::capabilities()

public function capabilities(): array

KeggSource::entity()

public function entity(Identifier|string $id): ?Entity

A compound or drug ("C07481", "cpd:C07481", "D00528"), a reaction ("R00200", "rn:R00200"), a pathway ("map00010", "hsa00010", "path:map00010"), an enzyme ("2.7.1.40", "EC 2.7.1.40", "ec:2.7.1.40"), a KEGG page, or a compound by its ChEBI id ("CHEBI:27732": KEGG's conv first); another base's identifier is refused before any call; null when KEGG has no such entry.

public function search(Query $query): Page

The entries whose names hold the text, in the configured databases (compound by default), in KEGG's order, one database after the other; a domain narrows to its databases (chemistry: compound, drug, reaction; biology: pathway, enzyme). An entity of a page holds its id and names: entity() reads it whole.

KeggSourceFactory class

final class KeggSourceFactory extends SourceFactory KeggSourceFactory.php:21

KEGG: compounds, drugs, reactions, pathways and enzymes by their KEGG identifiers, their cross-references, and a search - no key, but KEGG's API is for academic use by academic users only (see the README).

options: mailto: 'support@glitchr.io' # in the User-Agent databases: ['compound'] # what search() searches: compound, drug, reaction, pathway, enzyme throttle: 0.34 # seconds between two calls: KEGG blocks a caller above three a second base_uri: 'https://rest.kegg.jp/'

Options

OptionDefault
databases['compound']
throttle0.34
base_uriKeggSource::BASE_URI