@teselagen/ove 0.7.35 → 0.7.36

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/README.md CHANGED
@@ -713,6 +713,6 @@ you can either add your test to an existing cypress file or make a new test file
713
713
 
714
714
  once you're satisfied, make a pull request back to tg-oss and mention @tnrich
715
715
 
716
- ```
716
+ ## Running unit tests
717
717
 
718
- ```
718
+ Run `bun test` from the root of the repo to execute all unit tests.
package/index.cjs.js CHANGED
@@ -83139,7 +83139,7 @@ const proteinAlphabet = {
83139
83139
  mass: 0
83140
83140
  }
83141
83141
  };
83142
- const threeLetterSequenceStringToAminoAcidMap = {
83142
+ const initThreeLetterSequenceStringToAminoAcidMap = {
83143
83143
  gct: proteinAlphabet.A,
83144
83144
  gcc: proteinAlphabet.A,
83145
83145
  gca: proteinAlphabet.A,
@@ -83238,9 +83238,74 @@ const threeLetterSequenceStringToAminoAcidMap = {
83238
83238
  taa: proteinAlphabet["*"],
83239
83239
  tag: proteinAlphabet["*"],
83240
83240
  tga: proteinAlphabet["*"],
83241
+ uaa: proteinAlphabet["*"],
83242
+ uag: proteinAlphabet["*"],
83243
+ uga: proteinAlphabet["*"],
83241
83244
  "...": proteinAlphabet["."],
83242
83245
  "---": proteinAlphabet["-"]
83243
83246
  };
83247
+ const IUPAC = {
83248
+ A: ["A"],
83249
+ C: ["C"],
83250
+ G: ["G"],
83251
+ T: ["T"],
83252
+ U: ["U"],
83253
+ R: ["A", "G"],
83254
+ Y: ["C", "T", "U"],
83255
+ K: ["G", "T", "U"],
83256
+ M: ["A", "C"],
83257
+ S: ["G", "C"],
83258
+ W: ["A", "T", "U"],
83259
+ B: ["C", "G", "T", "U"],
83260
+ D: ["A", "G", "T", "U"],
83261
+ H: ["A", "C", "T", "U"],
83262
+ V: ["A", "C", "G"],
83263
+ N: ["A", "C", "G", "T", "U"],
83264
+ X: ["A", "C", "G", "T", "U"]
83265
+ };
83266
+ function expandAndResolve(threeLetterCodon) {
83267
+ var _a2, _b2;
83268
+ const chars = threeLetterCodon.toUpperCase().split("");
83269
+ const picks = chars.map((c2) => IUPAC[c2] || [c2]);
83270
+ let allPossibleThreeLetterCodons = [""];
83271
+ for (const set6 of picks) {
83272
+ const next = [];
83273
+ for (const prefix2 of allPossibleThreeLetterCodons) for (const b3 of set6) next.push(prefix2 + b3);
83274
+ allPossibleThreeLetterCodons = next;
83275
+ }
83276
+ let foundAminoAcid = null;
83277
+ for (const codon of allPossibleThreeLetterCodons) {
83278
+ const lowerCodon = codon.toLowerCase();
83279
+ const aminoAcidObj = (_b2 = (_a2 = initThreeLetterSequenceStringToAminoAcidMap[lowerCodon]) != null ? _a2 : initThreeLetterSequenceStringToAminoAcidMap[lowerCodon.replace(/u/g, "t")]) != null ? _b2 : initThreeLetterSequenceStringToAminoAcidMap[lowerCodon.replace(/t/g, "u")];
83280
+ if (aminoAcidObj) {
83281
+ if (!foundAminoAcid) {
83282
+ foundAminoAcid = aminoAcidObj;
83283
+ } else if (foundAminoAcid.value !== aminoAcidObj.value) {
83284
+ return null;
83285
+ }
83286
+ } else {
83287
+ return null;
83288
+ }
83289
+ }
83290
+ return foundAminoAcid;
83291
+ }
83292
+ __name(expandAndResolve, "expandAndResolve");
83293
+ function getCodonToAminoAcidMap() {
83294
+ const map3 = initThreeLetterSequenceStringToAminoAcidMap;
83295
+ const codes = Object.keys(IUPAC);
83296
+ for (const a2 of codes)
83297
+ for (const b3 of codes)
83298
+ for (const c2 of codes) {
83299
+ const codon = a2 + b3 + c2;
83300
+ const lowerCodon = codon.toLowerCase();
83301
+ if (map3[lowerCodon]) continue;
83302
+ const aminoAcidObj = expandAndResolve(codon);
83303
+ if (aminoAcidObj) map3[lowerCodon] = aminoAcidObj;
83304
+ }
83305
+ return map3;
83306
+ }
83307
+ __name(getCodonToAminoAcidMap, "getCodonToAminoAcidMap");
83308
+ const threeLetterSequenceStringToAminoAcidMap = getCodonToAminoAcidMap();
83244
83309
  const degenerateDnaToAminoAcidMap = invert(aminoAcidToDegenerateDnaMap);
83245
83310
  function getAminoAcidFromSequenceTriplet(sequenceString) {
83246
83311
  sequenceString = sequenceString.toLowerCase();
@@ -83353,7 +83418,7 @@ function getAminoAcidDataForEachBaseOfDna(originalSequenceString, forward, optio
83353
83418
  const aminoAcidDataForEachBaseOfDNA = [];
83354
83419
  for (let index2 = 0; index2 < sequenceStringLength; index2 += 3) {
83355
83420
  let aminoAcid;
83356
- const aminoAcidIndex = index2 / 3;
83421
+ const aminoAcidIndex = Math.floor(index2 / 3);
83357
83422
  let codonPositionsInCDS;
83358
83423
  let basesRead;
83359
83424
  if (isProteinSequence) {
@@ -124895,7 +124960,7 @@ function showFileDialog({ multiple = false, onSelect }) {
124895
124960
  input.click();
124896
124961
  }
124897
124962
  __name(showFileDialog, "showFileDialog");
124898
- const version = "0.7.34";
124963
+ const version = "0.7.35";
124899
124964
  const packageJson = {
124900
124965
  version
124901
124966
  };
@@ -130061,6 +130126,8 @@ function VectorInteractionHOC(Component) {
130061
130126
  [this.commandEnhancer],
130062
130127
  e,
130063
130128
  () => {
130129
+ document.body.removeEventListener("cut", this.handleCut);
130130
+ document.body.removeEventListener("copy", this.handleCopy);
130064
130131
  if (lastFocusedEl) {
130065
130132
  lastFocusedEl.focus();
130066
130133
  }
package/index.es.js CHANGED
@@ -83121,7 +83121,7 @@ const proteinAlphabet = {
83121
83121
  mass: 0
83122
83122
  }
83123
83123
  };
83124
- const threeLetterSequenceStringToAminoAcidMap = {
83124
+ const initThreeLetterSequenceStringToAminoAcidMap = {
83125
83125
  gct: proteinAlphabet.A,
83126
83126
  gcc: proteinAlphabet.A,
83127
83127
  gca: proteinAlphabet.A,
@@ -83220,9 +83220,74 @@ const threeLetterSequenceStringToAminoAcidMap = {
83220
83220
  taa: proteinAlphabet["*"],
83221
83221
  tag: proteinAlphabet["*"],
83222
83222
  tga: proteinAlphabet["*"],
83223
+ uaa: proteinAlphabet["*"],
83224
+ uag: proteinAlphabet["*"],
83225
+ uga: proteinAlphabet["*"],
83223
83226
  "...": proteinAlphabet["."],
83224
83227
  "---": proteinAlphabet["-"]
83225
83228
  };
83229
+ const IUPAC = {
83230
+ A: ["A"],
83231
+ C: ["C"],
83232
+ G: ["G"],
83233
+ T: ["T"],
83234
+ U: ["U"],
83235
+ R: ["A", "G"],
83236
+ Y: ["C", "T", "U"],
83237
+ K: ["G", "T", "U"],
83238
+ M: ["A", "C"],
83239
+ S: ["G", "C"],
83240
+ W: ["A", "T", "U"],
83241
+ B: ["C", "G", "T", "U"],
83242
+ D: ["A", "G", "T", "U"],
83243
+ H: ["A", "C", "T", "U"],
83244
+ V: ["A", "C", "G"],
83245
+ N: ["A", "C", "G", "T", "U"],
83246
+ X: ["A", "C", "G", "T", "U"]
83247
+ };
83248
+ function expandAndResolve(threeLetterCodon) {
83249
+ var _a2, _b2;
83250
+ const chars = threeLetterCodon.toUpperCase().split("");
83251
+ const picks = chars.map((c2) => IUPAC[c2] || [c2]);
83252
+ let allPossibleThreeLetterCodons = [""];
83253
+ for (const set6 of picks) {
83254
+ const next = [];
83255
+ for (const prefix2 of allPossibleThreeLetterCodons) for (const b3 of set6) next.push(prefix2 + b3);
83256
+ allPossibleThreeLetterCodons = next;
83257
+ }
83258
+ let foundAminoAcid = null;
83259
+ for (const codon of allPossibleThreeLetterCodons) {
83260
+ const lowerCodon = codon.toLowerCase();
83261
+ const aminoAcidObj = (_b2 = (_a2 = initThreeLetterSequenceStringToAminoAcidMap[lowerCodon]) != null ? _a2 : initThreeLetterSequenceStringToAminoAcidMap[lowerCodon.replace(/u/g, "t")]) != null ? _b2 : initThreeLetterSequenceStringToAminoAcidMap[lowerCodon.replace(/t/g, "u")];
83262
+ if (aminoAcidObj) {
83263
+ if (!foundAminoAcid) {
83264
+ foundAminoAcid = aminoAcidObj;
83265
+ } else if (foundAminoAcid.value !== aminoAcidObj.value) {
83266
+ return null;
83267
+ }
83268
+ } else {
83269
+ return null;
83270
+ }
83271
+ }
83272
+ return foundAminoAcid;
83273
+ }
83274
+ __name(expandAndResolve, "expandAndResolve");
83275
+ function getCodonToAminoAcidMap() {
83276
+ const map3 = initThreeLetterSequenceStringToAminoAcidMap;
83277
+ const codes = Object.keys(IUPAC);
83278
+ for (const a2 of codes)
83279
+ for (const b3 of codes)
83280
+ for (const c2 of codes) {
83281
+ const codon = a2 + b3 + c2;
83282
+ const lowerCodon = codon.toLowerCase();
83283
+ if (map3[lowerCodon]) continue;
83284
+ const aminoAcidObj = expandAndResolve(codon);
83285
+ if (aminoAcidObj) map3[lowerCodon] = aminoAcidObj;
83286
+ }
83287
+ return map3;
83288
+ }
83289
+ __name(getCodonToAminoAcidMap, "getCodonToAminoAcidMap");
83290
+ const threeLetterSequenceStringToAminoAcidMap = getCodonToAminoAcidMap();
83226
83291
  const degenerateDnaToAminoAcidMap = invert(aminoAcidToDegenerateDnaMap);
83227
83292
  function getAminoAcidFromSequenceTriplet(sequenceString) {
83228
83293
  sequenceString = sequenceString.toLowerCase();
@@ -83335,7 +83400,7 @@ function getAminoAcidDataForEachBaseOfDna(originalSequenceString, forward, optio
83335
83400
  const aminoAcidDataForEachBaseOfDNA = [];
83336
83401
  for (let index2 = 0; index2 < sequenceStringLength; index2 += 3) {
83337
83402
  let aminoAcid;
83338
- const aminoAcidIndex = index2 / 3;
83403
+ const aminoAcidIndex = Math.floor(index2 / 3);
83339
83404
  let codonPositionsInCDS;
83340
83405
  let basesRead;
83341
83406
  if (isProteinSequence) {
@@ -124877,7 +124942,7 @@ function showFileDialog({ multiple = false, onSelect }) {
124877
124942
  input.click();
124878
124943
  }
124879
124944
  __name(showFileDialog, "showFileDialog");
124880
- const version = "0.7.34";
124945
+ const version = "0.7.35";
124881
124946
  const packageJson = {
124882
124947
  version
124883
124948
  };
@@ -130043,6 +130108,8 @@ function VectorInteractionHOC(Component2) {
130043
130108
  [this.commandEnhancer],
130044
130109
  e,
130045
130110
  () => {
130111
+ document.body.removeEventListener("cut", this.handleCut);
130112
+ document.body.removeEventListener("copy", this.handleCopy);
130046
130113
  if (lastFocusedEl) {
130047
130114
  lastFocusedEl.focus();
130048
130115
  }
package/index.umd.js CHANGED
@@ -112042,7 +112042,7 @@ ${latestSubscriptionCallbackError.current.stack}
112042
112042
  mass: 0
112043
112043
  }
112044
112044
  };
112045
- const threeLetterSequenceStringToAminoAcidMap = {
112045
+ const initThreeLetterSequenceStringToAminoAcidMap = {
112046
112046
  gct: proteinAlphabet.A,
112047
112047
  gcc: proteinAlphabet.A,
112048
112048
  gca: proteinAlphabet.A,
@@ -112141,9 +112141,74 @@ ${latestSubscriptionCallbackError.current.stack}
112141
112141
  taa: proteinAlphabet["*"],
112142
112142
  tag: proteinAlphabet["*"],
112143
112143
  tga: proteinAlphabet["*"],
112144
+ uaa: proteinAlphabet["*"],
112145
+ uag: proteinAlphabet["*"],
112146
+ uga: proteinAlphabet["*"],
112144
112147
  "...": proteinAlphabet["."],
112145
112148
  "---": proteinAlphabet["-"]
112146
112149
  };
112150
+ const IUPAC = {
112151
+ A: ["A"],
112152
+ C: ["C"],
112153
+ G: ["G"],
112154
+ T: ["T"],
112155
+ U: ["U"],
112156
+ R: ["A", "G"],
112157
+ Y: ["C", "T", "U"],
112158
+ K: ["G", "T", "U"],
112159
+ M: ["A", "C"],
112160
+ S: ["G", "C"],
112161
+ W: ["A", "T", "U"],
112162
+ B: ["C", "G", "T", "U"],
112163
+ D: ["A", "G", "T", "U"],
112164
+ H: ["A", "C", "T", "U"],
112165
+ V: ["A", "C", "G"],
112166
+ N: ["A", "C", "G", "T", "U"],
112167
+ X: ["A", "C", "G", "T", "U"]
112168
+ };
112169
+ function expandAndResolve(threeLetterCodon) {
112170
+ var _a2, _b2;
112171
+ const chars2 = threeLetterCodon.toUpperCase().split("");
112172
+ const picks = chars2.map((c2) => IUPAC[c2] || [c2]);
112173
+ let allPossibleThreeLetterCodons = [""];
112174
+ for (const set2 of picks) {
112175
+ const next = [];
112176
+ for (const prefix2 of allPossibleThreeLetterCodons) for (const b3 of set2) next.push(prefix2 + b3);
112177
+ allPossibleThreeLetterCodons = next;
112178
+ }
112179
+ let foundAminoAcid = null;
112180
+ for (const codon of allPossibleThreeLetterCodons) {
112181
+ const lowerCodon = codon.toLowerCase();
112182
+ const aminoAcidObj = (_b2 = (_a2 = initThreeLetterSequenceStringToAminoAcidMap[lowerCodon]) != null ? _a2 : initThreeLetterSequenceStringToAminoAcidMap[lowerCodon.replace(/u/g, "t")]) != null ? _b2 : initThreeLetterSequenceStringToAminoAcidMap[lowerCodon.replace(/t/g, "u")];
112183
+ if (aminoAcidObj) {
112184
+ if (!foundAminoAcid) {
112185
+ foundAminoAcid = aminoAcidObj;
112186
+ } else if (foundAminoAcid.value !== aminoAcidObj.value) {
112187
+ return null;
112188
+ }
112189
+ } else {
112190
+ return null;
112191
+ }
112192
+ }
112193
+ return foundAminoAcid;
112194
+ }
112195
+ __name(expandAndResolve, "expandAndResolve");
112196
+ function getCodonToAminoAcidMap() {
112197
+ const map2 = initThreeLetterSequenceStringToAminoAcidMap;
112198
+ const codes = Object.keys(IUPAC);
112199
+ for (const a2 of codes)
112200
+ for (const b3 of codes)
112201
+ for (const c2 of codes) {
112202
+ const codon = a2 + b3 + c2;
112203
+ const lowerCodon = codon.toLowerCase();
112204
+ if (map2[lowerCodon]) continue;
112205
+ const aminoAcidObj = expandAndResolve(codon);
112206
+ if (aminoAcidObj) map2[lowerCodon] = aminoAcidObj;
112207
+ }
112208
+ return map2;
112209
+ }
112210
+ __name(getCodonToAminoAcidMap, "getCodonToAminoAcidMap");
112211
+ const threeLetterSequenceStringToAminoAcidMap = getCodonToAminoAcidMap();
112147
112212
  const degenerateDnaToAminoAcidMap = invert(aminoAcidToDegenerateDnaMap);
112148
112213
  function getAminoAcidFromSequenceTriplet(sequenceString) {
112149
112214
  sequenceString = sequenceString.toLowerCase();
@@ -112256,7 +112321,7 @@ ${latestSubscriptionCallbackError.current.stack}
112256
112321
  const aminoAcidDataForEachBaseOfDNA = [];
112257
112322
  for (let index2 = 0; index2 < sequenceStringLength; index2 += 3) {
112258
112323
  let aminoAcid;
112259
- const aminoAcidIndex = index2 / 3;
112324
+ const aminoAcidIndex = Math.floor(index2 / 3);
112260
112325
  let codonPositionsInCDS;
112261
112326
  let basesRead;
112262
112327
  if (isProteinSequence) {
@@ -152993,7 +153058,7 @@ Part of ${annotation.translationType} Translation from BPs ${annotation.start +
152993
153058
  input.click();
152994
153059
  }
152995
153060
  __name(showFileDialog, "showFileDialog");
152996
- const version = "0.7.34";
153061
+ const version = "0.7.35";
152997
153062
  const packageJson = {
152998
153063
  version
152999
153064
  };
@@ -156557,6 +156622,8 @@ Part of ${annotation.translationType} Translation from BPs ${annotation.start +
156557
156622
  [this.commandEnhancer],
156558
156623
  e2,
156559
156624
  () => {
156625
+ document.body.removeEventListener("cut", this.handleCut);
156626
+ document.body.removeEventListener("copy", this.handleCopy);
156560
156627
  if (lastFocusedEl) {
156561
156628
  lastFocusedEl.focus();
156562
156629
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teselagen/ove",
3
- "version": "0.7.35",
3
+ "version": "0.7.36",
4
4
  "main": "./src/index.js",
5
5
  "type": "module",
6
6
  "exports": {
@@ -19,7 +19,7 @@
19
19
  "@teselagen/range-utils": "0.3.13",
20
20
  "@teselagen/react-list": "0.8.18",
21
21
  "@teselagen/sequence-utils": "0.3.32",
22
- "@teselagen/ui": "0.9.5",
22
+ "@teselagen/ui": "0.9.6",
23
23
  "@use-gesture/react": "10.3.0",
24
24
  "biomsa": "^0.2.4",
25
25
  "classnames": "^2.3.2",
@@ -242,7 +242,11 @@ function VectorInteractionHOC(Component /* options */) {
242
242
  seqDataToInsert.proteinSequence = seqDataToInsert.sequence;
243
243
  }
244
244
 
245
- if (maxInsertSize && (seqDataToInsert.proteinSequence || seqDataToInsert.sequence).length > maxInsertSize) {
245
+ if (
246
+ maxInsertSize &&
247
+ (seqDataToInsert.proteinSequence || seqDataToInsert.sequence).length >
248
+ maxInsertSize
249
+ ) {
246
250
  return window.toastr.error(
247
251
  `Sorry, the pasted sequence exceeds the maximum allowed length of ${maxInsertSize}`
248
252
  );
@@ -395,7 +399,7 @@ function VectorInteractionHOC(Component /* options */) {
395
399
  sequenceData = { sequence: "" },
396
400
  readOnly,
397
401
  disableBpEditing,
398
- maxInsertSize,
402
+ maxInsertSize
399
403
  // updateSequenceData,
400
404
  // wrappedInsertSequenceDataAtPositionOrRange
401
405
  // handleInsert
@@ -611,6 +615,7 @@ function VectorInteractionHOC(Component /* options */) {
611
615
  const { sequenceData, readOnly, disableBpEditing, selectionLayer } =
612
616
  this.props;
613
617
  const { isProtein } = sequenceData;
618
+
614
619
  // Add the appropriate listener
615
620
  document.body.addEventListener("copy", this.handleCopy, { once: true });
616
621
  document.body.addEventListener("cut", this.handleCut, { once: true });
@@ -836,6 +841,8 @@ function VectorInteractionHOC(Component /* options */) {
836
841
  [this.commandEnhancer],
837
842
  e,
838
843
  () => {
844
+ document.body.removeEventListener("cut", this.handleCut);
845
+ document.body.removeEventListener("copy", this.handleCopy);
839
846
  if (lastFocusedEl) {
840
847
  lastFocusedEl.focus();
841
848
  }