npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

openchemlib-extended

v6.0.0

Published

Openchemlib extended

Downloads

37

Readme

openchemlib-extended

NPM version build status David deps npm download

Openchemlib extended

DB

It allows to create a database of molecule and make substructure search

const MoleculeDB = require(OCLE).DB;

let moleculeDB = new MoleculeDB();
moleculeDB.pushMoleculeInfo({ smiles: 'CCCC' });
moleculeDB.pushMoleculeInfo({ smiles: 'CCCC' });
moleculeDB.pushMoleculeInfo({ smiles: 'CCCCC' });

let result = moleculeDB.search('CC', {
  format: 'smiles',
  mode: 'substructure',
  flattenResult: false,
  keepMolecule: false
});

Molecule.DB(options)

Class that allows to create a database of molecules in memory

let moleculeDB = new MoleculeDB({ computeProperties: true });

moleculeDB.search( query, options )

  • query: molfile, smiles, idCode or a molecule (instance of OCL.Molecule)
  • options:
    • format: 'smiles', 'molfile' or 'idcode'
    • mode: 'exact', 'substructure' or 'similarity'
    • flattenResult: after query should we keep the unique molecule hierarchy ?
    • keepMolecule: keep the molecule (OCL.Molecule) object in the result
    • computeProperties: predict properties like logP, logS, etc.

parseSDF

const MoleculeDB = require(OCLE).DB;
MoleculeDB.parseSDF(sdf, { computeProperties: true });

parseCSV

const MoleculeDB = require(OCLE).DB;
MoleculeDB.parseCSV(csv, { computeProperties: true });

pushMoleculeInfo(moleculeInfo, data)

moleculeInfo is an object that may contain the following properties:

  • idCode: the OCL unique code
  • smiles
  • molfile
  • index (OCL substructure search index, if not present will be calculated)
  • mw (used to sort search results, if not present will be calculated)

pushEntry(molecule, data, moleculeInfo)

RXN

Create an instance of the RXN object based on a text file in RXN format. This will also calculate for each reagent and product:

  • SMILES
  • Molecular formula
  • Molecular weight
  • idCode
var rxn = new RXN(rxnFile)

methods on rxn:

  • addReagent(molfile)
  • addProduct(molfile)
  • toRXN() : create a new RXN file

Molecule extension

getGroupedDiastereotopicAtomIDs(options)

Returns an array containing all the different diastereotopic atoms in the molecule with the occurence of each of them. It may be useful to first create the implicit hydrogens before using the method ``Molecule.addImplicitHydrogens()```.

options:

  • atomLabel: filter to show only a specific atom (default: '')

getAtomsInfo(options)

Returns an array containing many informations about the atoms. It may be useful to first create the implicit hydrogens before using the method ``Molecule.addImplicitHydrogens()```.

toDiastereotopicSVG(options)

Return a SVG containing a circle at the level of each atom having a data-atomid a diastereoisotopic unique identifier.

options:

  • height (default: 300)
  • width (default: 200)
  • prefix : prefix for the id of each SVG element (default: ocl)

getDiastereotopicHoseCodes(options)

Returns an array containing diastereotopic hoses codes

options:

  • maxSphereSize: maxSphere for hose code calculation

getGroupedHOSECodes(options)

Returns an extended groupedDiastereotopicID with hoses

options:

  • atomLabel: filter to show only a specific atom (default: '')
  • maxSphereSize: maxSphere for hose code calculation

toVisualizerMolfile()

getNumberOfAtoms()

getExtendedDiastereotopicAtomIDs()

Returns an array of explicit hydrogens added molecule of diastereotopicAtomIDs. Extra information like the diastereotopicIDs of the molecule are added

getAllPaths(options)

Returns an array containing all-pairs shortest paths from a connectivity matrix using the FloydWarshall algorithm. options:

  • fromLabel: filter the pairs that start from this specific atom (default: '')
  • toLabel: filter the pairs that end at this specific atom (default: '')
  • minLength: min path length to report (default: 1)
  • maxLength: max path length to report (default: 4)

getConnectivityMatrix(options)

Returns an array of array (matrix) containing a '1' for all the connected atoms. An atom is considered connected to itself (dialog is equal to 1). Options allows to tune the values you want in the matrix.

Options:

  • sdt: put the bond order outside the diagonal (default: false)
  • mass: put the rounded mass on the diagonal (default: false)
  • atomicNo: put the atomic number on the diagonal (default: false)

Example using npm:

var OCLE = require('openchemlib-extended');
var molecule = OCLE.Molecule.fromSmiles('c1ccccc1');
var matrix = molecule.getConnectivityMatrix({mass: true, sdt: true});
console.log(matrix);

getMF()

Return an object containing the molecular formula and the molecular formula of each distinct part of the molecule. The molecular formula takes into account multihydrates, charges and isotopes.

License

BSD-3-Clause