openchemlib-extended
Advanced tools
Comparing version 3.3.0 to 4.0.0
'use strict'; | ||
var staticMethods = { | ||
DB: require('./db/DB'), | ||
DB: require('./db/MoleculeDB'), | ||
RXN: require('./rxn/RXN') | ||
@@ -30,3 +30,5 @@ }; | ||
getHoseCodesForAtom: require('./extend/getHoseCodesForAtom'), | ||
cleaveBonds: require('./extend/cleaveBonds') | ||
cleaveBonds: require('./extend/cleaveBonds'), | ||
getBoundary: require('./extend/getBoundary'), | ||
addMoleculeAndAlign: require('./extend/addMoleculeAndAlign') | ||
}; | ||
@@ -33,0 +35,0 @@ |
@@ -89,3 +89,3 @@ 'use strict'; | ||
}); // eslint-disable-line no-loop-func | ||
var fragment = new OCL.Molecule(); | ||
var fragment = new OCL.Molecule(0, 0); | ||
var atomMap = []; | ||
@@ -92,0 +92,0 @@ brokenMolecule.copyMoleculeByAtoms(fragment, includeAtom, false, atomMap); |
@@ -73,3 +73,3 @@ 'use strict'; | ||
}); | ||
fragment = new OCL.Molecule(); | ||
fragment = new OCL.Molecule(0, 0); | ||
atomMap = []; | ||
@@ -76,0 +76,0 @@ |
'use strict'; | ||
var floydWarshall = require('ml-floyd-warshall'); | ||
var Matrix = require('ml-matrix'); | ||
var Matrix = require('ml-matrix').Matrix; | ||
@@ -40,4 +40,8 @@ module.exports = function getAllPaths() { | ||
} | ||
if (results[key].fromAtoms.indexOf(from) === -1) results[key].fromAtoms.push(from); | ||
if (results[key].toAtoms.indexOf(to) === -1) results[key].toAtoms.push(to); | ||
if (results[key].fromAtoms.indexOf(from) === -1) { | ||
results[key].fromAtoms.push(from); | ||
} | ||
if (results[key].toAtoms.indexOf(to) === -1) { | ||
results[key].toAtoms.push(to); | ||
} | ||
} | ||
@@ -44,0 +48,0 @@ } |
'use strict'; | ||
var floydWarshall = require('ml-floyd-warshall'); | ||
var Matrix = require('ml-matrix'); | ||
var Matrix = require('ml-matrix').Matrix; | ||
@@ -6,0 +6,0 @@ module.exports = function (OCL) { |
@@ -24,3 +24,3 @@ | ||
var fragment = new OCL.Molecule(); | ||
var fragment = new OCL.Molecule(0, 0); | ||
var results = []; | ||
@@ -27,0 +27,0 @@ var min = 0; |
{ | ||
"name": "openchemlib-extended", | ||
"version": "3.3.0", | ||
"version": "4.0.0", | ||
"description": "Openchemlib extended", | ||
@@ -29,3 +29,3 @@ "keywords": [ | ||
"build-clean": "rimraf ./lib/", | ||
"build-dist": "cheminfo build -u --babel", | ||
"build-dist": "cheminfo build -u", | ||
"eslint": "eslint src", | ||
@@ -38,12 +38,12 @@ "eslint-fix": "npm run eslint -- --fix", | ||
"babel-cli": "^6.23.0", | ||
"babel-preset-env": "^1.6.1", | ||
"babel-preset-env": "^1.7.0", | ||
"benchmark": "^2.1.3", | ||
"cheminfo-tools": "^1.20.2", | ||
"cheminfo-tools": "^1.22.4", | ||
"eslint": "^4.19.1", | ||
"eslint-config-cheminfo": "^1.17.2", | ||
"eslint-plugin-import": "^2.10.0", | ||
"eslint-plugin-jest": "^21.15.0", | ||
"eslint-config-cheminfo": "^1.18.0", | ||
"eslint-plugin-import": "^2.14.0", | ||
"eslint-plugin-jest": "^21.27.2", | ||
"eslint-plugin-no-only-tests": "^1.1.0", | ||
"jest": "^22.4.3", | ||
"npm-run-all": "^4.1.2", | ||
"jest": "^23.0.0", | ||
"npm-run-all": "^4.1.3", | ||
"rimraf": "^2.6.2", | ||
@@ -54,9 +54,9 @@ "should": "^11.2.1" | ||
"ml-floyd-warshall": "^1.0.0", | ||
"ml-matrix": "^2.3.0", | ||
"openchemlib": "^5.5.2", | ||
"papaparse": "^4.3.7", | ||
"rxn-parser": "0.0.2", | ||
"sdf-parser": "^1.0.0", | ||
"ml-matrix": "^5.2.0", | ||
"openchemlib": "^5.6.1", | ||
"papaparse": "^4.6.2", | ||
"rxn-parser": "0.1.0", | ||
"sdf-parser": "^3.1.0", | ||
"setimmediate": "^1.0.2" | ||
} | ||
} |
121
README.md
# 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] | ||
[![NPM version][npm-image]][npm-url] | ||
[![build status][travis-image]][travis-url] | ||
[![David deps][david-image]][david-url] | ||
[![npm download][download-image]][download-url] | ||
@@ -12,12 +12,73 @@ Openchemlib extended | ||
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: | ||
- oclCode (or idCode or value): 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 | ||
- SMILES | ||
- Molecular formula | ||
- Molecular weight | ||
- idCode | ||
``` | ||
@@ -28,6 +89,6 @@ var rxn = new RXN(rxnFile) | ||
methods on rxn: | ||
* addReagent(molfile) | ||
* addProduct(molfile) | ||
* toRXN() : create a new RXN file | ||
- addReagent(molfile) | ||
- addProduct(molfile) | ||
- toRXN() : create a new RXN file | ||
@@ -42,4 +103,5 @@ ## Molecule extension | ||
options: | ||
* atomLabel: filter to show only a specific atom (default: '') | ||
- atomLabel: filter to show only a specific atom (default: '') | ||
### getAtomsInfo(options) | ||
@@ -55,8 +117,7 @@ | ||
options: | ||
* height (default: 300) | ||
* width (default: 200) | ||
* prefix : prefix for the id of each SVG element (default: ocl) | ||
- height (default: 300) | ||
- width (default: 200) | ||
- prefix : prefix for the id of each SVG element (default: ocl) | ||
### getDiastereotopicHoseCodes(options) | ||
@@ -67,4 +128,5 @@ | ||
options: | ||
* maxSphereSize: maxSphere for hose code calculation | ||
- maxSphereSize: maxSphere for hose code calculation | ||
### getGroupedHOSECodes(options) | ||
@@ -75,5 +137,6 @@ | ||
options: | ||
* atomLabel: filter to show only a specific atom (default: '') | ||
* maxSphereSize: maxSphere for hose code calculation | ||
- atomLabel: filter to show only a specific atom (default: '') | ||
- maxSphereSize: maxSphere for hose code calculation | ||
### toVisualizerMolfile() | ||
@@ -92,7 +155,7 @@ | ||
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) | ||
- 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) | ||
@@ -106,7 +169,9 @@ ### getConnectivityMatrix(options) | ||
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) | ||
- 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: | ||
``` | ||
@@ -119,4 +184,2 @@ var OCLE = require('openchemlib-extended'); | ||
### getMF() | ||
@@ -130,3 +193,3 @@ | ||
[BSD-3-Clause](./LICENSE) | ||
[BSD-3-Clause](./LICENSE) | ||
@@ -133,0 +196,0 @@ [npm-image]: https://img.shields.io/npm/v/openchemlib-extended.svg?style=flat-square |
83920
34
2155
194
+ Addedcore-util-is@1.0.3(transitive)
+ Addedduplexer2@0.1.4(transitive)
+ Addedinherits@2.0.4(transitive)
+ Addedisarray@1.0.0(transitive)
+ Addedml-matrix@5.3.0(transitive)
+ Addedmultipipe@2.0.3(transitive)
+ Addedobject-assign@4.1.1(transitive)
+ Addedprocess-nextick-args@2.0.1(transitive)
+ Addedreadable-stream@2.3.8(transitive)
+ Addedrxn-parser@0.1.0(transitive)
+ Addedsafe-buffer@5.1.2(transitive)
+ Addedsdf-parser@3.1.0(transitive)
+ Addedsplit2@2.2.0(transitive)
+ Addedstring_decoder@1.1.1(transitive)
+ Addedthrough2@2.0.5(transitive)
+ Addedthrough2-filter@2.0.0(transitive)
+ Addedutil-deprecate@1.0.2(transitive)
+ Addedxtend@4.0.2(transitive)
- Removedml-array-utils@0.3.0(transitive)
- Removedml-matrix@2.3.0(transitive)
- Removedml-stat@1.3.3(transitive)
- Removedrxn-parser@0.0.2(transitive)
- Removedsdf-parser@1.0.0(transitive)
Updatedml-matrix@^5.2.0
Updatedopenchemlib@^5.6.1
Updatedpapaparse@^4.6.2
Updatedrxn-parser@0.1.0
Updatedsdf-parser@^3.1.0