openchemlib 9.7.0 → 9.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -36,6 +36,39 @@ export interface MoleculeFromSmilesOptions {
36
36
  noStereo?: boolean;
37
37
  }
38
38
 
39
+ interface FromMolfileOptions {
40
+ /**
41
+ * If set to 'superscript', it will add a ']' at the beginning of the custom label to be
42
+ * compatible with the way to represent superscript in OCL
43
+ * If set to 'normal', it will remove the ']' at the beginning of the custom label if present
44
+ * If set to 'auto', it will set normal for 'C' and superscript for everything else
45
+ * If not set, it will keep the label as is
46
+ * Default: undefined (keep as is)
47
+ * @default undefined
48
+ */
49
+ customLabelPosition?: 'normal' | 'superscript' | 'auto' | undefined;
50
+ }
51
+
52
+ interface ToMolfileOptions {
53
+ /**
54
+ * Include custom atom labels as A lines
55
+ */
56
+ includeCustomAtomLabelsAsALines?: boolean;
57
+ /**
58
+ * Include custom atom labels as V lines
59
+ */
60
+ includeCustomAtomLabelsAsVLines?: boolean;
61
+ /**
62
+ * If set to 'superscript', it will add a ']' at the beginning of the custom label to be
63
+ * compatible with the way to represent superscript in OCL
64
+ * If set to 'normal', it will remove the ']' at the beginning of the custom label if present
65
+ * If not set, it will keep the label as is
66
+ * Default: undefined (keep as is)
67
+ * @default undefined
68
+ */
69
+ customLabelPosition?: 'normal' | 'superscript' | 'auto' | undefined;
70
+ }
71
+
39
72
  export interface AtomQueryFeatures {
40
73
  aromatic: boolean;
41
74
  notAromatic: boolean;
@@ -480,7 +513,7 @@ export declare class Molecule {
480
513
  * Parse the provided `molfile` and return a `Molecule`.
481
514
  * @param molfile - MDL Molfile string in V2000 or V3000
482
515
  */
483
- static fromMolfile(molfile: string): Molecule;
516
+ static fromMolfile(molfile: string, options?: FromMolfileOptions): Molecule;
484
517
 
485
518
  /**
486
519
  * Parse the provided `molfile` and return an object with `Molecule` and map.
@@ -546,6 +579,10 @@ export declare class Molecule {
546
579
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
547
580
  getOCL(): any;
548
581
 
582
+ /**
583
+ * Returns a kekulized SMILES string.
584
+ * @deprecated Use {@link toIsomericSmiles} instead.
585
+ */
549
586
  toSmiles(): string;
550
587
 
551
588
  toSmarts(): string;
@@ -553,9 +590,13 @@ export declare class Molecule {
553
590
  toIsomericSmiles(options?: SmilesGeneratorOptions): string;
554
591
 
555
592
  /**
556
- * Returns a MDL Molfile V2000 string.
593
+ * Returns a molfile V2000 with the possibility to add A and V lines to set custom atom labels
594
+ * Those fileds only exists in molfiles V2000
595
+ * @param molecule - the molecule to convert
596
+ * @param options - options to include A or V lines
597
+ * @returns the molfile as a string
557
598
  */
558
- toMolfile(): string;
599
+ toMolfile(options?: ToMolfileOptions): string;
559
600
 
560
601
  /**
561
602
  * Returns a MDL Molfile V3000 string.
@@ -987,7 +1028,7 @@ export declare class Molecule {
987
1028
  * @param atom
988
1029
  * @returns null or previously defined atom custom label
989
1030
  */
990
- getAtomCustomLabel(atom: number): string;
1031
+ getAtomCustomLabel(atom: number): string | null;
991
1032
 
992
1033
  /**
993
1034
  *
@@ -1642,12 +1683,11 @@ export declare class Molecule {
1642
1683
  * Canonizer.encodeAtomCustomLabels(). If a custom label start with ']' then the
1643
1684
  * label without the ']' symbol is shown at the top left of the original atom
1644
1685
  * label rather than replacing the original atom label. If label is null or
1645
- * equals the normal atom label, then the custom label is removed. This method
1646
- * is less efficient than the byte[] version: setAtomCustomLabel(int, byte[])
1686
+ * equals the normal atom label, then the custom label is removed.
1647
1687
  * @param atom
1648
1688
  * @param label - null to remove custom label
1649
1689
  */
1650
- setAtomCustomLabel(atom: number, label: string): void;
1690
+ setAtomCustomLabel(atom: number, label: string | null): void;
1651
1691
 
1652
1692
  /**
1653
1693
  * This is MDL's enhanced stereo representation (ESR). Stereo atoms and bonds