@datagrok/bio 2.25.3 → 2.25.5

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.
package/src/package.g.ts CHANGED
@@ -277,7 +277,7 @@ export async function moleculesToHelmTopMenu(table: DG.DataFrame, molecules: DG.
277
277
  //description: Converts sequences to molblocks
278
278
  //input: dataframe table { description: Input data table }
279
279
  //input: column seqCol { semType: Macromolecule; caption: Sequence }
280
- //input: bool nonlinear = false { caption: Non-linear; description: Slower mode for cycling/branching HELM structures }
280
+ //input: bool nonlinear = true { caption: Non-linear; description: Slower mode for cycling/branching HELM structures }
281
281
  //input: bool highlight = false { caption: Highlight monomers; description: Highlight monomers' substructures of the molecule }
282
282
  //top-menu: Bio | Transform | To Atomic Level...
283
283
  export async function toAtomicLevel(table: DG.DataFrame, seqCol: DG.Column, nonlinear: boolean, highlight: boolean) : Promise<void> {
package/src/package.ts CHANGED
@@ -651,7 +651,7 @@ export class PackageFunctions {
651
651
  static async toAtomicLevel(
652
652
  @grok.decorators.param({options: {description: 'Input data table'}})table: DG.DataFrame,
653
653
  @grok.decorators.param({options: {semType: 'Macromolecule', caption: 'Sequence'}})seqCol: DG.Column,
654
- @grok.decorators.param({options: {initialValue: 'false', caption: 'Non-linear', description: 'Slower mode for cycling/branching HELM structures'}}) nonlinear: boolean,
654
+ @grok.decorators.param({options: {initialValue: 'true', caption: 'Non-linear', description: 'Slower mode for cycling/branching HELM structures'}}) nonlinear: boolean = true,
655
655
  @grok.decorators.param({options: {initialValue: 'false', caption: 'Highlight monomers', description: 'Highlight monomers\' substructures of the molecule'}}) highlight: boolean = false
656
656
  ): Promise<void> {
657
657
  const pi = DG.TaskBarProgressIndicator.create('Converting to atomic level ...');
@@ -0,0 +1,40 @@
1
+ import {RGroup} from '@datagrok-libraries/bio/src/types/monomer-library';
2
+
3
+ export const STANDRARD_R_GROUPS: RGroup[] = [
4
+ {
5
+ alternateId: 'R1-H',
6
+ capGroupName: 'H',
7
+ capGroupSmiles: '[*:1][H]',
8
+ label: 'R1'
9
+ },
10
+ {
11
+ alternateId: 'R2-OH',
12
+ capGroupName: 'OH',
13
+ capGroupSmiles: 'O[*:2]',
14
+ label: 'R2'
15
+ },
16
+ {
17
+ alternateId: 'R3-H',
18
+ capGroupName: 'H',
19
+ capGroupSmiles: '[*:3][H]',
20
+ label: 'R3'
21
+ },
22
+ {
23
+ alternateId: 'R4-H',
24
+ capGroupName: 'H',
25
+ capGroupSmiles: '[*:4][H]',
26
+ label: 'R4'
27
+ },
28
+ {
29
+ alternateId: 'R5-H',
30
+ capGroupName: 'H',
31
+ capGroupSmiles: '[*:5][H]',
32
+ label: 'R5'
33
+ },
34
+ {
35
+ alternateId: 'R6-H',
36
+ capGroupName: 'H',
37
+ capGroupSmiles: '[*:6][H]',
38
+ label: 'R6'
39
+ },
40
+ ];
@@ -19,7 +19,7 @@ import {BioTags} from '@datagrok-libraries/bio/src/utils/macromolecule/consts';
19
19
  //@ts-ignore
20
20
  import '../../../../css/monomer-manager.css';
21
21
  import {Subscription} from 'rxjs';
22
-
22
+ import {STANDRARD_R_GROUPS} from './const';
23
23
 
24
24
  // columns of monomers dataframe, note that rgroups is hidden and will be displayed as separate columns
25
25
  export enum MONOMER_DF_COLUMN_NAMES {
@@ -69,6 +69,9 @@ export async function matchMoleculesWithMonomers(molDf: DG.DataFrame, molColName
69
69
  // first: stamdardize monomers
70
70
  const monomers = monomerLib.getMonomerSymbolsByType(polymerType).map((s) => monomerLib.getMonomer(polymerType, s)!).filter((m) => m && (m.smiles || m.molfile));
71
71
  const fixedMonomers = await standardiseMonomers(monomers);
72
+ fixedMonomers.forEach((m, i) => {
73
+ m.lib = monomers[i].lib;
74
+ });
72
75
  const unCappedMonomerSmilesMap = fixedMonomers.filter((m) => !!m.smiles).reduce((acc, m) => {
73
76
  acc[m.smiles] = {symbol: m.symbol, smiles: m.smiles, original: m.smiles, source: m.lib?.source}; return acc;
74
77
  }, {} as {[smiles: string]: {symbol: string, smiles: string, original: string | undefined, source: string | undefined}});
@@ -115,7 +118,15 @@ export async function matchMoleculesWithMonomers(molDf: DG.DataFrame, molColName
115
118
  for (let i = 0; i < canonicalizedMolecules.length; i++) {
116
119
  const mol = canonicalizedMolecules[i];
117
120
  if (!mol) continue;
118
- const match = cappedMonomerSmilesMap[mol] ?? unCappedMonomerSmilesMap[mol];
121
+ let match = cappedMonomerSmilesMap[mol] ?? unCappedMonomerSmilesMap[mol];
122
+ if (!match) {
123
+ // try capping the molecule and matching again
124
+ const cappedMol = capSmiles(mol, STANDRARD_R_GROUPS);
125
+ if (cappedMol !== mol) {
126
+ const correctedMol = grok.chem.convert(cappedMol, DG.chem.Notation.Unknown, DG.chem.Notation.Smiles);
127
+ match = cappedMonomerSmilesMap[correctedMol] ?? unCappedMonomerSmilesMap[correctedMol];
128
+ }
129
+ }
119
130
  if (match) {
120
131
  const matchSymbol = match.symbol;
121
132
  const sources = (duplicates[matchSymbol]?.length ?? 0) > 0 ? duplicates[matchSymbol].map((m) => m?.lib?.source).filter((s) => !!s).join(', ') : (match.source ?? '');