@datagrok/bio 2.26.2 → 2.26.4

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": "Davit Rizhinashvili",
6
6
  "email": "drizhinashvili@datagrok.ai"
7
7
  },
8
- "version": "2.26.2",
8
+ "version": "2.26.4",
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",
@@ -68,7 +68,7 @@
68
68
  "devDependencies": {
69
69
  "@datagrok-libraries/helm-web-editor": "^1.1.16",
70
70
  "@datagrok-libraries/js-draw-lite": "^0.0.10",
71
- "@datagrok/chem": "^1.15.0",
71
+ "@datagrok/chem": "^1.17.1",
72
72
  "@datagrok/dendrogram": "^1.2.33",
73
73
  "@datagrok/eda": "^1.4.13",
74
74
  "@datagrok/helm": "^2.13.1",
@@ -216,11 +216,13 @@ export class MacromoleculeDifferenceCellRendererBack extends CellRendererWithMon
216
216
  const cell = gridCell.cell;
217
217
  const s: string = cell.value ?? '';
218
218
  const separator = this.tableCol.tags[bioTAGS.separator];
219
- const units: string = this.tableCol.meta.units!;
219
+ let units: string = this.tableCol.meta.units!;
220
220
  w = getUpdatedWidth(grid, g, x, w, dpr);
221
221
  //TODO: can this be replaced/merged with splitSequence?
222
222
  const [s1, s2] = s.split('#');
223
- const splitter = this.tableCol.temp[SeqTemps.notationProvider]?.separatorSplitter ?? getSplitter(units, separator);
223
+ if (units === NOTATION.CUSTOM && !this.tableCol.temp[SeqTemps.notationProvider])
224
+ units = NOTATION.SEPARATOR;
225
+ const splitter = this.tableCol.temp[SeqTemps.notationProvider]?.separatorSplitter ?? this.tableCol.temp[SeqTemps.notationProvider]?.splitter ?? getSplitter(units, separator);
224
226
  const s1SS = splitter(s1);
225
227
  const s2SS = splitter(s2);
226
228
  const subParts1 = wu.count(0).take(s1SS.length).map((posIdx) => s1SS.getCanonical(posIdx)).toArray();
@@ -162,10 +162,16 @@ export async function convertDo(srcCol: DG.Column, seqHelper: ISeqHelper, target
162
162
  return '';
163
163
  }
164
164
  });
165
+ newCol.semType = DG.SEMTYPE.MACROMOLECULE;
166
+ newCol.meta.units = NOTATION.CUSTOM;
167
+ newCol.setTag('separator', '-');
168
+ newCol.setTag('aligned', 'SEQ');
169
+ newCol.setTag('alphabet', 'UN');
170
+ newCol.setTag('.alphabetIsMultichar', 'true');
165
171
  srcCol.dataFrame.columns.add(newCol);
166
- const semType = await grok.functions.call('Bio:detectMacromolecule', {col: newCol});
167
- if (semType)
168
- newCol.semType = semType;
172
+ // const semType = await grok.functions.call('Bio:detectMacromolecule', {col: newCol});
173
+ // if (semType)
174
+ // newCol.semType = semType;
169
175
  await grok.data.detectSemanticTypes(srcCol.dataFrame);
170
176
  return newCol;
171
177
  } else {
@@ -44,6 +44,15 @@ export class SeqHandler implements ISeqHandler {
44
44
  private _refinerPromise: Promise<void> = Promise.resolve();
45
45
  public get refinerPromise(): Promise<void> { return this._refinerPromise; }
46
46
 
47
+ private runInnerDetector() {
48
+ if (!this._column.temp['seqHandlerDetectorRun']) {
49
+ this._column.temp['seqHandlerDetectorRun'] = true;
50
+ const detectorFunc = DG.Func.find({name: 'detectMacromolecule', meta: {role: 'semTypeDetector'}})[0];
51
+ if (detectorFunc)
52
+ detectorFunc.applySync({col: this._column});
53
+ }
54
+ }
55
+
47
56
  protected constructor(col: DG.Column<string>,
48
57
  private readonly seqHelper: SeqHelper,
49
58
  ) {
@@ -53,19 +62,20 @@ export class SeqHandler implements ISeqHandler {
53
62
  let units: string | null = this._column.meta.units;
54
63
  if (!units) {
55
64
  // it may be from layout that the macromolecule semtype is set but every other tag is missing, so we manually run detectors
56
- if (!this._column.temp['seqHandlerDetectorRun']) {
57
- this._column.temp['seqHandlerDetectorRun'] = true;
58
- const detectorFunc = DG.Func.find({name: 'detectMacromolecule', meta: {role: 'semTypeDetector'}})[0];
59
- if (detectorFunc)
60
- detectorFunc.applySync({col: this._column});
61
- units = this._column.meta.units;
62
- }
65
+ this.runInnerDetector();
66
+ units = this._column.meta.units;
63
67
  if (!units)
64
68
  throw new Error('Units are not specified in column');
65
69
  }
66
70
  this._units = units!;
67
71
 
68
72
  this._notation = this.getNotation();
73
+ if ([NOTATION.BILN, NOTATION.CUSTOM, NOTATION.SEPARATOR].includes(this._notation) && !this.column.getTag(TAGS.separator)) {
74
+ this.runInnerDetector();
75
+ if (!this.column.getTag(TAGS.separator))
76
+ throw new Error(`Separator tag '${TAGS.separator}' is not set for notation '${this._notation}'.`);
77
+ }
78
+
69
79
  if (this.isCustom() || this.isBiln()) {
70
80
  // this.column.temp[SeqTemps.notationProvider] must be set at detector stage
71
81
  this.notationProvider = this.column.temp[SeqTemps.notationProvider] ?? null;
@@ -185,7 +195,7 @@ export class SeqHandler implements ISeqHandler {
185
195
  public static setTags(uh: SeqHandler): void {
186
196
  const units = uh.column.meta.units as NOTATION;
187
197
 
188
- if ([NOTATION.FASTA, NOTATION.SEPARATOR].includes(units)) {
198
+ if ([NOTATION.FASTA, NOTATION.SEPARATOR, NOTATION.BILN].includes(units)) {
189
199
  // Empty monomer alphabet is allowed, only if alphabet tag is annotated
190
200
  if (!uh.column.getTag(TAGS.alphabet) && Object.keys(uh.stats.freq).length === 0)
191
201
  throw new Error('Alphabet is empty and not annotated.');