@datagrok/bio 2.1.9 → 2.1.10

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/detectors.js CHANGED
@@ -138,7 +138,8 @@ class BioPackageDetectors extends DG.Package {
138
138
  // TODO: Lazy calculations could be helpful for performance and convenient for expressing classification logic.
139
139
  const statsAsChars = this.getStats(categoriesSample, 5,
140
140
  this.getSplitterAsChars(SEQ_SAMPLE_LENGTH_LIMIT));
141
- // if (Object.keys(statsAsChars.freq).length === 0) return;
141
+ // Empty statsAsShars.freq alphabet means no strings of enough length presented in the data
142
+ if (Object.keys(statsAsChars.freq).length === 0) return;
142
143
 
143
144
  const decoy = this.detectAlphabet(statsAsChars.freq, decoyAlphabets, null);
144
145
  if (decoy != ALPHABET.UN) return null;
@@ -153,15 +154,13 @@ class BioPackageDetectors extends DG.Package {
153
154
  if (separator) col.setTag(UnitsHandler.TAGS.separator, separator);
154
155
 
155
156
  if (statsAsChars.sameLength) {
156
- if (Object.keys(statsAsChars.freq).length > 0) { // require non empty alphabet
157
- const stats = this.getStats(categoriesSample, 5, splitter);
158
- const alphabet = this.detectAlphabet(stats.freq, candidateAlphabets, '-');
159
- if (alphabet === ALPHABET.UN) return null;
157
+ const stats = this.getStats(categoriesSample, 5, splitter);
158
+ const alphabet = this.detectAlphabet(stats.freq, candidateAlphabets, '-');
159
+ if (alphabet === ALPHABET.UN) return null;
160
160
 
161
- col.setTag(UnitsHandler.TAGS.aligned, ALIGNMENT.SEQ_MSA);
162
- col.setTag(UnitsHandler.TAGS.alphabet, alphabet);
163
- return DG.SEMTYPE.MACROMOLECULE;
164
- }
161
+ col.setTag(UnitsHandler.TAGS.aligned, ALIGNMENT.SEQ_MSA);
162
+ col.setTag(UnitsHandler.TAGS.alphabet, alphabet);
163
+ return DG.SEMTYPE.MACROMOLECULE;
165
164
  } else {
166
165
  const stats = this.getStats(categoriesSample, 5, splitter);
167
166
  // Empty monomer alphabet is not allowed