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

openchemlib-utils

Package Overview
Dependencies
Maintainers
8
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 0.4.0 to 0.5.0

src/diastereotopic/__tests/getGroupedDiastereotopicAtomIDs.test.js

9

History.md

@@ -0,1 +1,10 @@

# [0.5.0](https://github.com/cheminfo/openchemlib-utils/compare/v0.4.0...v0.5.0) (2020-06-28)
### Features
* add getGroupedDiastereotopicAtomIDs ([fef69d7](https://github.com/cheminfo/openchemlib-utils/commit/fef69d71bf2b5d3935229fe18c7f0792ab5571b6))
# [0.4.0](https://github.com/cheminfo/openchemlib-utils/compare/v0.3.0...v0.4.0) (2020-05-08)

@@ -2,0 +11,0 @@

38

lib/index.js

@@ -234,2 +234,34 @@ 'use strict';

/**
* This function groups the diasterotopic atomIds of the molecule based on equivalence of atoms. The output object contains
* a set of chemically equivalent atoms(element.atoms) and the groups of magnetically equivalent atoms (element.magneticGroups)
* @param {OCL.Molecule} molecule
* @param {object} [options={}]
* @param {string} [options.atomLabel] Select atoms of the given atomLabel. By default it returns all the explicit atoms in the molecule
* @returns {Array}
*/
function getGroupedDiastereotopicAtomIDs(molecule, options = {}) {
const { atomLabel } = options;
let diaIDs = getDiastereotopicAtomIDs(molecule);
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.keys(diaIDsObject).map((key) => diaIDsObject[key]);
}
/**
* Check if a specific atom is a sp3 carbon

@@ -382,3 +414,3 @@ * @param {OCL.Molecule} molecule

}));
// seems like a very slow approach
// TODO: seems like a very slow approach
diaIDs.forEach(function(diaID) {

@@ -776,3 +808,3 @@ const hoses = getHoseCodesFromDiastereotopicID(diaID.oclID, options);

* @param {string} [opions.toLabel='H']
* @param {string} [opions.minLenght=1]
* @param {string} [opions.minLength=1]
* @param {string} [opions.maxLength=4]

@@ -838,3 +870,2 @@

* @param {string} [opions.toLabel='H']
* @param {string} [opions.minLenght=1]
* @param {string} [opions.maxLength=4]

@@ -890,2 +921,3 @@ * @returns {Array<Array>} A matrix containing on each cell (i,j) the shortest path from atom i to atom j

exports.getDiastereotopicAtomIDsAndH = getDiastereotopicAtomIDsAndH;
exports.getGroupedDiastereotopicAtomIDs = getGroupedDiastereotopicAtomIDs;
exports.getHoseCodesAndDiastereotopicIDs = getHoseCodesAndDiastereotopicIDs;

@@ -892,0 +924,0 @@ exports.getHoseCodesForAtom = getHoseCodesForAtom;

2

package.json
{
"name": "openchemlib-utils",
"version": "0.4.0",
"version": "0.5.0",
"description": "",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -15,3 +15,3 @@ import { getDiastereotopicAtomIDs } from '../diastereotopic/getDiastereotopicAtomIDs';

}));
// seems like a very slow approach
// TODO: seems like a very slow approach
diaIDs.forEach(function(diaID) {

@@ -18,0 +18,0 @@ const hoses = getHoseCodesFromDiastereotopicID(diaID.oclID, options);

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

export * from './diastereotopic/toDiastereotopicSVG';
export * from './diastereotopic/getGroupedDiastereotopicAtomIDs';

@@ -7,0 +8,0 @@ export * from './hose/getHoseCodesAndDiastereotopicIDs';

@@ -14,3 +14,3 @@ import { getConnectivityMatrix } from '../util/getConnectivityMatrix';

* @param {string} [opions.toLabel='H']
* @param {string} [opions.minLenght=1]
* @param {string} [opions.minLength=1]
* @param {string} [opions.maxLength=4]

@@ -17,0 +17,0 @@

@@ -9,3 +9,2 @@ import { getOCL } from '../OCL';

* @param {string} [opions.toLabel='H']
* @param {string} [opions.minLenght=1]
* @param {string} [opions.maxLength=4]

@@ -12,0 +11,0 @@ * @returns {Array<Array>} A matrix containing on each cell (i,j) the shortest path from atom i to atom j

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