import type { LightLogger } from 'cheminfo-types'; import type { Molecule } from 'openchemlib'; import type { AtomPath } from '../path/getAllAtomsPaths.ts'; import type { HoseCodesOptions } from './HoseCodesOptions.js'; import type { HoseCodesForPathOptions, HosesForPath } from './getCanonizedHoseCodesForPaths.ts'; interface ToMolfileOptions { version?: 2 | 3; } interface TopicMoleculeOptions extends HoseCodesOptions { /** * The maximum path length to consider when calculating the paths between atoms * @default 5 */ maxPathLength?: number; /** * The maximum number of atoms to consider when dealing with diastereotopicity */ maxNbAtoms?: number; /** * The logger to use in order to retrieve some debug or warning information * @default console */ logger?: LightLogger; } type TopicMoleculeInternalOptions = Omit & Required>; interface GetAtomPathOptions { pathLength?: number; } export interface GetAtomPathFromOptions { minPathLength?: number; maxPathLength?: number; toAtomicNo?: number; } interface GetHoseFragmentOptions { sphereSize?: number; /** * The atoms to tag in the fragment * @default rootAtoms */ tagAtoms?: number[]; /** * The function to tag the atoms in place ! * @default tagAtom */ tagAtomFct?: (molecule: Molecule, iAtom: number) => undefined; } /** * This class deals with topicity information and hose codes * It is optimized to avoid recalculation of the same information */ export declare class TopicMolecule { private readonly originalMolecule; molecule: Molecule; idCode: string; options: TopicMoleculeInternalOptions; private cache; constructor(molecule: Molecule, options?: TopicMoleculeOptions); /** * This method ensures that all the atoms have a mapNo corresponding to the atom number. * It will enforce mapNo in molecule and moleculeWithH * We start numbering the atoms at 1 */ setAtomNoInMapNo(): void; /** * This method ensures that all the atoms have a mapNo in the molecule (and not the moleculeWithH! ) */ ensureMapNo(): void; /** * For each atom we will return an array of objects that contains the * different possible path as well as the canonic hose codes * @param options * @returns */ getHoseCodesForPath(options?: HoseCodesForPathOptions): HosesForPath[]; /** * Return one fragment for a specific sphere size and specific root atoms * @param rootAtoms * @param options * @returns */ getHoseFragment(rootAtoms: number[], options?: GetHoseFragmentOptions): Molecule; getAtomPathsFrom(atom: number, options?: GetAtomPathFromOptions): number[][]; getAtomPaths(atom1: number, atom2: number, options?: GetAtomPathOptions): number[][]; get atomsPaths(): AtomPath[][][]; toMolfile(options?: ToMolfileOptions): string; getMolecule(): Molecule; /** * Returns a new TopicMolecule but will copy precalculated information * if possible (same idCode). This is very practical when expanding hydrogens * for example. * @param molecule * @returns */ fromMolecule(molecule: Molecule): TopicMolecule; /** * Returns a molecule with all the hydrogens added. The order is NOT canonized */ get moleculeWithH(): Molecule; private get xMolecule(); /** * This is related to the current moleculeWithH. The order is NOT canonized */ get diaIDs(): string[]; /** * We return the atomIDs corresponding to the specified diaID as well has the attached hydrogens or heavy atoms * @param diaID * @returns */ getDiaIDsObject(): Record; /** * This is related to the current moleculeWithH. The order is NOT canonized */ get hoseCodes(): any; private get canonizedDiaIDs(); private get canonizedHoseCodes(); /** * Returns the distance matrix for the current moleculeWithH */ get distanceMatrix(): any[]; get diaIDsAndInfo(): DiaIDAndInfo[]; /** * Returns symmetryRanks for all the atoms including hydrogens. Those ranks * deals with topicity and is related to the current moleculeWithH. * In order to calculate the ranks we replace all the * hydrogens with a X atom. */ get heterotopicSymmetryRanks(): number[]; /** * Returns finalRanks for all the atoms including hydrogens. Those ranks * deals with topicity and is related to the current moleculeWithH. * All the atoms have a unique identifier.j * In order to calculate the ranks we replace all the * hydrogens with a X atom. */ get finalRanks(): any; toMolfileWithH(options?: ToMolfileOptions): string; toMolfileWithoutH(options?: ToMolfileOptions): string; /** * Returns an array of objects containing the oclID and the corresponding hydrogens and atoms * for the specified atomLabel (if any) * This always applied to the molecule with expanded hydrogens and chirality * @param options * @returns */ getGroupedDiastereotopicAtomIDs(options?: GroupedDiaIDsOptions): GroupedDiaID[] | undefined; /** * This method returns a mapping between the diaIDs of the current molecule. * It expects that the initial molfile and the final molfile contains atomMapNo * in order to track which atom becomes which one. * @param molecule */ getDiaIDsMapping(molecule: Molecule): Record; } export interface DiaIDAndInfo { idCode: string; attachedHydrogensIDCodes: string[]; attachedHydrogens: number[]; nbAttachedHydrogens: number; atomLabel: string; nbEquivalentAtoms: number; heavyAtom: string | undefined; atomMapNo: number | undefined; } export interface GroupedDiaIDsOptions { atomLabel?: string; } export interface GroupedDiaID { counter: number; /** * Diastereotopic ID of the group */ oclID: string; /** * Atom label (C, N, O, etc.) */ atomLabel: string; atoms: number[]; /** * List of atom numbers existing in the molecule. In case of implicit hydrogens we will fallback * to the linked heavy atom */ existingAtoms: number[]; /** * List of connected heavy atoms in the case of hydrogens */ heavyAtoms: number[]; /** * Lists of connected hydrogens in the case of heavy atoms */ attachedHydrogens: number[]; /** * List of custom labels found for the atoms in the group */ customLabels: string[]; /** * In the case of heavy atoms, list of custom labels found for the attached hydrogens in the group */ attachedHydrogensCustomLabels: string[]; /** * In the case of hydrogens, list of custom labels found for the connected heavy atoms in the group */ heavyAtomsCustomLabels: string[]; } export declare function groupDiastereotopicAtomIDs(diaIDs: string[], molecule: Molecule, options?: GroupedDiaIDsOptions): GroupedDiaID[]; export {}; //# sourceMappingURL=TopicMolecule.d.ts.map