Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

openchemlib-utils

Package Overview
Dependencies
Maintainers
4
Versions
94
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

openchemlib-utils - npm Package Compare versions

Comparing version 2.1.0 to 2.1.1-pre.1669644163

src/diastereotopic/groupDiastereotopicAtomIDs.js

8

package.json
{
"name": "openchemlib-utils",
"version": "2.1.0",
"version": "2.1.1-pre.1669644163",
"description": "Various utilities that extends openchemlib-js like HOSE codes or diastereotopic IDs",

@@ -36,3 +36,3 @@ "main": "lib/index.js",

"cheminfo-build": "^1.1.11",
"eslint": "^8.27.0",
"eslint": "^8.28.0",
"eslint-config-cheminfo": "^8.1.3",

@@ -44,3 +44,3 @@ "eslint-plugin-import": "^2.26.0",

"prettier": "^2.7.1",
"rollup": "^3.3.0"
"rollup": "^3.4.0"
},

@@ -50,3 +50,3 @@ "dependencies": {

"ensure-string": "^1.2.0",
"ml-floyd-warshall": "^1.0.4",
"ml-floyd-warshall": "^2.0.1",
"ml-matrix": "^6.10.4",

@@ -53,0 +53,0 @@ "papaparse": "^5.3.2",

@@ -73,1 +73,64 @@ import OCL from 'openchemlib';

});
test('getDiastereotopicAtomIDsFromMolfile with H', () => {
const molfile = `Empty String
ACD/Labs09022211502D
$$ Empty String
21 23 0 0 0 0 0 0 0 0 22 V2000
1.1400 -1.1882 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
2.3282 -1.8626 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
2.3282 -3.1793 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
1.1400 -3.8536 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
0.0000 -3.1793 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
0.0000 -1.8626 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
3.4843 -1.1882 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
4.6244 -1.8626 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
5.8447 -1.3167 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
6.7118 -2.2961 0.0000 O 0 0 0 0 0 0 0 0 0 0 0 0
6.0695 -3.4362 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
4.7528 -3.1793 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
6.1016 0.0000 0.0000 O 0 0 0 0 0 0 0 0 0 0 0 0
6.6154 -4.6565 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
7.9321 -4.6565 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
8.6065 -5.8126 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
7.9321 -6.9526 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
6.6154 -6.9526 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
5.9410 -5.8126 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
3.7734 -4.0784 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0
3.5164 -2.6975 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0
1 2 1 0 0 0 0
1 6 2 0 0 0 0
2 3 2 0 0 0 0
2 7 1 0 0 0 0
3 4 1 0 0 0 0
4 5 2 0 0 0 0
5 6 1 0 0 0 0
7 8 2 0 0 0 0
8 9 1 0 0 0 0
8 12 1 0 0 0 0
9 10 1 0 0 0 0
9 13 2 0 0 0 0
10 11 1 0 0 0 0
11 12 1 0 0 0 0
11 14 1 0 0 0 0
12 21 1 0 0 0 0
12 20 1 0 0 0 0
14 15 1 0 0 0 0
14 19 2 0 0 0 0
15 16 2 0 0 0 0
16 17 1 0 0 0 0
17 18 2 0 0 0 0
18 19 1 0 0 0 0
M END`;
const result = getDiastereotopicAtomIDsFromMolfile(OCL, molfile);
expect(result.diaIDs[20]).toMatchInlineSnapshot(`
{
"heavyAtom": "flu@\`@@HRYYvYU\\eGQBejf\`@@BBAJHTfHThOt\`eGBj@",
"hydrogenOCLIDs": [],
"nbHydrogens": 0,
"oclID": "fbm@b@FBALiLsKwJkdYyL\\uSS@@@DBHDXh\`Q_iA@HeT",
}
`);
});
import { getDiastereotopicAtomIDs } from './getDiastereotopicAtomIDs';
import { groupDiastereotopicAtomIDs } from './groupDiastereotopicAtomIDs';
/**

@@ -12,22 +13,4 @@ * This function groups the diasterotopic atomIds of the molecule based on equivalence of atoms. The output object contains

export function getGroupedDiastereotopicAtomIDs(molecule, options = {}) {
const { atomLabel } = options;
let diaIDs = getDiastereotopicAtomIDs(molecule, options);
let diaIDsObject = {};
for (let i = 0; i < diaIDs.length; i++) {
if (!atomLabel || molecule.getAtomLabel(i) === atomLabel) {
let diaID = diaIDs[i];
if (!diaIDsObject[diaID]) {
diaIDsObject[diaID] = {
counter: 0,
atoms: [],
oclID: diaID,
atomLabel: molecule.getAtomLabel(i),
};
}
diaIDsObject[diaID].counter++;
diaIDsObject[diaID].atoms.push(i);
}
}
return Object.values(diaIDsObject);
let diaIDs = getDiastereotopicAtomIDs(molecule);
return groupDiastereotopicAtomIDs(diaIDs, molecule, options);
}

@@ -7,2 +7,3 @@ export * from './diastereotopic/addDiastereotopicMissingChirality';

export * from './diastereotopic/getDiastereotopicAtomIDsFromMolfile';
export * from './diastereotopic/groupDiastereotopicAtomIDs';

@@ -9,0 +10,0 @@ export * from './hose/getHoseCodesAndDiastereotopicIDs';

@@ -1,2 +0,2 @@

import floydWarshall from 'ml-floyd-warshall';
import { floydWarshall } from 'ml-floyd-warshall';
import { Matrix } from 'ml-matrix';

@@ -3,0 +3,0 @@

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc