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.0.0 to 2.1.0

src/diastereotopic/__tests/getDiastereotopicAtomIDsFromMolfile.test.js

46

lib/index.js
'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

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