openchemlib-utils
Advanced tools
Comparing version 1.10.0 to 1.11.0
@@ -1904,2 +1904,60 @@ 'use strict'; | ||
function getAtomFeatures(originalMolecule) { | ||
const OCL = originalMolecule.getOCL(); | ||
let sphere = 1; | ||
let fragment = new OCL.Molecule(0, 0); | ||
let results = []; | ||
for ( | ||
let rootAtom = 0; | ||
rootAtom < originalMolecule.getAllAtoms(); | ||
rootAtom++ | ||
) { | ||
let min = 0; | ||
let max = 0; | ||
let atomMask = new Array(originalMolecule.getAtoms()); | ||
let atomList = new Array(originalMolecule.getAtoms()); | ||
const molecule = originalMolecule.getCompactCopy(); | ||
for (let currentSphere = 0; currentSphere <= sphere; currentSphere++) { | ||
if (max === 0) { | ||
atomList[max] = rootAtom; | ||
atomMask[rootAtom] = true; | ||
max++; | ||
} else { | ||
let newMax = max; | ||
for (let i = min; i < max; i++) { | ||
let atom = atomList[i]; | ||
for (let j = 0; j < molecule.getAllConnAtoms(atom); j++) { | ||
let connAtom = molecule.getConnAtom(atom, j); | ||
if (!atomMask[connAtom]) { | ||
atomMask[connAtom] = true; | ||
atomList[newMax++] = connAtom; | ||
} | ||
} | ||
} | ||
min = max; | ||
max = newMax; | ||
} | ||
molecule.copyMoleculeByAtoms(fragment, atomMask, true, null); | ||
if (currentSphere === sphere) { | ||
makeRacemic(fragment); | ||
results.push(fragment.getCanonizedIDCode()); | ||
} | ||
} | ||
} | ||
const atoms = {}; | ||
for (let result of results) { | ||
if (!atoms[result]) { | ||
atoms[result] = 1; | ||
} else { | ||
atoms[result]++; | ||
} | ||
} | ||
return atoms; | ||
} | ||
function toVisualizerMolfile(molecule, options = {}) { | ||
@@ -2025,2 +2083,3 @@ const { diastereotopic, heavyAtomHydrogen } = options; | ||
exports.fragmentAcyclicSingleBonds = fragmentAcyclicSingleBonds; | ||
exports.getAtomFeatures = getAtomFeatures; | ||
exports.getAtomsInfo = getAtomsInfo; | ||
@@ -2027,0 +2086,0 @@ exports.getConnectivityMatrix = getConnectivityMatrix; |
{ | ||
"name": "openchemlib-utils", | ||
"version": "1.10.0", | ||
"version": "1.11.0", | ||
"description": "Various utilities that extends openchemlib-js like HOSE codes or diastereotopic IDs", | ||
@@ -42,22 +42,22 @@ "main": "lib/index.js", | ||
"devDependencies": { | ||
"@babel/plugin-transform-modules-commonjs": "^7.16.8", | ||
"@types/jest": "^27.4.0", | ||
"@babel/plugin-transform-modules-commonjs": "^7.17.9", | ||
"@types/jest": "^27.4.1", | ||
"cheminfo-build": "^1.1.11", | ||
"eslint": "^8.8.0", | ||
"eslint-config-cheminfo": "^7.2.2", | ||
"eslint-plugin-import": "^2.25.4", | ||
"eslint": "^8.13.0", | ||
"eslint-config-cheminfo": "^7.3.0", | ||
"eslint-plugin-import": "^2.26.0", | ||
"esm": "^3.2.25", | ||
"jest": "^27.5.0", | ||
"jest": "^27.5.1", | ||
"jest-matcher-deep-close-to": "^3.0.2", | ||
"openchemlib": "7.4.0", | ||
"prettier": "^2.5.1", | ||
"rollup": "^2.67.1" | ||
"prettier": "^2.6.2", | ||
"rollup": "^2.70.2" | ||
}, | ||
"dependencies": { | ||
"atom-sorter": "^1.1.9", | ||
"ensure-string": "^1.1.0", | ||
"ml-floyd-warshall": "^1.0.3", | ||
"ml-matrix": "^6.8.2", | ||
"papaparse": "^5.3.1", | ||
"sdf-parser": "^5.0.0" | ||
"atom-sorter": "^1.1.10", | ||
"ensure-string": "^1.2.0", | ||
"ml-floyd-warshall": "^1.0.4", | ||
"ml-matrix": "^6.9.0", | ||
"papaparse": "^5.3.2", | ||
"sdf-parser": "^5.0.1" | ||
}, | ||
@@ -64,0 +64,0 @@ "peerDependencies": { |
@@ -32,4 +32,6 @@ export * from './diastereotopic/addDiastereotopicMissingChirality'; | ||
export * from './features/getAtomFeatures'; | ||
export * from './misc/toVisualizerMolfile'; | ||
export * from './fragment/fragmentAcyclicSingleBonds'; |
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
139014
50
3973
Updatedatom-sorter@^1.1.10
Updatedensure-string@^1.2.0
Updatedml-floyd-warshall@^1.0.4
Updatedml-matrix@^6.9.0
Updatedpapaparse@^5.3.2
Updatedsdf-parser@^5.0.1