# openchemlib-extended

> Openchemlib extended

Latest version **6.0.0** (published 2019-03-28) · BSD-3-Clause license · 0 weekly downloads

## Install

```sh
npm install openchemlib-extended
pnpm add openchemlib-extended
yarn add openchemlib-extended
bun add openchemlib-extended
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 6.0.0 |
| Published | 2019-03-28 |
| First published | 2015-10-05 |
| Weekly downloads | 0 |
| License | BSD-3-Clause |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 6 |
| Unpacked size | 69.1 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Michaël Zasso |
| Maintainers | cheminfo-bot, jeffersonh44, lpatiny, maasencioh, stropitek, targos |
| Keywords | openchemlib, ocl |

## Links

- npm: https://www.npmjs.com/package/openchemlib-extended
- Repository: https://github.com/cheminfo-js/openchemlib-extended
- Issues: https://github.com/cheminfo-js/openchemlib-extended/issues
- npm.io page: https://npm.io/package/openchemlib-extended

## Dependencies (6)

- [ml-matrix](https://npm.io/package/ml-matrix.md) ^5.3.0
- [papaparse](https://npm.io/package/papaparse.md) ^4.6.3
- [rxn-parser](https://npm.io/package/rxn-parser.md) 0.1.0
- [sdf-parser](https://npm.io/package/sdf-parser.md) ^3.1.0
- [openchemlib](https://npm.io/package/openchemlib.md) ^6.0.1
- [ml-floyd-warshall](https://npm.io/package/ml-floyd-warshall.md) ^1.0.0

## Recent versions

- 6.0.0 (latest) — 2019-03-28
- 4.0.1 — 2018-11-28
- 4.0.0 — 2018-11-28
- 3.3.0 — 2018-05-23
- 3.2.0 — 2018-04-09
- 3.0.0 — 2017-11-01
- 2.4.1 — 2017-09-05
- 2.3.3 — 2017-07-06
- 2.3.1 — 2017-07-04
- 2.3.0 — 2017-07-04
- 2.2.0 — 2017-03-21
- 2.1.4 — 2017-03-16
- 2.1.3 — 2017-03-15
- 2.1.2 — 2017-03-10
- 2.1.1 — 2017-03-10
- … 13 more at https://npm.io/package/openchemlib-extended/versions

## README

# openchemlib-extended

[![NPM version][npm-image]][npm-url]
[![build status][travis-image]][travis-url]
[![David deps][david-image]][david-url]
[![npm download][download-image]][download-url]

Openchemlib extended

## DB

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

```js
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

```js
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

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

### parseCSV

```js
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](./LICENSE)

[npm-image]: https://img.shields.io/npm/v/openchemlib-extended.svg?style=flat-square
[npm-url]: https://www.npmjs.com/package/openchemlib-extended
[travis-image]: https://img.shields.io/travis/cheminfo-js/openchemlib-extended/master.svg?style=flat-square
[travis-url]: https://travis-ci.org/cheminfo-js/openchemlib-extended
[david-image]: https://img.shields.io/david/cheminfo-js/openchemlib-extended.svg?style=flat-square
[david-url]: https://david-dm.org/cheminfo-js/openchemlib-extended
[download-image]: https://img.shields.io/npm/dm/openchemlib-extended.svg?style=flat-square
[download-url]: https://www.npmjs.com/package/openchemlib-extended

---
_Source: https://npm.io/package/openchemlib-extended · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
