openchemlib-utils
Advanced tools
Comparing version 5.19.0 to 5.19.1
@@ -11,3 +11,3 @@ import { Molecule } from 'openchemlib'; | ||
path: number[]; | ||
distance: number; | ||
pathLength: number; | ||
} | ||
@@ -14,0 +14,0 @@ /** |
@@ -16,3 +16,3 @@ /** | ||
let atomPaths = []; | ||
atomPaths.push({ path: [i], distance: 0 }); | ||
atomPaths.push({ path: [i], pathLength: 0 }); | ||
oneAtomPaths.push(atomPaths); | ||
@@ -32,3 +32,3 @@ let nextIndexes = [0]; | ||
const previousPath = oneAtomPaths[sphere - 1][index].path; | ||
for (let conn = 0; conn < molecule.getConnAtoms(atom); conn++) { | ||
for (let conn = 0; conn < molecule.getAllConnAtoms(atom); conn++) { | ||
const connectedAtom = molecule.getConnAtom(atom, conn); | ||
@@ -41,3 +41,3 @@ if (previousPath.includes(connectedAtom)) | ||
path: [...previousPath, connectedAtom], | ||
distance: sphere, | ||
pathLength: sphere, | ||
}); | ||
@@ -44,0 +44,0 @@ } |
@@ -16,3 +16,3 @@ import type { Molecule } from 'openchemlib'; | ||
interface GetAtomPathOptions { | ||
distance?: number; | ||
pathLength?: number; | ||
} | ||
@@ -19,0 +19,0 @@ interface GetHoseFragmentOptions { |
@@ -97,9 +97,9 @@ import { getAllAtomsPaths } from '../path/getAllAtomsPaths.js'; | ||
getAtomPaths(atom1, atom2, options = {}) { | ||
const { distance } = options; | ||
if (distance !== undefined && distance > this.options.maxPathLength) { | ||
const { pathLength } = options; | ||
if (pathLength !== undefined && pathLength > this.options.maxPathLength) { | ||
throw new Error('The distance is too long, you should increase the maxPathLength when instanciating the TopicMolecule'); | ||
} | ||
const atomPaths = this.atomsPaths[atom1]; | ||
const minDistance = distance || 0; | ||
const maxDistance = distance || this.options.maxPathLength; | ||
const minDistance = pathLength || 0; | ||
const maxDistance = pathLength || this.options.maxPathLength; | ||
const paths = []; | ||
@@ -106,0 +106,0 @@ for (let i = minDistance; i <= maxDistance; i++) { |
@@ -11,3 +11,3 @@ import { Molecule } from 'openchemlib'; | ||
path: number[]; | ||
distance: number; | ||
pathLength: number; | ||
} | ||
@@ -14,0 +14,0 @@ /** |
@@ -19,3 +19,3 @@ "use strict"; | ||
let atomPaths = []; | ||
atomPaths.push({ path: [i], distance: 0 }); | ||
atomPaths.push({ path: [i], pathLength: 0 }); | ||
oneAtomPaths.push(atomPaths); | ||
@@ -35,3 +35,3 @@ let nextIndexes = [0]; | ||
const previousPath = oneAtomPaths[sphere - 1][index].path; | ||
for (let conn = 0; conn < molecule.getConnAtoms(atom); conn++) { | ||
for (let conn = 0; conn < molecule.getAllConnAtoms(atom); conn++) { | ||
const connectedAtom = molecule.getConnAtom(atom, conn); | ||
@@ -44,3 +44,3 @@ if (previousPath.includes(connectedAtom)) | ||
path: [...previousPath, connectedAtom], | ||
distance: sphere, | ||
pathLength: sphere, | ||
}); | ||
@@ -47,0 +47,0 @@ } |
@@ -16,3 +16,3 @@ import type { Molecule } from 'openchemlib'; | ||
interface GetAtomPathOptions { | ||
distance?: number; | ||
pathLength?: number; | ||
} | ||
@@ -19,0 +19,0 @@ interface GetHoseFragmentOptions { |
@@ -100,9 +100,9 @@ "use strict"; | ||
getAtomPaths(atom1, atom2, options = {}) { | ||
const { distance } = options; | ||
if (distance !== undefined && distance > this.options.maxPathLength) { | ||
const { pathLength } = options; | ||
if (pathLength !== undefined && pathLength > this.options.maxPathLength) { | ||
throw new Error('The distance is too long, you should increase the maxPathLength when instanciating the TopicMolecule'); | ||
} | ||
const atomPaths = this.atomsPaths[atom1]; | ||
const minDistance = distance || 0; | ||
const maxDistance = distance || this.options.maxPathLength; | ||
const minDistance = pathLength || 0; | ||
const maxDistance = pathLength || this.options.maxPathLength; | ||
const paths = []; | ||
@@ -109,0 +109,0 @@ for (let i = minDistance; i <= maxDistance; i++) { |
{ | ||
"name": "openchemlib-utils", | ||
"version": "5.19.0", | ||
"version": "5.19.1", | ||
"description": "Various utilities that extends openchemlib-js like HOSE codes or diastereotopic IDs", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index.js", |
@@ -13,3 +13,3 @@ import { Molecule } from 'openchemlib'; | ||
path: number[]; | ||
distance: number; | ||
pathLength: number; | ||
} | ||
@@ -36,3 +36,3 @@ | ||
let atomPaths: AtomPath[] = []; | ||
atomPaths.push({ path: [i], distance: 0 }); | ||
atomPaths.push({ path: [i], pathLength: 0 }); | ||
oneAtomPaths.push(atomPaths); | ||
@@ -56,3 +56,3 @@ | ||
const previousPath = oneAtomPaths[sphere - 1][index].path; | ||
for (let conn = 0; conn < molecule.getConnAtoms(atom); conn++) { | ||
for (let conn = 0; conn < molecule.getAllConnAtoms(atom); conn++) { | ||
const connectedAtom = molecule.getConnAtom(atom, conn); | ||
@@ -64,3 +64,3 @@ if (previousPath.includes(connectedAtom)) continue; | ||
path: [...previousPath, connectedAtom], | ||
distance: sphere, | ||
pathLength: sphere, | ||
}); | ||
@@ -67,0 +67,0 @@ } |
@@ -40,3 +40,3 @@ import type { Molecule } from 'openchemlib'; | ||
*/ | ||
distance?: number; | ||
pathLength?: number; | ||
} | ||
@@ -177,4 +177,4 @@ | ||
getAtomPaths(atom1: number, atom2: number, options: GetAtomPathOptions = {}) { | ||
const { distance } = options; | ||
if (distance !== undefined && distance > this.options.maxPathLength) { | ||
const { pathLength } = options; | ||
if (pathLength !== undefined && pathLength > this.options.maxPathLength) { | ||
throw new Error( | ||
@@ -185,4 +185,4 @@ 'The distance is too long, you should increase the maxPathLength when instanciating the TopicMolecule', | ||
const atomPaths = this.atomsPaths[atom1]; | ||
const minDistance = distance || 0; | ||
const maxDistance = distance || this.options.maxPathLength; | ||
const minDistance = pathLength || 0; | ||
const maxDistance = pathLength || this.options.maxPathLength; | ||
const paths = []; | ||
@@ -189,0 +189,0 @@ for (let i = minDistance; i <= maxDistance; i++) { |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1128906