@datagrok/bio 1.5.6 → 1.5.9

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.
Files changed (40) hide show
  1. package/css/helm.css +3 -0
  2. package/detectors.js +16 -17
  3. package/dist/package-test.js +1134 -425
  4. package/dist/package.js +906 -259
  5. package/files/samples/sample_FASTA.csv +66 -66
  6. package/files/samples/testDemog.csv +5851 -0
  7. package/files/samples/testHelm.csv +6 -0
  8. package/files/samples/{id.csv → testId.csv} +0 -0
  9. package/files/samples/{sar-small.csv → testSmiles.csv} +0 -0
  10. package/helm/JSDraw/Pistoia.HELM-uncompressed.js +9694 -0
  11. package/helm/JSDraw/Pistoia.HELM.js +27 -0
  12. package/helm/JSDraw/ReadMe.txt +8 -0
  13. package/helm/JSDraw/Scilligence.JSDraw2.Lite-uncompressed.js +31126 -0
  14. package/helm/JSDraw/Scilligence.JSDraw2.Lite.js +12 -0
  15. package/helm/JSDraw/Scilligence.JSDraw2.Resources.js +762 -0
  16. package/helm/JSDraw/dojo.js +250 -0
  17. package/helm/JSDraw/test.html +21 -0
  18. package/package.json +9 -2
  19. package/src/monomer-library.ts +199 -0
  20. package/src/package-test.ts +2 -0
  21. package/src/package.ts +41 -13
  22. package/src/tests/convert-test.ts +143 -22
  23. package/src/tests/detectors-test.ts +133 -156
  24. package/src/tests/renderer-test.ts +36 -0
  25. package/src/tests/splitter-test.ts +22 -0
  26. package/src/tests/types.ts +7 -0
  27. package/src/utils/atomic-works.ts +218 -97
  28. package/src/utils/cell-renderer.ts +211 -0
  29. package/src/utils/chem-palette.ts +280 -0
  30. package/src/utils/convert.ts +25 -16
  31. package/src/utils/misc.ts +29 -0
  32. package/src/utils/multiple-sequence-alignment.ts +1 -1
  33. package/src/utils/notation-converter.ts +120 -84
  34. package/src/utils/sequence-activity-cliffs.ts +2 -2
  35. package/src/utils/types.ts +13 -0
  36. package/src/utils/utils.ts +35 -30
  37. package/test-Bio-34f75e5127b8-b47d4664.html +260 -0
  38. package/files/sample_FASTA.csv +0 -66
  39. package/files/sample_FASTA_with_activities.csv +0 -66
  40. package/files/sample_MSA.csv +0 -541
package/css/helm.css ADDED
@@ -0,0 +1,3 @@
1
+ .d4-g-cell[semType="Macromolecule"] * {
2
+ pointer-events: none !important;
3
+ }
package/detectors.js CHANGED
@@ -13,16 +13,14 @@ class BioPackageDetectors extends DG.Package {
13
13
 
14
14
  static mmSemType = 'Macromolecule';
15
15
 
16
- static Units = {
17
- FastaSeqPt: 'fasta:SEQ:PT', FastaSeqNt: 'fasta:SEQ:NT', FastaMsaPt: 'fasta:MSA:PT', FastaMsaNt: 'fasta:MSA:NT',
18
- };
19
-
20
- static AminoacidsFastaAlphabet = new Set([
16
+ static PeptideFastaAlphabet = new Set([
21
17
  'G', 'L', 'Y', 'S', 'E', 'Q', 'D', 'N', 'F', 'A',
22
18
  'K', 'R', 'H', 'C', 'V', 'P', 'W', 'I', 'M', 'T',
23
19
  ]);
24
20
 
25
- static NucleotidesFastaAlphabet = new Set(['A', 'C', 'G', 'T']);
21
+ static DnaFastaAlphabet = new Set(['A', 'C', 'G', 'T']);
22
+
23
+ static RnaFastaAlphabet = new Set(['A', 'C', 'G', 'U']);
26
24
 
27
25
 
28
26
  /** @param s {String} - string to check
@@ -43,8 +41,9 @@ class BioPackageDetectors extends DG.Package {
43
41
  }
44
42
 
45
43
  const alphabetCandidates = [
46
- ['NT', BioPackageDetectors.NucleotidesFastaAlphabet],
47
- ['PT', BioPackageDetectors.AminoacidsFastaAlphabet],
44
+ ['PT', BioPackageDetectors.PeptideFastaAlphabet],
45
+ ['DNA', BioPackageDetectors.DnaFastaAlphabet],
46
+ ['RNA', BioPackageDetectors.RnaFastaAlphabet],
48
47
  ];
49
48
 
50
49
  // TODO: Detect HELM sequence
@@ -76,8 +75,8 @@ class BioPackageDetectors extends DG.Package {
76
75
  // TODO: If separator detected, then extra efforts to detect alphabet are allowed.
77
76
  const alphabet = BioPackageDetectors.detectAlphabet(stats.freq, alphabetCandidates, gapSymbol);
78
77
 
79
- const forbidden = BioPackageDetectors.checkForbiddenWoSeparator(stats.freq);
80
- if (separator || !forbidden) {
78
+ // const forbidden = BioPackageDetectors.checkForbiddenWoSeparator(stats.freq);
79
+ if (separator || alphabet != 'UN') {
81
80
  const units = `${format}:${seqType}:${alphabet}`;
82
81
  col.setTag(DG.TAGS.UNITS, units);
83
82
  if (separator) col.setTag('separator', separator);
@@ -103,8 +102,8 @@ class BioPackageDetectors extends DG.Package {
103
102
  const cleanFreq = Object.assign({}, ...Object.entries(freq)
104
103
  .filter(([m, f]) => m != ' ' &&
105
104
  !noSeparatorChemRe.test(m) && !noSeparatorAlphaDigitRe.test(m) &&
106
- !BioPackageDetectors.AminoacidsFastaAlphabet.has(m) &&
107
- !BioPackageDetectors.NucleotidesFastaAlphabet.has(m))
105
+ !BioPackageDetectors.PeptideFastaAlphabet.has(m) &&
106
+ !BioPackageDetectors.DnaFastaAlphabet.has(m))
108
107
  .map(([m, f]) => ({[m]: f})));
109
108
  if (Object.keys(cleanFreq).length == 0) return null;
110
109
 
@@ -124,11 +123,11 @@ class BioPackageDetectors extends DG.Package {
124
123
  return Object.keys(freq).filter((m) => forbiddenRe.test(m)).length > 0;
125
124
  }
126
125
 
127
- /** Without a separator, special symbols or digits are not allowed as monomers. */
128
- static checkForbiddenWoSeparator(freq) {
129
- const forbiddenRe = /[\d!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]/i;
130
- return Object.keys(freq).filter((m) => forbiddenRe.test(m)).length > 0;
131
- }
126
+ // /** Without a separator, special symbols or digits are not allowed as monomers. */
127
+ // static checkForbiddenWoSeparator(freq) {
128
+ // const forbiddenRe = /[\d!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]/i;
129
+ // return Object.keys(freq).filter((m) => forbiddenRe.test(m)).length > 0;
130
+ // }
132
131
 
133
132
  /** Stats of sequences with specified splitter func, returns { freq, sameLength } */
134
133
  static getStats(seqCol, minLength, splitter) {