openchemlib-utils
Advanced tools
Comparing version 2.0.0 to 2.1.0
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
var floydWarshall = require('ml-floyd-warshall'); | ||
@@ -12,8 +10,2 @@ var mlMatrix = require('ml-matrix'); | ||
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } | ||
var floydWarshall__default = /*#__PURE__*/_interopDefaultLegacy(floydWarshall); | ||
var atomSorter__default = /*#__PURE__*/_interopDefaultLegacy(atomSorter); | ||
var Papa__default = /*#__PURE__*/_interopDefaultLegacy(Papa); | ||
let xAtomicNumber = 0; | ||
@@ -256,2 +248,23 @@ | ||
/** | ||
* Parse a molfile and returns an object containing the molecule, the map and the diaIDs | ||
* The map allows to reload properties assigned to the atom molfile | ||
* Pelase take care than numbering of atoms starts at 0 ! | ||
* @param {object} OCL - openchemlib library | ||
* @param {string} molfile | ||
* @returns | ||
*/ | ||
function getDiastereotopicAtomIDsFromMolfile(OCL, molfile) { | ||
const { map, molecule } = OCL.Molecule.fromMolfileWithAtomMap(molfile); | ||
const diaIDsArray = getDiastereotopicAtomIDsAndH(molecule); | ||
const diaIDs = {}; | ||
for (let i = 0; i < map.length; i++) { | ||
diaIDs[map[i]] = { source: map[i], destination: i, ...diaIDsArray[i] }; | ||
} | ||
return { map: diaIDs, molecule, diaIDs: diaIDsArray }; | ||
} | ||
/** | ||
* Check if a specific atom is a sp3 carbon | ||
@@ -892,3 +905,3 @@ * @param {OCL.Molecule} molecule | ||
if (options.pathLength) { | ||
result = floydWarshall__default["default"](new mlMatrix.Matrix(result)).to2DArray(); | ||
result = floydWarshall(new mlMatrix.Matrix(result)).to2DArray(); | ||
} | ||
@@ -969,3 +982,3 @@ return result; | ||
let mf = ''; | ||
let keys = Object.keys(mfs).sort(atomSorter__default["default"]); | ||
let keys = Object.keys(mfs).sort(atomSorter); | ||
for (let key of keys) { | ||
@@ -1393,3 +1406,3 @@ mf += key; | ||
const parsed = Papa__default["default"].parse(csv, options); | ||
const parsed = Papa.parse(csv, options); | ||
const fields = parsed.meta.fields; | ||
@@ -1538,2 +1551,12 @@ const stats = new Array(fields.length); | ||
/** | ||
* | ||
* @param {MoleculesDB} moleculesDB | ||
* @param {OCL.Molecule} molecule | ||
* @param {object} data | ||
* @param {object} [moleculeInfo] | ||
* @param {string} [moleculeInfo.idCode] | ||
* @param {number[]} [moleculeInfo.index] | ||
*/ | ||
function pushEntry( | ||
@@ -2084,2 +2107,3 @@ moleculesDB, | ||
exports.getDiastereotopicAtomIDsAndH = getDiastereotopicAtomIDsAndH; | ||
exports.getDiastereotopicAtomIDsFromMolfile = getDiastereotopicAtomIDsFromMolfile; | ||
exports.getGroupedDiastereotopicAtomIDs = getGroupedDiastereotopicAtomIDs; | ||
@@ -2086,0 +2110,0 @@ exports.getHoseCodesAndDiastereotopicIDs = getHoseCodesAndDiastereotopicIDs; |
{ | ||
"name": "openchemlib-utils", | ||
"version": "2.0.0", | ||
"version": "2.1.0", | ||
"description": "Various utilities that extends openchemlib-js like HOSE codes or diastereotopic IDs", | ||
@@ -12,3 +12,3 @@ "main": "lib/index.js", | ||
"scripts": { | ||
"build": "rollup -c && cheminfo-build --entry src/index.js --root OCLUtils", | ||
"build": "rollup -c --bundleConfigAsCjs && cheminfo-build --entry src/index.js --root OCLUtils", | ||
"eslint": "eslint src", | ||
@@ -18,3 +18,3 @@ "eslint-fix": "npm run eslint -- --fix", | ||
"prettier-write": "prettier --write src", | ||
"prepare": "rollup -c", | ||
"prepack": "rollup -c --bundleConfigAsCjs", | ||
"test": "npm run test-only && npm run eslint && npm run prettier", | ||
@@ -35,13 +35,13 @@ "test-only": "jest --coverage" | ||
"devDependencies": { | ||
"@babel/plugin-transform-modules-commonjs": "^7.18.6", | ||
"@types/jest": "^28.1.6", | ||
"@babel/plugin-transform-modules-commonjs": "^7.19.6", | ||
"@types/jest": "^29.2.3", | ||
"cheminfo-build": "^1.1.11", | ||
"eslint": "^8.22.0", | ||
"eslint-config-cheminfo": "^8.0.2", | ||
"eslint": "^8.27.0", | ||
"eslint-config-cheminfo": "^8.1.3", | ||
"eslint-plugin-import": "^2.26.0", | ||
"jest": "^28.1.3", | ||
"jest": "^29.3.1", | ||
"jest-matcher-deep-close-to": "^3.0.2", | ||
"openchemlib": "8.0.0", | ||
"prettier": "^2.7.1", | ||
"rollup": "^2.78.0" | ||
"rollup": "^3.3.0" | ||
}, | ||
@@ -52,5 +52,5 @@ "dependencies": { | ||
"ml-floyd-warshall": "^1.0.4", | ||
"ml-matrix": "^6.10.2", | ||
"ml-matrix": "^6.10.4", | ||
"papaparse": "^5.3.2", | ||
"sdf-parser": "^5.0.1" | ||
"sdf-parser": "^6.0.1" | ||
}, | ||
@@ -57,0 +57,0 @@ "peerDependencies": { |
@@ -0,1 +1,11 @@ | ||
/** | ||
* | ||
* @param {MoleculesDB} moleculesDB | ||
* @param {OCL.Molecule} molecule | ||
* @param {object} data | ||
* @param {object} [moleculeInfo] | ||
* @param {string} [moleculeInfo.idCode] | ||
* @param {number[]} [moleculeInfo.index] | ||
*/ | ||
export default function pushEntry( | ||
@@ -2,0 +12,0 @@ moleculesDB, |
@@ -6,2 +6,3 @@ export * from './diastereotopic/addDiastereotopicMissingChirality'; | ||
export * from './diastereotopic/getGroupedDiastereotopicAtomIDs'; | ||
export * from './diastereotopic/getDiastereotopicAtomIDsFromMolfile'; | ||
@@ -8,0 +9,0 @@ export * from './hose/getHoseCodesAndDiastereotopicIDs'; |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
140958
50
4025
+ Addeddynamic-typing@1.0.1(transitive)
+ Addedsdf-parser@6.0.1(transitive)
- Removedduplexify@4.1.3(transitive)
- Removedend-of-stream@1.4.4(transitive)
- Removedinherits@2.0.4(transitive)
- Removedonce@1.4.0(transitive)
- Removedpump@3.0.2(transitive)
- Removedpumpify@2.0.1(transitive)
- Removedreadable-stream@3.6.2(transitive)
- Removedsafe-buffer@5.2.1(transitive)
- Removedsdf-parser@5.0.2(transitive)
- Removedsplit2@4.2.0(transitive)
- Removedstream-shift@1.0.3(transitive)
- Removedstring_decoder@1.3.0(transitive)
- Removedthrough2@4.0.2(transitive)
- Removedthrough2-filter@3.1.0(transitive)
- Removedutil-deprecate@1.0.2(transitive)
- Removedwrappy@1.0.2(transitive)
Updatedml-matrix@^6.10.4
Updatedsdf-parser@^6.0.1