@datagrok/bio 2.22.11 → 2.23.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.
@@ -4,6 +4,7 @@ import * as DG from 'datagrok-api/dg';
4
4
  import * as OCL from 'openchemlib/full';
5
5
  import {NOTATION} from '@datagrok-libraries/bio/src/utils/macromolecule';
6
6
  import {_package, PackageFunctions} from '../package';
7
+ import {SeqTemps} from '@datagrok-libraries/bio/src/utils/macromolecule/seq-handler';
7
8
 
8
9
 
9
10
  export async function toAtomicLevelSingle(sequence: DG.SemanticValue): Promise<{mol: string, errorText: string}> {
@@ -17,7 +18,7 @@ export async function toAtomicLevelSingle(sequence: DG.SemanticValue): Promise<{
17
18
  errorText = 'Atomic level conversion requeires a sequence column';
18
19
  return {errorText, mol: ''};
19
20
  }
20
- const supportedUnits: string[] = [NOTATION.FASTA, NOTATION.SEPARATOR, NOTATION.HELM];
21
+ const supportedUnits: string[] = [NOTATION.FASTA, NOTATION.SEPARATOR, NOTATION.HELM, NOTATION.BILN];
21
22
  //todo: add support for custom notations
22
23
  if (!supportedUnits.includes(sequence.cell.column.meta.units?.toLowerCase() ?? '')) {
23
24
  errorText = 'Unsupported sequence notation. please use Bio | Polytool | Convert';
@@ -29,8 +30,8 @@ export async function toAtomicLevelSingle(sequence: DG.SemanticValue): Promise<{
29
30
  errorText = 'No sequence handler found';
30
31
  return {errorText, mol: ''};
31
32
  }
32
- if ((seqSh.getSplitted(sequence.cell.rowIndex, 50)?.length ?? 100) > 40) {
33
- errorText = 'Maximum number of monomers is 40';
33
+ if ((seqSh.getSplitted(sequence.cell.rowIndex, 60)?.length ?? 100) > 50) {
34
+ errorText = 'Maximum number of monomers is 50';
34
35
  return {errorText, mol: ''};
35
36
  }
36
37
  const singleValCol = DG.Column.fromStrings('singleVal', [sequence.value]);
@@ -39,7 +40,14 @@ export async function toAtomicLevelSingle(sequence: DG.SemanticValue): Promise<{
39
40
  Object.entries(sequence.cell.column.tags).forEach(([key, value]) => {
40
41
  singleValCol.setTag(key, value as string);
41
42
  });
42
- await PackageFunctions.toAtomicLevel(sDf, singleValCol, sequence.cell.column.meta.units === NOTATION.HELM, false);
43
+
44
+ // if column has notation provider, we need to copy it over
45
+ if (sequence.cell.column.temp[SeqTemps.notationProvider])
46
+ singleValCol.temp[SeqTemps.notationProvider] = sequence.cell.column.temp[SeqTemps.notationProvider];
47
+ // helm and biln will have cyclization marks, so we need to use POM to convert them
48
+ const shouldUsePOM = (seqSh.getSplitted(sequence.cell.rowIndex).graphInfo?.connections?.length ?? 0) > 0;
49
+ await PackageFunctions.toAtomicLevel(sDf, singleValCol,
50
+ shouldUsePOM, false);
43
51
  if (sDf.columns.length < 2) {
44
52
  errorText = 'No structure generated';
45
53
  return {errorText, mol: ''};