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

openchemlib-utils

Package Overview
Dependencies
Maintainers
0
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 6.4.0 to 6.4.1

7

lib-esm/topic/getCanonizedDiaIDs.d.ts

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

import { Logger } from 'cheminfo-types';
import { TopicMolecule } from './TopicMolecule.js';
export declare function getCanonizedDiaIDs(diaMol: TopicMolecule): any[];
export interface GetCanonizedDiaIDsOptions {
maxNbAtoms: number;
logger: Omit<Logger, 'child' | 'fatal'>;
}
export declare function getCanonizedDiaIDs(diaMol: TopicMolecule, options: GetCanonizedDiaIDsOptions): any[];
//# sourceMappingURL=getCanonizedDiaIDs.d.ts.map

9

lib-esm/topic/getCanonizedDiaIDs.js
import { makeRacemic } from '../util/makeRacemic.js';
import { tagAtom } from '../util/tagAtom';
export function getCanonizedDiaIDs(diaMol) {
export function getCanonizedDiaIDs(diaMol, options) {
const { logger, maxNbAtoms } = options;
const moleculeWithH = diaMol.moleculeWithH;
if (moleculeWithH.getAllAtoms() > maxNbAtoms) {
logger.warn(`too many atoms to evaluate heterotopic chiral bonds: ${moleculeWithH.getAllAtoms()} > ${maxNbAtoms}`);
return [];
}
const heterotopicSymmetryRanks = diaMol.heterotopicSymmetryRanks;
const moleculeWithH = diaMol.moleculeWithH;
const finalRanks = diaMol.finalRanks;

@@ -7,0 +12,0 @@ const canonizedDiaIDs = new Array(moleculeWithH.getAllAtoms());

@@ -89,3 +89,3 @@ import { Logger } from 'cheminfo-types';

*/
get diaIDs(): string[] | undefined;
get diaIDs(): string[];
/**

@@ -92,0 +92,0 @@ * We return the atomIDs corresponding to the specified diaID as well has the attached hydrogens or heavy atoms

@@ -176,10 +176,10 @@ import { getHoseCodesForAtomsAsFragments } from '../hose/getHoseCodesForAtomsInternal.js';

return this.cache.diaIDs;
const diaIDs = [];
if (this.moleculeWithH.getAllAtoms() > this.options.maxNbAtoms) {
this.options.logger.warn(`too many atoms to evaluate heterotopicity: ${this.moleculeWithH.getAllAtoms()} > ${this.options.maxNbAtoms}`);
this.cache.diaIDs = undefined;
return undefined;
}
const diaIDs = [];
for (let i = 0; i < this.moleculeWithH.getAllAtoms(); i++) {
diaIDs.push(this.canonizedDiaIDs[this.finalRanks[i]]);
else {
for (let i = 0; i < this.moleculeWithH.getAllAtoms(); i++) {
diaIDs.push(this.canonizedDiaIDs[this.finalRanks[i]]);
}
}

@@ -215,3 +215,6 @@ this.cache.diaIDs = diaIDs;

return this.cache.canonizedDiaIDs;
this.cache.canonizedDiaIDs = getCanonizedDiaIDs(this);
this.cache.canonizedDiaIDs = getCanonizedDiaIDs(this, {
maxNbAtoms: this.options.maxNbAtoms,
logger: this.options.logger,
});
return this.cache.canonizedDiaIDs;

@@ -233,4 +236,5 @@ }

get diaIDsAndInfo() {
if (this.cache.diaIDsAndInfo)
if (this.cache.diaIDsAndInfo) {
return this.cache.diaIDsAndInfo;
}
this.cache.diaIDsAndInfo = getDiaIDsAndInfo(this, this.canonizedDiaIDs);

@@ -237,0 +241,0 @@ return this.cache.diaIDsAndInfo;

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

import { Logger } from 'cheminfo-types';
import { TopicMolecule } from './TopicMolecule.js';
export declare function getCanonizedDiaIDs(diaMol: TopicMolecule): any[];
export interface GetCanonizedDiaIDsOptions {
maxNbAtoms: number;
logger: Omit<Logger, 'child' | 'fatal'>;
}
export declare function getCanonizedDiaIDs(diaMol: TopicMolecule, options: GetCanonizedDiaIDsOptions): any[];
//# sourceMappingURL=getCanonizedDiaIDs.d.ts.map

@@ -6,5 +6,10 @@ "use strict";

const tagAtom_1 = require("../util/tagAtom");
function getCanonizedDiaIDs(diaMol) {
function getCanonizedDiaIDs(diaMol, options) {
const { logger, maxNbAtoms } = options;
const moleculeWithH = diaMol.moleculeWithH;
if (moleculeWithH.getAllAtoms() > maxNbAtoms) {
logger.warn(`too many atoms to evaluate heterotopic chiral bonds: ${moleculeWithH.getAllAtoms()} > ${maxNbAtoms}`);
return [];
}
const heterotopicSymmetryRanks = diaMol.heterotopicSymmetryRanks;
const moleculeWithH = diaMol.moleculeWithH;
const finalRanks = diaMol.finalRanks;

@@ -11,0 +16,0 @@ const canonizedDiaIDs = new Array(moleculeWithH.getAllAtoms());

@@ -89,3 +89,3 @@ import { Logger } from 'cheminfo-types';

*/
get diaIDs(): string[] | undefined;
get diaIDs(): string[];
/**

@@ -92,0 +92,0 @@ * We return the atomIDs corresponding to the specified diaID as well has the attached hydrogens or heavy atoms

@@ -180,10 +180,10 @@ "use strict";

return this.cache.diaIDs;
const diaIDs = [];
if (this.moleculeWithH.getAllAtoms() > this.options.maxNbAtoms) {
this.options.logger.warn(`too many atoms to evaluate heterotopicity: ${this.moleculeWithH.getAllAtoms()} > ${this.options.maxNbAtoms}`);
this.cache.diaIDs = undefined;
return undefined;
}
const diaIDs = [];
for (let i = 0; i < this.moleculeWithH.getAllAtoms(); i++) {
diaIDs.push(this.canonizedDiaIDs[this.finalRanks[i]]);
else {
for (let i = 0; i < this.moleculeWithH.getAllAtoms(); i++) {
diaIDs.push(this.canonizedDiaIDs[this.finalRanks[i]]);
}
}

@@ -219,3 +219,6 @@ this.cache.diaIDs = diaIDs;

return this.cache.canonizedDiaIDs;
this.cache.canonizedDiaIDs = (0, getCanonizedDiaIDs_1.getCanonizedDiaIDs)(this);
this.cache.canonizedDiaIDs = (0, getCanonizedDiaIDs_1.getCanonizedDiaIDs)(this, {
maxNbAtoms: this.options.maxNbAtoms,
logger: this.options.logger,
});
return this.cache.canonizedDiaIDs;

@@ -237,4 +240,5 @@ }

get diaIDsAndInfo() {
if (this.cache.diaIDsAndInfo)
if (this.cache.diaIDsAndInfo) {
return this.cache.diaIDsAndInfo;
}
this.cache.diaIDsAndInfo = (0, getDiaIDsAndInfo_1.getDiaIDsAndInfo)(this, this.canonizedDiaIDs);

@@ -241,0 +245,0 @@ return this.cache.diaIDsAndInfo;

{
"name": "openchemlib-utils",
"version": "6.4.0",
"version": "6.4.1",
"description": "Various utilities that extends openchemlib-js like HOSE codes or diastereotopic IDs",

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

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

import { Logger } from 'cheminfo-types';
import { makeRacemic } from '../util/makeRacemic.js';

@@ -6,5 +8,20 @@ import { tagAtom } from '../util/tagAtom';

export function getCanonizedDiaIDs(diaMol: TopicMolecule) {
export interface GetCanonizedDiaIDsOptions {
maxNbAtoms: number;
logger: Omit<Logger, 'child' | 'fatal'>;
}
export function getCanonizedDiaIDs(
diaMol: TopicMolecule,
options: GetCanonizedDiaIDsOptions,
) {
const { logger, maxNbAtoms } = options;
const moleculeWithH = diaMol.moleculeWithH;
if (moleculeWithH.getAllAtoms() > maxNbAtoms) {
logger.warn(
`too many atoms to evaluate heterotopic chiral bonds: ${moleculeWithH.getAllAtoms()} > ${maxNbAtoms}`,
);
return [];
}
const heterotopicSymmetryRanks = diaMol.heterotopicSymmetryRanks;
const moleculeWithH = diaMol.moleculeWithH;
const finalRanks = diaMol.finalRanks;

@@ -11,0 +28,0 @@ const canonizedDiaIDs = new Array(moleculeWithH.getAllAtoms());

@@ -291,4 +291,5 @@ import { Logger } from 'cheminfo-types';

*/
get diaIDs(): string[] | undefined {
get diaIDs(): string[] {
if (this.cache.diaIDs) return this.cache.diaIDs;
const diaIDs = [];
if (this.moleculeWithH.getAllAtoms() > this.options.maxNbAtoms) {

@@ -298,9 +299,7 @@ this.options.logger.warn(

);
this.cache.diaIDs = undefined;
return undefined;
} else {
for (let i = 0; i < this.moleculeWithH.getAllAtoms(); i++) {
diaIDs.push(this.canonizedDiaIDs[this.finalRanks[i]]);
}
}
const diaIDs = [];
for (let i = 0; i < this.moleculeWithH.getAllAtoms(); i++) {
diaIDs.push(this.canonizedDiaIDs[this.finalRanks[i]]);
}
this.cache.diaIDs = diaIDs;

@@ -339,3 +338,6 @@ return diaIDs;

if (this.cache.canonizedDiaIDs) return this.cache.canonizedDiaIDs;
this.cache.canonizedDiaIDs = getCanonizedDiaIDs(this);
this.cache.canonizedDiaIDs = getCanonizedDiaIDs(this, {
maxNbAtoms: this.options.maxNbAtoms,
logger: this.options.logger,
});
return this.cache.canonizedDiaIDs;

@@ -360,3 +362,5 @@ }

get diaIDsAndInfo(): DiaIDAndInfo[] {
if (this.cache.diaIDsAndInfo) return this.cache.diaIDsAndInfo;
if (this.cache.diaIDsAndInfo) {
return this.cache.diaIDsAndInfo;
}
this.cache.diaIDsAndInfo = getDiaIDsAndInfo(this, this.canonizedDiaIDs);

@@ -363,0 +367,0 @@ return this.cache.diaIDsAndInfo;

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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