@datagrok/bio 2.15.11 → 2.15.13

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/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "name": "Aleksandr Tanas",
6
6
  "email": "atanas@datagrok.ai"
7
7
  },
8
- "version": "2.15.11",
8
+ "version": "2.15.13",
9
9
  "description": "Bioinformatics support (import/export of sequences, conversion, visualization, analysis). [See more](https://github.com/datagrok-ai/public/blob/master/packages/Bio/README.md) for details.",
10
10
  "repository": {
11
11
  "type": "git",
@@ -72,11 +72,20 @@ export class MonomerManager implements IMonomerManager {
72
72
 
73
73
  protected constructor(public monomerLibManamger: MonomerLibManager) {
74
74
  this.monomerLib = monomerLibManamger.getBioLib();
75
- this._newMonomerForm = new MonomerForm(monomerLibManamger, () => this.activeMonomerLib, async () => {
75
+ this._newMonomerForm = new MonomerForm(monomerLibManamger, () => this.activeMonomerLib, async (scrollToRowSymbol?: string) => {
76
76
  const df = await this.getMonomersDf(this.libInput.value!);
77
77
  if (this.tv?.dataFrame) {
78
78
  this.tv.dataFrame = df;
79
79
  this.adjustColWidths();
80
+ if (scrollToRowSymbol != undefined) {
81
+ setTimeout(() => {
82
+ const col = df.col(MONOMER_DF_COLUMN_NAMES.SYMBOL)!;
83
+ const scrollToRow = col.toList().indexOf(scrollToRowSymbol);
84
+ if (scrollToRow === -1) return;
85
+ this.tv?.grid.scrollToCell(df.columns.byIndex(0), scrollToRow);
86
+ df.currentRow = df.rows.get(scrollToRow);
87
+ }, 500);
88
+ }
80
89
  }
81
90
 
82
91
  }, () => this.tv?.dataFrame);
@@ -502,7 +511,7 @@ class MonomerForm implements INewMonomerForm {
502
511
  private triggerMolChange: boolean = true; // makes sure that change is not triggered by copying the molecule from grid
503
512
  inputsTabControl: DG.TabControl;
504
513
  constructor(public monomerLibManager: MonomerLibManager,
505
- private getMonomerLib: () => IMonomerLib | null, private refreshTable: () => Promise<void>,
514
+ private getMonomerLib: () => IMonomerLib | null, private refreshTable: (scrollToRowSymbol?: string) => Promise<void | undefined>,
506
515
  private getMonomersDataFrame: () => DG.DataFrame | undefined) {
507
516
  const monomerTypes = ['PEPTIDE', 'RNA', 'CHEM', 'BLOB', 'G'];
508
517
  this.colors = {
@@ -824,7 +833,7 @@ class MonomerForm implements INewMonomerForm {
824
833
  }
825
834
  await grok.dapi.files.writeAsText(LIB_PATH + libName, JSON.stringify(libJSON));
826
835
  await (await MonomerLibManager.getInstance()).loadLibraries(true);
827
- await this.refreshTable();
836
+ await this.refreshTable(monomer.symbol);
828
837
  grok.shell.info(`Monomer ${monomer.symbol} was successfully saved in library ${libName}`);
829
838
  } catch (e) {
830
839
  grok.shell.error('Error saving monomer');
@@ -965,7 +974,8 @@ function getCorrectedMolBlock(molBlock: string) {
965
974
  const rgpLineIdx = lines.findIndex((line) => line.startsWith('M') && line.includes('RGP'));
966
975
 
967
976
  if (rgpLineIdx === -1) {
968
- const rgpLine = `M RGP ${rgroupLineNums.length} ${Object.entries(rgroupLineNumbers).map(([atomLine, rGroupNum]) => `${atomLine} ${rGroupNum}`).join(' ')}`;
977
+ // number of r groups has 3 empty slots before it, atom numbers have 4 empty slots before them
978
+ let rgpLine = `M RGP${rgroupLineNums.length.toString().padStart(3,' ')}${Object.entries(rgroupLineNumbers).map(([atomLine, rGroupNum]) => `${atomLine.toString().padStart(4, ' ')}${rGroupNum.toString().padStart(4, ' ')}`).join('')}`;
969
979
  const mEndIdx = lines.findIndex((line) => line.startsWith('M') && line.includes('END'));
970
980
  lines.splice(mEndIdx, 0, rgpLine);
971
981
  }
@@ -211,10 +211,8 @@ export class PositionInfo {
211
211
  const left = b.left;
212
212
 
213
213
  let color: string = undefinedColor;
214
- if (monomerLib) {
215
- const wem = monomerLib.getWebEditorMonomer(biotype, monomer)!;
216
- color = wem.backgroundcolor!;
217
- }
214
+ if (monomerLib)
215
+ color = monomerLib.getMonomerTextColor(biotype, monomer)!;
218
216
 
219
217
  g.resetTransform();
220
218
  g.strokeStyle = 'lightgray';