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 0.7.0 to 0.7.1

7

CHANGELOG.md
# Changelog
### [0.7.1](https://www.github.com/cheminfo/openchemlib-utils/compare/v0.7.0...v0.7.1) (2021-03-24)
### Bug Fixes
* use molecule.getOCL where possible ([936c791](https://www.github.com/cheminfo/openchemlib-utils/commit/936c791a5d393fc4c3aa1372418a29c270d0e5f9))
## [0.7.0](https://www.github.com/cheminfo/openchemlib-utils/compare/v0.6.1...v0.7.0) (2021-03-01)

@@ -4,0 +11,0 @@

74

lib/index.js

@@ -14,25 +14,2 @@ 'use strict';

let OCL;
function getOCL() {
if (!OCL) {
throw new Error('OCL has to be initialized using initOCL(OCL)');
}
return OCL;
}
/**
*
* @param {OCL} newOCL
* @param {object} [options={}]
* @param {boolean} [options.keepExisting=false] Will keep current OCL if we initialize more than once
*/
function initOCL(newOCL, options = {}) {
const { keepExisting = false } = options;
if (OCL && keepExisting) return;
if (OCL && OCL !== newOCL) {
throw new Error('OCL-utils was already initialized with a different OCL');
}
OCL = newOCL;
}
let xAtomicNumber = 0;

@@ -49,3 +26,3 @@

if (molecule.getAtomicNo(iAtom) === 1) {
molecule.setAtomicNo(iAtom, getXAtomicNumber());
molecule.setAtomicNo(iAtom, getXAtomicNumber(molecule));
} else {

@@ -60,5 +37,5 @@ // we can not use X because we would have problems with valencies if it is

function getXAtomicNumber() {
function getXAtomicNumber(molecule) {
if (!xAtomicNumber) {
const OCL = getOCL();
const OCL = molecule.getOCL();
xAtomicNumber = OCL.Molecule.getAtomicNoFromLabel('X');

@@ -78,3 +55,3 @@ }

function addDiastereotopicMissingChirality(molecule, options = {}) {
const { Molecule } = getOCL();
const { Molecule } = molecule.getOCL();
const { esrType = Molecule.cESRTypeAnd } = options;

@@ -118,3 +95,3 @@

function makeRacemic(molecule) {
const { Molecule } = getOCL();
const { Molecule } = molecule.getOCL();

@@ -137,3 +114,3 @@ // if we don't calculate this we have 2 epimers

function getDiastereotopicAtomIDs(molecule) {
const OCL = getOCL();
const OCL = molecule.getOCL();
addDiastereotopicMissingChirality(molecule);

@@ -162,3 +139,3 @@

function getDiastereotopicAtomIDsAndH(originalMolecule) {
const OCL = getOCL();
const OCL = originalMolecule.getOCL();
const molecule = originalMolecule.getCompactCopy();

@@ -282,3 +259,26 @@ molecule.addImplicitHydrogens();

let OCL;
function getOCL() {
if (!OCL) {
throw new Error('OCL has to be initialized using initOCL(OCL)');
}
return OCL;
}
/**
*
* @param {OCL} newOCL
* @param {object} [options={}]
* @param {boolean} [options.keepExisting=false] Will keep current OCL if we initialize more than once
*/
function initOCL(newOCL, options = {}) {
const { keepExisting = false } = options;
if (OCL && keepExisting) return;
if (OCL && OCL !== newOCL) {
throw new Error('OCL-utils was already initialized with a different OCL');
}
OCL = newOCL;
}
/**
* Check if a specific atom is a sp3 carbon

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

function getHoseCodesForAtom(originalMolecule, rootAtom, options = {}) {
const OCL = getOCL();
const OCL = originalMolecule.getOCL();
const {

@@ -554,3 +554,3 @@ minSphereSize = 0,

originalSmiles: coreSmiles,
smiles: coreSmiles.replace(/\[R([1-4])\]/g, '%5$1'),
smiles: coreSmiles.replace(/\[R(?<group>[1-4])\]/g, '%5$<group>'),
};

@@ -621,3 +621,3 @@

function getAtomsInfo(molecule) {
const OCL = getOCL();
const OCL = molecule.getOCL();
molecule.ensureHelperArrays(OCL.Molecule.cHelperRings);

@@ -734,3 +734,3 @@

function getConnectivityMatrix(molecule, options = {}) {
const OCL = getOCL();
const OCL = molecule.getOCL();
molecule.ensureHelperArrays(OCL.Molecule.cHelperNeighbours);

@@ -891,3 +891,3 @@ let nbAtoms = molecule.getAllAtoms();

function getHoseCodesForPath(molecule, from, to, maxLength) {
const OCL = getOCL();
const OCL = molecule.getOCL();
const originalFrom = from;

@@ -1009,3 +1009,3 @@ const originalTo = to;

const OCL = getOCL();
const OCL = molecule.getOCL();

@@ -1063,3 +1063,3 @@ if (!fragment) {

function getShortestPaths(molecule, options = {}) {
const OCL = getOCL();
const OCL = molecule.getOCL();
const { fromLabel = '', toLabel = '', maxLength = 3 } = options;

@@ -1066,0 +1066,0 @@

{
"name": "openchemlib-utils",
"version": "0.7.0",
"version": "0.7.1",
"description": "",

@@ -42,17 +42,17 @@ "main": "lib/index.js",

"devDependencies": {
"@babel/plugin-transform-modules-commonjs": "^7.12.1",
"cheminfo-build": "^1.1.8",
"eslint": "^7.18.0",
"eslint-config-cheminfo": "^5.2.2",
"@babel/plugin-transform-modules-commonjs": "^7.13.8",
"cheminfo-build": "^1.1.10",
"eslint": "^7.22.0",
"eslint-config-cheminfo": "^5.2.3",
"esm": "^3.2.25",
"jest": "^26.6.3",
"openchemlib": "^7.3.0",
"openchemlib": "^7.4.0",
"prettier": "^2.2.1",
"rollup": "^2.36.2"
"rollup": "^2.42.3"
},
"dependencies": {
"atom-sorter": "^1.1.5",
"atom-sorter": "^1.1.9",
"ml-floyd-warshall": "^1.0.3",
"ml-matrix": "^6.6.0"
"ml-matrix": "^6.7.0"
}
}

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

import { getOCL } from '../OCL';
import { tagAtom } from '../util/tagAtom';

@@ -13,3 +12,3 @@

export function addDiastereotopicMissingChirality(molecule, options = {}) {
const { Molecule } = getOCL();
const { Molecule } = molecule.getOCL();
const { esrType = Molecule.cESRTypeAnd } = options;

@@ -16,0 +15,0 @@

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

import { getOCL } from '../OCL';
import { makeRacemic } from '../util/makeRacemic';

@@ -12,3 +11,3 @@ import { tagAtom } from '../util/tagAtom';

export function getDiastereotopicAtomIDs(molecule) {
const OCL = getOCL();
const OCL = molecule.getOCL();
addDiastereotopicMissingChirality(molecule);

@@ -15,0 +14,0 @@

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

import { getOCL } from '../OCL';
import { getDiastereotopicAtomIDs } from './getDiastereotopicAtomIDs';

@@ -11,3 +9,3 @@ // Previously getExtendedDiastereotopicAtomIDs

export function getDiastereotopicAtomIDsAndH(originalMolecule) {
const OCL = getOCL();
const OCL = originalMolecule.getOCL();
const molecule = originalMolecule.getCompactCopy();

@@ -14,0 +12,0 @@ molecule.addImplicitHydrogens();

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

import { getOCL } from '../OCL';
import { isCsp3 } from '../util/isCsp3';

@@ -17,3 +16,3 @@ import { makeRacemic } from '../util/makeRacemic';

export function getHoseCodesForAtom(originalMolecule, rootAtom, options = {}) {
const OCL = getOCL();
const OCL = originalMolecule.getOCL();
const {

@@ -20,0 +19,0 @@ minSphereSize = 0,

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

import { getOCL } from '../OCL';
import { makeRacemic } from '../util/makeRacemic';

@@ -12,3 +11,3 @@ import { tagAtom } from '../util/tagAtom';

export function getHoseCodesForPath(molecule, from, to, maxLength) {
const OCL = getOCL();
const OCL = molecule.getOCL();
const originalFrom = from;

@@ -15,0 +14,0 @@ const originalTo = to;

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

import { getOCL } from '../OCL';
import { getHoseCodesForPath } from '../hose/getHoseCodesForPath';

@@ -26,3 +25,3 @@ import { getAtomsInfo } from '../util/getAtomsInfo';

const OCL = getOCL();
const OCL = molecule.getOCL();

@@ -29,0 +28,0 @@ if (!fragment) {

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

import { getOCL } from '../OCL';
/**

@@ -13,3 +11,3 @@ * Get the shortest path between each pair of atoms in the molecule

export function getShortestPaths(molecule, options = {}) {
const OCL = getOCL();
const OCL = molecule.getOCL();
const { fromLabel = '', toLabel = '', maxLength = 3 } = options;

@@ -16,0 +14,0 @@

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

originalSmiles: coreSmiles,
smiles: coreSmiles.replace(/\[R([1-4])\]/g, '%5$1'),
smiles: coreSmiles.replace(/\[R(?<group>[1-4])\]/g, '%5$<group>'),
};

@@ -113,0 +113,0 @@

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

import { getOCL } from '../OCL';
import { getDiastereotopicAtomIDs } from '../diastereotopic/getDiastereotopicAtomIDs';

@@ -9,3 +8,3 @@

export function getAtomsInfo(molecule) {
const OCL = getOCL();
const OCL = molecule.getOCL();
molecule.ensureHelperArrays(OCL.Molecule.cHelperRings);

@@ -12,0 +11,0 @@

import floydWarshall from 'ml-floyd-warshall';
import { Matrix } from 'ml-matrix';
import { getOCL } from '../OCL';
/**

@@ -18,3 +16,3 @@ * Returns a connectivity matrix

export function getConnectivityMatrix(molecule, options = {}) {
const OCL = getOCL();
const OCL = molecule.getOCL();
molecule.ensureHelperArrays(OCL.Molecule.cHelperNeighbours);

@@ -21,0 +19,0 @@ let nbAtoms = molecule.getAllAtoms();

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

import { getOCL } from '../OCL';
/**

@@ -10,3 +8,3 @@ *

export function makeRacemic(molecule) {
const { Molecule } = getOCL();
const { Molecule } = molecule.getOCL();

@@ -13,0 +11,0 @@ // if we don't calculate this we have 2 epimers

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

import { getOCL } from '../OCL';
let xAtomicNumber = 0;

@@ -14,3 +12,3 @@

if (molecule.getAtomicNo(iAtom) === 1) {
molecule.setAtomicNo(iAtom, getXAtomicNumber());
molecule.setAtomicNo(iAtom, getXAtomicNumber(molecule));
} else {

@@ -25,5 +23,5 @@ // we can not use X because we would have problems with valencies if it is

function getXAtomicNumber() {
function getXAtomicNumber(molecule) {
if (!xAtomicNumber) {
const OCL = getOCL();
const OCL = molecule.getOCL();
xAtomicNumber = OCL.Molecule.getAtomicNoFromLabel('X');

@@ -30,0 +28,0 @@ }

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