Creates a new Cactus instance for the specified chemical.
The chemical name, formula, or identifier to query
Whether to return responses in XML format
Optional cache configuration
StaticclearClears the global cache shared across all Cactus instances.
PrivatequeryQueries the specified endpoint and returns the response text. Uses caching to avoid duplicate requests for the same URL.
The endpoint to query
Promise resolving to the response text or undefined if the request fails
const aspirin = new Cactus("aspirin");
const names = await aspirin.queryEndpoint("names");
// Returns: "2-acetyloxybenzoic acid\n2-Acetoxybenzoic acid\n50-78-2\n11126-35-5\n11126-37-7\n..."
aspirin.setFormatXML(true);
const names = await aspirin.queryEndpoint("names");
// Returns:
<request string="aspirin" representation="names">
<data id="1" resolver="name_by_cir" string_class="chemical name (CIR)" notation="Aspirin">
<item id="1" classification="pubchem_iupac_name">2-acetyloxybenzoic acid</item>
<item id="2" classification="pubchem_iupac_openeye_name">2-Acetoxybenzoic acid</item>
<item id="3" classification="pubchem_generic_registry_name">50-78-2</item>
<item id="7" classification="pubchem_generic_registry_name">26914-13-6</item>
<item id="8" classification="pubchem_generic_registry_name">98201-60-6</item>
<item id="9" classification="pubchem_substance_synonym">NCGC00090977-04</item>
<item id="10" classification="pubchem_substance_synonym">KBioSS_002272</item>
<item id="11" classification="pubchem_substance_synonym">SBB015069</item>
...
</data>
</request>
Retrieves all known names for the chemical.
Promise resolving to an array of chemical names
Filters the names from output of this.getNames() to those that are most likely to be used in common chemical nomenclature. This is done by just filtering for names that contain alpha characters only and spaces (no dashes, brackets, paretheses, etc.)
The maximum number of names to return (default: 4)
Promise resolving to an array of chemical names
This method is not guaranteed to return the most simple names. It is a best effort to filter out names that are not likely to be used in common chemical nomenclature. The results are also not sorted in any meaningful way.
For example, "aspirin" would be the obvious desired result when searching for other names for Aspirin (eg: "2-Acetoxybenzenecarboxylic acid"), but CACTUS returns it as the 12th result (as "Aspirin (JP15/USP)"). I'm not sure what the best way to sort these and return only the values that are most likely to yield search results.
Retrieves the SMILES notation for the chemical.
Promise resolving to the SMILES string
Retrieves the InChI identifier for the chemical.
Promise resolving to the InChI string
Retrieves the InChI Key for the chemical.
Promise resolving to the InChI Key string
Retrieves the FICTS identifier for the chemical.
Promise resolving to the FICTS string
Retrieves the FICUS identifier for the chemical.
Promise resolving to the FICUS string
Retrieves the UUUUU identifier for the chemical.
This "uuuuu identifier" is a hashcode representation of a chemical structure that considers the basic molecular connectivity, disregarding features like counterions or stereochemistry.
Promise resolving to the UUUUU string
Retrieves the HASHISY identifier for the chemical.
This "hashisy identifier" is a hashcode representation of a chemical structure that considers the basic molecular connectivity, disregarding features like counterions or stereochemistry.
Promise resolving to the HASHISY string
Retrieves a chemical structure file in the specified format.
The file format (e.g., "sdf", "jme", "mol", "pdb")
Whether to remove hydrogen atoms from the structure
Promise resolving to the file content as a string
Retrieves the chemical structure in SDF (Structure Data File) format.
Promise resolving to the SDF file content
Retrieves the chemical structure in JME (Java Molecular Editor) format.
Promise resolving to the JME format string
Retrieves the IUPAC name for the chemical.
Promise resolving to the IUPAC name
Retrieves the CAS registry number for the chemical.
Promise resolving to the CAS number
Retrieves the ChemSpider ID for the chemical.
Promise resolving to the ChemSpider ID
Retrieves the standardized InChI Key for the chemical.
Promise resolving to the standardized InChI Key
Retrieves the standardized InChI for the chemical.
Promise resolving to the standardized InChI
Retrieves the TWIRL identifier for the chemical.
Promise resolving to the TWIRL string
Retrieves the molecular weight of the chemical.
Promise resolving to the molecular weight as a string
Retrieves the molecular formula of the chemical.
Promise resolving to the molecular formula
Retrieves the number of hydrogen bond donors in the chemical.
Promise resolving to the hydrogen bond donor count
Retrieves the number of hydrogen bond acceptors in the chemical.
Promise resolving to the hydrogen bond acceptor count
Retrieves the number of hydrogen bond centers in the chemical.
Promise resolving to the hydrogen bond center count
Retrieves the number of Lipinski's Rule of Five violations.
Promise resolving to the Rule of Five violation count
Retrieves the number of rotatable bonds in the chemical.
Promise resolving to the rotatable bond count
Retrieves the effective number of rotatable bonds in the chemical.
Promise resolving to the effective rotatable bond count
Retrieves the number of rings in the chemical structure.
Promise resolving to the ring count
Retrieves the number of ring systems in the chemical structure.
Promise resolving to the ring system count
PrivatenameChemical name
PrivatecacheWhether to enable caching
Private ReadonlybaseBase URL
PrivateformatWhether to return responses in XML format
Private OptionalcacheCache
Private StaticglobalStatic cache shared across all Cactus instances
A client for the Cactus Chemical Identifier Resolver API.
This class provides methods to retrieve various chemical information including names, structures, properties, and identifiers from the NCI Cactus service.
API Documentation: https://cactus.nci.nih.gov/chemical/structure_documentation
This service works as a resolver for different chemical structure identifiers and allows one to convert a given structure identifier into another representation or structure identifier. You can either use the web form of the resolver or the following simple URL API scheme:
The service returns the requested new structure representation with a corresponding MIME-Type specification (in most cases MIME-Type: "text/plain"). If a requested URL is not resolvable for the service an HTML 404 status message is returned. In the (unlikely) case of an error, an HTML 500 status message is generated.
Example