Skip to content

omnilab/cactus 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/cactus:1.x-dev

Read from the package's own PHP files at the commit bf907cf93e8a: 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\Cactus

  • CactusSource class

    The NCI/CADD Chemical Identifier Resolver (CIR, cactus.nci.nih.gov): a structure from whatever names it - a name ("caffeine", "acetylsalicylic acid"), a CAS number, an InChIKey, a standard InChI, a SMILES - turned into the others: its standard InChIKey (its id here: CIR keeps none of its own), standard InChI, SMILES, IUPAC name, formula, molecular weight, CAS numbers and names, and a picture of it.

    4 methods · 3 constants

  • CactusSourceFactory class

    The NCI/CADD Chemical Identifier Resolver: a structure from a name, a CAS number, an InChIKey, an InChI or a SMILES, and its other identifiers and representations; OPSIN for a name it cannot read - no key needed.

    5 options

Omnilab\Cactus

CactusSource class

final class CactusSource extends HttpSource CactusSource.php:45

The NCI/CADD Chemical Identifier Resolver (CIR, cactus.nci.nih.gov): a structure from whatever names it - a name ("caffeine", "acetylsalicylic acid"), a CAS number, an InChIKey, a standard InChI, a SMILES - turned into the others: its standard InChIKey (its id here: CIR keeps none of its own), standard InChI, SMILES, IUPAC name, formula, molecular weight, CAS numbers and names, and a picture of it.

A name CIR cannot resolve is given to OPSIN (the University of Cambridge's IUPAC name parser, served by the EBI), once, unless opsin is off: CIR already reads systematic names with OPSIN first (its resolver "name_by_opsin"), so OPSIN is no other base - no identifier, no record - but the current parser, asked when CIR's fails or is out of date; what it gives (standard InChI and InChIKey, SMILES) is then asked of CIR by the InChI for the rest.

One call a representation: up to eight an entity (the InChIKey first, in CIR's XML, which says what CIR read the string as; nothing more is asked of what CIR cannot resolve), one more to OPSIN for a name CIR does not know. CIR answers text; a structure it cannot resolve is an empty XML answer, a 404, or a 500 whose page says "Page not found": null. No key, no published rate.

const BASE_URI = 'https://cactus.nci.nih.gov/chemical/structure/'
const REPRESENTATIONS = ['stdinchi', 'smiles', 'iupac_name', 'formula', 'mw', 'cas', 'names']

What entity() asks after the InChIKey, by default.

const OPSIN_URI = 'https://www.ebi.ac.uk/opsin/ws/'

CactusSource::__construct()

public function __construct(HttpClientInterface $http, readonly array $representations = self::REPRESENTATIONS, readonly int $names = 20, string $baseUri = self::BASE_URI, array $headers = [], float $throttle = 0.0, readonly ?string $opsinUri = self::OPSIN_URI)
$representations

what entity() asks after the InChIKey (of self::REPRESENTATIONS)

$names

how many names to keep as synonyms

CactusSource::getName()

public function getName(): string

CactusSource::capabilities()

public function capabilities(): array

CactusSource::entity()

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

A structure by an InChIKey, a standard InChI or a CAS number (as an Identifier or a string), or by a name or a SMILES (a string no scheme reads); an identifier of another base is refused before any call (CIR does not resolve PubChem's or ChEBI's ids); null when CIR cannot resolve it.

CactusSourceFactory class

final class CactusSourceFactory extends SourceFactory CactusSourceFactory.php:24

The NCI/CADD Chemical Identifier Resolver: a structure from a name, a CAS number, an InChIKey, an InChI or a SMILES, and its other identifiers and representations; OPSIN for a name it cannot read - no key needed.

options: mailto: 'support@glitchr.io' # in the User-Agent representations: [stdinchi, smiles, iupac_name, formula, mw, cas, names] # one call each, after the InChIKey names: 20 # how many names to keep as synonyms (0: the names are not asked) opsin: true # a name CIR cannot read is given to OPSIN (false: never; or OPSIN's address) throttle: 0 # seconds between two calls: CIR publishes no rate base_uri: 'https://cactus.nci.nih.gov/chemical/structure/'

Options

OptionDefault
representationsCactusSource::REPRESENTATIONS
names20
opsintrue
throttle0.0
base_uriCactusSource::BASE_URI