@teselagen/ove 0.8.36 → 0.8.37

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.
@@ -1,6 +1,6 @@
1
- export function sizeSchema(isProtein: any): {
1
+ export function sizeSchema(): {
2
2
  path: string;
3
3
  type: string;
4
- render: (val: any, _record: any) => import("react/jsx-runtime").JSX.Element;
4
+ render: (val: any, record: any) => import("react/jsx-runtime").JSX.Element;
5
5
  };
6
6
  export function getMemoOrfs(editorState: any): any;
package/index.cjs.js CHANGED
@@ -20258,6 +20258,23 @@ function applyWhereClause(records, where) {
20258
20258
  if (!isString$1(value) || !new RegExp(conditionValue.replace(/%/g, ".*")).test(value))
20259
20259
  return false;
20260
20260
  break;
20261
+ case "_in":
20262
+ if (!some(conditionValue, (item) => isEqual$3(value, item)))
20263
+ return false;
20264
+ break;
20265
+ case "_nin":
20266
+ if (some(conditionValue, (item) => isEqual$3(value, item)))
20267
+ return false;
20268
+ break;
20269
+ case "_regex": {
20270
+ try {
20271
+ if (!isString$1(value) || !new RegExp(conditionValue).test(value))
20272
+ return false;
20273
+ } catch (e) {
20274
+ return false;
20275
+ }
20276
+ break;
20277
+ }
20261
20278
  default:
20262
20279
  if (operator.startsWith("_")) {
20263
20280
  console.warn(`Unsupported operator: ${operator}`);
@@ -50812,7 +50829,7 @@ const FilterAndSortMenu = /* @__PURE__ */ __name(({
50812
50829
  filterValToUse = false;
50813
50830
  } else if (ccSelectedFilter2 === "inList" || ccSelectedFilter2 === "notInList") {
50814
50831
  if (dataType === "number") {
50815
- filterValToUse = filterValue && filterValue.map((val2) => parseFloat(val2.replaceAll(",", "")));
50832
+ filterValToUse = filterValue && filterValue.map((val2) => parseFloat(`${val2}`.replaceAll(",", "")));
50816
50833
  }
50817
50834
  }
50818
50835
  if (isInvalidFilterValue(filterValToUse)) {
@@ -50918,7 +50935,7 @@ const FilterInput = /* @__PURE__ */ __name(({
50918
50935
  multi: true,
50919
50936
  creatable: true,
50920
50937
  value: (filterValue || []).map((val2) => ({
50921
- label: val2,
50938
+ label: `${val2}`,
50922
50939
  value: val2
50923
50940
  })),
50924
50941
  onChange: /* @__PURE__ */ __name((selectedOptions) => {
@@ -117191,7 +117208,7 @@ function showFileDialog({ multiple = false, onSelect }) {
117191
117208
  input.click();
117192
117209
  }
117193
117210
  __name(showFileDialog, "showFileDialog");
117194
- const version = "0.8.36";
117211
+ const version = "0.8.37";
117195
117212
  const packageJson = {
117196
117213
  version
117197
117214
  };
@@ -127692,14 +127709,13 @@ const _ComponentToPrint = class _ComponentToPrint extends React.Component {
127692
127709
  };
127693
127710
  __name(_ComponentToPrint, "ComponentToPrint");
127694
127711
  let ComponentToPrint = _ComponentToPrint;
127695
- const sizeSchema = /* @__PURE__ */ __name((isProtein2) => ({
127712
+ const sizeSchema = /* @__PURE__ */ __name(() => ({
127696
127713
  path: "size",
127697
127714
  type: "number",
127698
- render: /* @__PURE__ */ __name((val2, _record) => {
127699
- const record = isProtein2 ? convertDnaCaretPositionOrRangeToAA(_record) : _record;
127715
+ render: /* @__PURE__ */ __name((val2, record) => {
127700
127716
  const base1Range = convertRangeTo1Based(record);
127701
127717
  const hasJoinedLocations = record.locations && record.locations.length > 1;
127702
- return /* @__PURE__ */ React.createElement("span", null, isProtein2 ? Math.floor(val2 / 3) : val2, " ", /* @__PURE__ */ React.createElement("span", { style: { fontSize: 10 } }, hasJoinedLocations ? record.locations.map((loc, i) => {
127718
+ return /* @__PURE__ */ React.createElement("span", null, val2, " ", /* @__PURE__ */ React.createElement("span", { style: { fontSize: 10 } }, hasJoinedLocations ? record.locations.map((loc, i) => {
127703
127719
  const base1Range2 = convertRangeTo1Based(loc);
127704
127720
  return /* @__PURE__ */ React.createElement("span", { key: i }, "(", base1Range2.start, "-", base1Range2.end, ")");
127705
127721
  }) : /* @__PURE__ */ React.createElement("span", null, "(", base1Range.start, "-", base1Range.end, ")")));
@@ -127709,11 +127725,7 @@ const getMemoOrfs = /* @__PURE__ */ (() => {
127709
127725
  let lastDeps;
127710
127726
  let lastResult;
127711
127727
  return (editorState) => {
127712
- const {
127713
- sequenceData: sequenceData2,
127714
- minimumOrfSize: minimumOrfSize2,
127715
- useAdditionalOrfStartCodons: useAdditionalOrfStartCodons2
127716
- } = editorState;
127728
+ const { sequenceData: sequenceData2, minimumOrfSize: minimumOrfSize2, useAdditionalOrfStartCodons: useAdditionalOrfStartCodons2 } = editorState;
127717
127729
  const { sequence: sequence2, circular: circular2 } = sequenceData2;
127718
127730
  const deps = {
127719
127731
  sequence: sequence2,
@@ -133730,6 +133742,7 @@ const RemoveDuplicatesDialog = /* @__PURE__ */ __name((props) => {
133730
133742
  const ignoreName = useFormValue(dialogFormName, "ignoreName");
133731
133743
  const ignoreStartAndEnd = useFormValue(dialogFormName, "ignoreStartAndEnd");
133732
133744
  const ignoreStrand = useFormValue(dialogFormName, "ignoreStrand");
133745
+ const isProteinSeq = isProtein2 || sequenceData2.isProtein;
133733
133746
  const recomputeDups = React.useCallback(
133734
133747
  (values3) => {
133735
133748
  const ignoreName2 = values3 == null ? void 0 : values3.ignoreName;
@@ -133738,17 +133751,20 @@ const RemoveDuplicatesDialog = /* @__PURE__ */ __name((props) => {
133738
133751
  const annotations = sequenceData2[type2];
133739
133752
  const newDups = [];
133740
133753
  const seqsHashByStartEndStrandName = {};
133741
- forEach$1(annotations, (a2) => {
133742
- const hash2 = `${ignoreStartAndEnd2 ? "" : a2.start}&${ignoreStartAndEnd2 ? "" : a2.end}&${ignoreStrand2 ? "" : a2.strand}&${ignoreName2 ? "" : a2.name}`;
133754
+ forEach$1(annotations, (_annotation) => {
133755
+ const annotation = isProteinSeq ? convertDnaCaretPositionOrRangeToAA(_annotation) : _annotation;
133756
+ const hash2 = `${ignoreStartAndEnd2 ? "" : annotation.start}&${ignoreStartAndEnd2 ? "" : annotation.end}&${ignoreStrand2 ? "" : annotation.strand}&${ignoreName2 ? "" : annotation.name}`;
133743
133757
  if (seqsHashByStartEndStrandName[hash2]) {
133744
- newDups.push(__spreadProps(__spreadValues({}, a2), { size: getRangeLength(a2, sequenceLength) }));
133758
+ newDups.push(__spreadProps(__spreadValues({}, annotation), {
133759
+ size: getRangeLength(annotation, sequenceLength)
133760
+ }));
133745
133761
  } else {
133746
133762
  seqsHashByStartEndStrandName[hash2] = true;
133747
133763
  }
133748
133764
  });
133749
133765
  return newDups;
133750
133766
  },
133751
- [sequenceData2, sequenceLength, type2]
133767
+ [sequenceData2, sequenceLength, type2, isProteinSeq]
133752
133768
  );
133753
133769
  const [dups, setDups] = React.useState(recomputeDups);
133754
133770
  const selectedIds = React.useMemo(() => dups.map((d2) => d2.id), [dups]);
@@ -133770,11 +133786,11 @@ const RemoveDuplicatesDialog = /* @__PURE__ */ __name((props) => {
133770
133786
  fields: [
133771
133787
  { path: "name", type: "string" },
133772
133788
  // ...(noType ? [] : [{ path: "type", type: "string" }]),
133773
- sizeSchema(isProtein2),
133789
+ sizeSchema(),
133774
133790
  { path: "strand", type: "string" }
133775
133791
  ]
133776
133792
  }),
133777
- [isProtein2]
133793
+ []
133778
133794
  );
133779
133795
  return /* @__PURE__ */ React.createElement("div", { className: classNames(core.Classes.DIALOG_BODY, "tg-min-width-dialog") }, /* @__PURE__ */ React.createElement(
133780
133796
  WrappedDT,
@@ -144235,14 +144251,15 @@ const genericAnnotationProperties = /* @__PURE__ */ __name(({
144235
144251
  const annotationPropertiesSelectedEntities = _annotationPropertiesSelectedEntities.filter((a2) => annotations[a2.id]);
144236
144252
  const deleteAnnotation = props[`delete${annotationTypeUpper}`];
144237
144253
  const annotationsToUse = React.useMemo(
144238
- () => map$3(annotations, (annotation) => {
144254
+ () => map$3(annotations, (_annotation) => {
144255
+ const annotation = isProtein2 ? convertDnaCaretPositionOrRangeToAA(_annotation) : _annotation;
144239
144256
  return __spreadProps(__spreadValues(__spreadValues({}, annotation), annotation.strand === void 0 && {
144240
144257
  strand: annotation.forward ? 1 : -1
144241
144258
  }), {
144242
144259
  size: getRangeLength(annotation, sequenceLength)
144243
144260
  });
144244
144261
  }),
144245
- [annotations, sequenceLength]
144262
+ [annotations, sequenceLength, isProtein2]
144246
144263
  );
144247
144264
  const keyedPartTags = (_a2 = getKeyedTagsAndTagOptions(allPartTags)) != null ? _a2 : {};
144248
144265
  const additionalColumns = ((_c = (_b2 = PropertiesProps == null ? void 0 : PropertiesProps.propertiesList) == null ? void 0 : _b2.find(
@@ -144312,7 +144329,7 @@ const genericAnnotationProperties = /* @__PURE__ */ __name(({
144312
144329
  }, "render")
144313
144330
  }
144314
144331
  ],
144315
- sizeSchema(isProtein2),
144332
+ sizeSchema(),
144316
144333
  ...withTags && allPartTags ? [
144317
144334
  {
144318
144335
  path: "tags",
@@ -144806,7 +144823,7 @@ const _OrfProperties = class _OrfProperties extends React.Component {
144806
144823
  displayName: "Size (aa)",
144807
144824
  type: "number"
144808
144825
  },
144809
- sizeSchema(this.props.isProtein),
144826
+ sizeSchema(),
144810
144827
  { path: "frame", type: "number" },
144811
144828
  { path: "strand", type: "number" }
144812
144829
  ]
package/index.es.js CHANGED
@@ -20240,6 +20240,23 @@ function applyWhereClause(records, where) {
20240
20240
  if (!isString$1(value) || !new RegExp(conditionValue.replace(/%/g, ".*")).test(value))
20241
20241
  return false;
20242
20242
  break;
20243
+ case "_in":
20244
+ if (!some(conditionValue, (item) => isEqual$3(value, item)))
20245
+ return false;
20246
+ break;
20247
+ case "_nin":
20248
+ if (some(conditionValue, (item) => isEqual$3(value, item)))
20249
+ return false;
20250
+ break;
20251
+ case "_regex": {
20252
+ try {
20253
+ if (!isString$1(value) || !new RegExp(conditionValue).test(value))
20254
+ return false;
20255
+ } catch (e) {
20256
+ return false;
20257
+ }
20258
+ break;
20259
+ }
20243
20260
  default:
20244
20261
  if (operator.startsWith("_")) {
20245
20262
  console.warn(`Unsupported operator: ${operator}`);
@@ -50794,7 +50811,7 @@ const FilterAndSortMenu = /* @__PURE__ */ __name(({
50794
50811
  filterValToUse = false;
50795
50812
  } else if (ccSelectedFilter2 === "inList" || ccSelectedFilter2 === "notInList") {
50796
50813
  if (dataType === "number") {
50797
- filterValToUse = filterValue && filterValue.map((val2) => parseFloat(val2.replaceAll(",", "")));
50814
+ filterValToUse = filterValue && filterValue.map((val2) => parseFloat(`${val2}`.replaceAll(",", "")));
50798
50815
  }
50799
50816
  }
50800
50817
  if (isInvalidFilterValue(filterValToUse)) {
@@ -50900,7 +50917,7 @@ const FilterInput = /* @__PURE__ */ __name(({
50900
50917
  multi: true,
50901
50918
  creatable: true,
50902
50919
  value: (filterValue || []).map((val2) => ({
50903
- label: val2,
50920
+ label: `${val2}`,
50904
50921
  value: val2
50905
50922
  })),
50906
50923
  onChange: /* @__PURE__ */ __name((selectedOptions) => {
@@ -117173,7 +117190,7 @@ function showFileDialog({ multiple = false, onSelect }) {
117173
117190
  input.click();
117174
117191
  }
117175
117192
  __name(showFileDialog, "showFileDialog");
117176
- const version = "0.8.36";
117193
+ const version = "0.8.37";
117177
117194
  const packageJson = {
117178
117195
  version
117179
117196
  };
@@ -127674,14 +127691,13 @@ const _ComponentToPrint = class _ComponentToPrint extends React__default.Compone
127674
127691
  };
127675
127692
  __name(_ComponentToPrint, "ComponentToPrint");
127676
127693
  let ComponentToPrint = _ComponentToPrint;
127677
- const sizeSchema = /* @__PURE__ */ __name((isProtein2) => ({
127694
+ const sizeSchema = /* @__PURE__ */ __name(() => ({
127678
127695
  path: "size",
127679
127696
  type: "number",
127680
- render: /* @__PURE__ */ __name((val2, _record) => {
127681
- const record = isProtein2 ? convertDnaCaretPositionOrRangeToAA(_record) : _record;
127697
+ render: /* @__PURE__ */ __name((val2, record) => {
127682
127698
  const base1Range = convertRangeTo1Based(record);
127683
127699
  const hasJoinedLocations = record.locations && record.locations.length > 1;
127684
- return /* @__PURE__ */ React__default.createElement("span", null, isProtein2 ? Math.floor(val2 / 3) : val2, " ", /* @__PURE__ */ React__default.createElement("span", { style: { fontSize: 10 } }, hasJoinedLocations ? record.locations.map((loc, i) => {
127700
+ return /* @__PURE__ */ React__default.createElement("span", null, val2, " ", /* @__PURE__ */ React__default.createElement("span", { style: { fontSize: 10 } }, hasJoinedLocations ? record.locations.map((loc, i) => {
127685
127701
  const base1Range2 = convertRangeTo1Based(loc);
127686
127702
  return /* @__PURE__ */ React__default.createElement("span", { key: i }, "(", base1Range2.start, "-", base1Range2.end, ")");
127687
127703
  }) : /* @__PURE__ */ React__default.createElement("span", null, "(", base1Range.start, "-", base1Range.end, ")")));
@@ -127691,11 +127707,7 @@ const getMemoOrfs = /* @__PURE__ */ (() => {
127691
127707
  let lastDeps;
127692
127708
  let lastResult;
127693
127709
  return (editorState) => {
127694
- const {
127695
- sequenceData: sequenceData2,
127696
- minimumOrfSize: minimumOrfSize2,
127697
- useAdditionalOrfStartCodons: useAdditionalOrfStartCodons2
127698
- } = editorState;
127710
+ const { sequenceData: sequenceData2, minimumOrfSize: minimumOrfSize2, useAdditionalOrfStartCodons: useAdditionalOrfStartCodons2 } = editorState;
127699
127711
  const { sequence: sequence2, circular: circular2 } = sequenceData2;
127700
127712
  const deps = {
127701
127713
  sequence: sequence2,
@@ -133712,6 +133724,7 @@ const RemoveDuplicatesDialog = /* @__PURE__ */ __name((props) => {
133712
133724
  const ignoreName = useFormValue(dialogFormName, "ignoreName");
133713
133725
  const ignoreStartAndEnd = useFormValue(dialogFormName, "ignoreStartAndEnd");
133714
133726
  const ignoreStrand = useFormValue(dialogFormName, "ignoreStrand");
133727
+ const isProteinSeq = isProtein2 || sequenceData2.isProtein;
133715
133728
  const recomputeDups = useCallback$1(
133716
133729
  (values3) => {
133717
133730
  const ignoreName2 = values3 == null ? void 0 : values3.ignoreName;
@@ -133720,17 +133733,20 @@ const RemoveDuplicatesDialog = /* @__PURE__ */ __name((props) => {
133720
133733
  const annotations = sequenceData2[type2];
133721
133734
  const newDups = [];
133722
133735
  const seqsHashByStartEndStrandName = {};
133723
- forEach$1(annotations, (a2) => {
133724
- const hash2 = `${ignoreStartAndEnd2 ? "" : a2.start}&${ignoreStartAndEnd2 ? "" : a2.end}&${ignoreStrand2 ? "" : a2.strand}&${ignoreName2 ? "" : a2.name}`;
133736
+ forEach$1(annotations, (_annotation) => {
133737
+ const annotation = isProteinSeq ? convertDnaCaretPositionOrRangeToAA(_annotation) : _annotation;
133738
+ const hash2 = `${ignoreStartAndEnd2 ? "" : annotation.start}&${ignoreStartAndEnd2 ? "" : annotation.end}&${ignoreStrand2 ? "" : annotation.strand}&${ignoreName2 ? "" : annotation.name}`;
133725
133739
  if (seqsHashByStartEndStrandName[hash2]) {
133726
- newDups.push(__spreadProps(__spreadValues({}, a2), { size: getRangeLength(a2, sequenceLength) }));
133740
+ newDups.push(__spreadProps(__spreadValues({}, annotation), {
133741
+ size: getRangeLength(annotation, sequenceLength)
133742
+ }));
133727
133743
  } else {
133728
133744
  seqsHashByStartEndStrandName[hash2] = true;
133729
133745
  }
133730
133746
  });
133731
133747
  return newDups;
133732
133748
  },
133733
- [sequenceData2, sequenceLength, type2]
133749
+ [sequenceData2, sequenceLength, type2, isProteinSeq]
133734
133750
  );
133735
133751
  const [dups, setDups] = useState(recomputeDups);
133736
133752
  const selectedIds = useMemo$1(() => dups.map((d2) => d2.id), [dups]);
@@ -133752,11 +133768,11 @@ const RemoveDuplicatesDialog = /* @__PURE__ */ __name((props) => {
133752
133768
  fields: [
133753
133769
  { path: "name", type: "string" },
133754
133770
  // ...(noType ? [] : [{ path: "type", type: "string" }]),
133755
- sizeSchema(isProtein2),
133771
+ sizeSchema(),
133756
133772
  { path: "strand", type: "string" }
133757
133773
  ]
133758
133774
  }),
133759
- [isProtein2]
133775
+ []
133760
133776
  );
133761
133777
  return /* @__PURE__ */ React__default.createElement("div", { className: classNames(Classes.DIALOG_BODY, "tg-min-width-dialog") }, /* @__PURE__ */ React__default.createElement(
133762
133778
  WrappedDT,
@@ -144217,14 +144233,15 @@ const genericAnnotationProperties = /* @__PURE__ */ __name(({
144217
144233
  const annotationPropertiesSelectedEntities = _annotationPropertiesSelectedEntities.filter((a2) => annotations[a2.id]);
144218
144234
  const deleteAnnotation = props[`delete${annotationTypeUpper}`];
144219
144235
  const annotationsToUse = React__default.useMemo(
144220
- () => map$3(annotations, (annotation) => {
144236
+ () => map$3(annotations, (_annotation) => {
144237
+ const annotation = isProtein2 ? convertDnaCaretPositionOrRangeToAA(_annotation) : _annotation;
144221
144238
  return __spreadProps(__spreadValues(__spreadValues({}, annotation), annotation.strand === void 0 && {
144222
144239
  strand: annotation.forward ? 1 : -1
144223
144240
  }), {
144224
144241
  size: getRangeLength(annotation, sequenceLength)
144225
144242
  });
144226
144243
  }),
144227
- [annotations, sequenceLength]
144244
+ [annotations, sequenceLength, isProtein2]
144228
144245
  );
144229
144246
  const keyedPartTags = (_a2 = getKeyedTagsAndTagOptions(allPartTags)) != null ? _a2 : {};
144230
144247
  const additionalColumns = ((_c = (_b2 = PropertiesProps == null ? void 0 : PropertiesProps.propertiesList) == null ? void 0 : _b2.find(
@@ -144294,7 +144311,7 @@ const genericAnnotationProperties = /* @__PURE__ */ __name(({
144294
144311
  }, "render")
144295
144312
  }
144296
144313
  ],
144297
- sizeSchema(isProtein2),
144314
+ sizeSchema(),
144298
144315
  ...withTags && allPartTags ? [
144299
144316
  {
144300
144317
  path: "tags",
@@ -144788,7 +144805,7 @@ const _OrfProperties = class _OrfProperties extends React__default.Component {
144788
144805
  displayName: "Size (aa)",
144789
144806
  type: "number"
144790
144807
  },
144791
- sizeSchema(this.props.isProtein),
144808
+ sizeSchema(),
144792
144809
  { path: "frame", type: "number" },
144793
144810
  { path: "strand", type: "number" }
144794
144811
  ]
package/index.umd.js CHANGED
@@ -46511,6 +46511,23 @@ ${latestSubscriptionCallbackError.current.stack}
46511
46511
  if (!isString$1(value) || !new RegExp(conditionValue.replace(/%/g, ".*")).test(value))
46512
46512
  return false;
46513
46513
  break;
46514
+ case "_in":
46515
+ if (!some(conditionValue, (item) => isEqual$3(value, item)))
46516
+ return false;
46517
+ break;
46518
+ case "_nin":
46519
+ if (some(conditionValue, (item) => isEqual$3(value, item)))
46520
+ return false;
46521
+ break;
46522
+ case "_regex": {
46523
+ try {
46524
+ if (!isString$1(value) || !new RegExp(conditionValue).test(value))
46525
+ return false;
46526
+ } catch (e2) {
46527
+ return false;
46528
+ }
46529
+ break;
46530
+ }
46514
46531
  default:
46515
46532
  if (operator.startsWith("_")) {
46516
46533
  console.warn(`Unsupported operator: ${operator}`);
@@ -79843,7 +79860,7 @@ ${latestSubscriptionCallbackError.current.stack}
79843
79860
  filterValToUse = false;
79844
79861
  } else if (ccSelectedFilter2 === "inList" || ccSelectedFilter2 === "notInList") {
79845
79862
  if (dataType === "number") {
79846
- filterValToUse = filterValue && filterValue.map((val2) => parseFloat(val2.replaceAll(",", "")));
79863
+ filterValToUse = filterValue && filterValue.map((val2) => parseFloat(`${val2}`.replaceAll(",", "")));
79847
79864
  }
79848
79865
  }
79849
79866
  if (isInvalidFilterValue(filterValToUse)) {
@@ -79949,7 +79966,7 @@ ${latestSubscriptionCallbackError.current.stack}
79949
79966
  multi: true,
79950
79967
  creatable: true,
79951
79968
  value: (filterValue || []).map((val2) => ({
79952
- label: val2,
79969
+ label: `${val2}`,
79953
79970
  value: val2
79954
79971
  })),
79955
79972
  onChange: /* @__PURE__ */ __name((selectedOptions) => {
@@ -145289,7 +145306,7 @@ Part of ${annotation.translationType} Translation from BPs ${annotation.start +
145289
145306
  input.click();
145290
145307
  }
145291
145308
  __name(showFileDialog, "showFileDialog");
145292
- const version = "0.8.36";
145309
+ const version = "0.8.37";
145293
145310
  const packageJson = {
145294
145311
  version
145295
145312
  };
@@ -154188,14 +154205,13 @@ Part of ${annotation.translationType} Translation from BPs ${annotation.start +
154188
154205
  };
154189
154206
  __name(_ComponentToPrint, "ComponentToPrint");
154190
154207
  let ComponentToPrint = _ComponentToPrint;
154191
- const sizeSchema = /* @__PURE__ */ __name((isProtein2) => ({
154208
+ const sizeSchema = /* @__PURE__ */ __name(() => ({
154192
154209
  path: "size",
154193
154210
  type: "number",
154194
- render: /* @__PURE__ */ __name((val2, _record) => {
154195
- const record = isProtein2 ? convertDnaCaretPositionOrRangeToAA(_record) : _record;
154211
+ render: /* @__PURE__ */ __name((val2, record) => {
154196
154212
  const base1Range = convertRangeTo1Based(record);
154197
154213
  const hasJoinedLocations = record.locations && record.locations.length > 1;
154198
- return /* @__PURE__ */ React.createElement("span", null, isProtein2 ? Math.floor(val2 / 3) : val2, " ", /* @__PURE__ */ React.createElement("span", { style: { fontSize: 10 } }, hasJoinedLocations ? record.locations.map((loc, i2) => {
154214
+ return /* @__PURE__ */ React.createElement("span", null, val2, " ", /* @__PURE__ */ React.createElement("span", { style: { fontSize: 10 } }, hasJoinedLocations ? record.locations.map((loc, i2) => {
154199
154215
  const base1Range2 = convertRangeTo1Based(loc);
154200
154216
  return /* @__PURE__ */ React.createElement("span", { key: i2 }, "(", base1Range2.start, "-", base1Range2.end, ")");
154201
154217
  }) : /* @__PURE__ */ React.createElement("span", null, "(", base1Range.start, "-", base1Range.end, ")")));
@@ -154205,11 +154221,7 @@ Part of ${annotation.translationType} Translation from BPs ${annotation.start +
154205
154221
  let lastDeps;
154206
154222
  let lastResult;
154207
154223
  return (editorState) => {
154208
- const {
154209
- sequenceData: sequenceData2,
154210
- minimumOrfSize: minimumOrfSize2,
154211
- useAdditionalOrfStartCodons: useAdditionalOrfStartCodons2
154212
- } = editorState;
154224
+ const { sequenceData: sequenceData2, minimumOrfSize: minimumOrfSize2, useAdditionalOrfStartCodons: useAdditionalOrfStartCodons2 } = editorState;
154213
154225
  const { sequence: sequence2, circular: circular2 } = sequenceData2;
154214
154226
  const deps = {
154215
154227
  sequence: sequence2,
@@ -160226,6 +160238,7 @@ Part of ${annotation.translationType} Translation from BPs ${annotation.start +
160226
160238
  const ignoreName = useFormValue(dialogFormName, "ignoreName");
160227
160239
  const ignoreStartAndEnd = useFormValue(dialogFormName, "ignoreStartAndEnd");
160228
160240
  const ignoreStrand = useFormValue(dialogFormName, "ignoreStrand");
160241
+ const isProteinSeq = isProtein2 || sequenceData2.isProtein;
160229
160242
  const recomputeDups = reactExports.useCallback(
160230
160243
  (values2) => {
160231
160244
  const ignoreName2 = values2 == null ? void 0 : values2.ignoreName;
@@ -160234,17 +160247,20 @@ Part of ${annotation.translationType} Translation from BPs ${annotation.start +
160234
160247
  const annotations = sequenceData2[type2];
160235
160248
  const newDups = [];
160236
160249
  const seqsHashByStartEndStrandName = {};
160237
- forEach$1(annotations, (a2) => {
160238
- const hash2 = `${ignoreStartAndEnd2 ? "" : a2.start}&${ignoreStartAndEnd2 ? "" : a2.end}&${ignoreStrand2 ? "" : a2.strand}&${ignoreName2 ? "" : a2.name}`;
160250
+ forEach$1(annotations, (_annotation) => {
160251
+ const annotation = isProteinSeq ? convertDnaCaretPositionOrRangeToAA(_annotation) : _annotation;
160252
+ const hash2 = `${ignoreStartAndEnd2 ? "" : annotation.start}&${ignoreStartAndEnd2 ? "" : annotation.end}&${ignoreStrand2 ? "" : annotation.strand}&${ignoreName2 ? "" : annotation.name}`;
160239
160253
  if (seqsHashByStartEndStrandName[hash2]) {
160240
- newDups.push(__spreadProps(__spreadValues({}, a2), { size: getRangeLength(a2, sequenceLength) }));
160254
+ newDups.push(__spreadProps(__spreadValues({}, annotation), {
160255
+ size: getRangeLength(annotation, sequenceLength)
160256
+ }));
160241
160257
  } else {
160242
160258
  seqsHashByStartEndStrandName[hash2] = true;
160243
160259
  }
160244
160260
  });
160245
160261
  return newDups;
160246
160262
  },
160247
- [sequenceData2, sequenceLength, type2]
160263
+ [sequenceData2, sequenceLength, type2, isProteinSeq]
160248
160264
  );
160249
160265
  const [dups, setDups] = reactExports.useState(recomputeDups);
160250
160266
  const selectedIds = reactExports.useMemo(() => dups.map((d2) => d2.id), [dups]);
@@ -160266,11 +160282,11 @@ Part of ${annotation.translationType} Translation from BPs ${annotation.start +
160266
160282
  fields: [
160267
160283
  { path: "name", type: "string" },
160268
160284
  // ...(noType ? [] : [{ path: "type", type: "string" }]),
160269
- sizeSchema(isProtein2),
160285
+ sizeSchema(),
160270
160286
  { path: "strand", type: "string" }
160271
160287
  ]
160272
160288
  }),
160273
- [isProtein2]
160289
+ []
160274
160290
  );
160275
160291
  return /* @__PURE__ */ React.createElement("div", { className: classNames$1(DIALOG_BODY, "tg-min-width-dialog") }, /* @__PURE__ */ React.createElement(
160276
160292
  WrappedDT,
@@ -170731,14 +170747,15 @@ ${seqDataToCopy}\r
170731
170747
  const annotationPropertiesSelectedEntities = _annotationPropertiesSelectedEntities.filter((a2) => annotations[a2.id]);
170732
170748
  const deleteAnnotation = props[`delete${annotationTypeUpper}`];
170733
170749
  const annotationsToUse = React.useMemo(
170734
- () => map$3(annotations, (annotation) => {
170750
+ () => map$3(annotations, (_annotation) => {
170751
+ const annotation = isProtein2 ? convertDnaCaretPositionOrRangeToAA(_annotation) : _annotation;
170735
170752
  return __spreadProps(__spreadValues(__spreadValues({}, annotation), annotation.strand === void 0 && {
170736
170753
  strand: annotation.forward ? 1 : -1
170737
170754
  }), {
170738
170755
  size: getRangeLength(annotation, sequenceLength)
170739
170756
  });
170740
170757
  }),
170741
- [annotations, sequenceLength]
170758
+ [annotations, sequenceLength, isProtein2]
170742
170759
  );
170743
170760
  const keyedPartTags = (_a2 = getKeyedTagsAndTagOptions(allPartTags)) != null ? _a2 : {};
170744
170761
  const additionalColumns = ((_c2 = (_b2 = PropertiesProps == null ? void 0 : PropertiesProps.propertiesList) == null ? void 0 : _b2.find(
@@ -170808,7 +170825,7 @@ ${seqDataToCopy}\r
170808
170825
  }, "render")
170809
170826
  }
170810
170827
  ],
170811
- sizeSchema(isProtein2),
170828
+ sizeSchema(),
170812
170829
  ...withTags && allPartTags ? [
170813
170830
  {
170814
170831
  path: "tags",
@@ -171302,7 +171319,7 @@ ${seqDataToCopy}\r
171302
171319
  displayName: "Size (aa)",
171303
171320
  type: "number"
171304
171321
  },
171305
- sizeSchema(this.props.isProtein),
171322
+ sizeSchema(),
171306
171323
  { path: "frame", type: "number" },
171307
171324
  { path: "strand", type: "number" }
171308
171325
  ]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teselagen/ove",
3
- "version": "0.8.36",
3
+ "version": "0.8.37",
4
4
  "main": "./src/index.js",
5
5
  "type": "module",
6
6
  "repository": "https://github.com/TeselaGen/tg-oss",
@@ -20,7 +20,7 @@
20
20
  "@teselagen/range-utils": "0.3.20",
21
21
  "@teselagen/react-list": "0.8.18",
22
22
  "@teselagen/sequence-utils": "0.3.42",
23
- "@teselagen/ui": "0.10.19",
23
+ "@teselagen/ui": "0.10.20",
24
24
  "@use-gesture/react": "10.3.0",
25
25
  "classnames": "^2.3.2",
26
26
  "clipboard": "^2.0.11",
@@ -11,6 +11,7 @@ import {
11
11
  removeDuplicatesIcon,
12
12
  useMemoDeepEqual
13
13
  } from "@teselagen/ui";
14
+ import { convertDnaCaretPositionOrRangeToAA } from "@teselagen/sequence-utils";
14
15
  import { map, upperFirst, pick, startCase, isFunction } from "lodash-es";
15
16
  import {
16
17
  AnchorButton,
@@ -86,7 +87,10 @@ const genericAnnotationProperties = ({
86
87
 
87
88
  const annotationsToUse = React.useMemo(
88
89
  () =>
89
- map(annotations, annotation => {
90
+ map(annotations, _annotation => {
91
+ const annotation = isProtein
92
+ ? convertDnaCaretPositionOrRangeToAA(_annotation)
93
+ : _annotation;
90
94
  return {
91
95
  ...annotation,
92
96
  ...(annotation.strand === undefined && {
@@ -95,7 +99,7 @@ const genericAnnotationProperties = ({
95
99
  size: getRangeLength(annotation, sequenceLength)
96
100
  };
97
101
  }),
98
- [annotations, sequenceLength]
102
+ [annotations, sequenceLength, isProtein]
99
103
  );
100
104
 
101
105
  const keyedPartTags = getKeyedTagsAndTagOptions(allPartTags) ?? {};
@@ -180,7 +184,7 @@ const genericAnnotationProperties = ({
180
184
  }
181
185
  }
182
186
  ]),
183
- sizeSchema(isProtein),
187
+ sizeSchema(),
184
188
  ...(withTags && allPartTags
185
189
  ? [
186
190
  {
@@ -79,7 +79,7 @@ class OrfProperties extends React.Component {
79
79
  displayName: "Size (aa)",
80
80
  type: "number"
81
81
  },
82
- sizeSchema(this.props.isProtein),
82
+ sizeSchema(),
83
83
  { path: "frame", type: "number" },
84
84
  { path: "strand", type: "number" }
85
85
  ]
@@ -1,22 +1,18 @@
1
1
  import React from "react";
2
2
  import { isEqual } from "lodash-es";
3
- import { convertDnaCaretPositionOrRangeToAA } from "@teselagen/sequence-utils";
4
3
  import { convertRangeTo1Based } from "@teselagen/range-utils";
5
4
  import selectors from "../../selectors";
6
5
 
7
- export const sizeSchema = isProtein => ({
6
+ export const sizeSchema = () => ({
8
7
  path: "size",
9
8
  type: "number",
10
- render: (val, _record) => {
11
- const record = isProtein
12
- ? convertDnaCaretPositionOrRangeToAA(_record)
13
- : _record;
9
+ render: (val, record) => {
14
10
  const base1Range = convertRangeTo1Based(record);
15
11
  const hasJoinedLocations = record.locations && record.locations.length > 1;
16
12
 
17
13
  return (
18
14
  <span>
19
- {isProtein ? Math.floor(val / 3) : val}{" "}
15
+ {val}{" "}
20
16
  <span style={{ fontSize: 10 }}>
21
17
  {hasJoinedLocations ? (
22
18
  record.locations.map((loc, i) => {
@@ -41,12 +37,9 @@ export const sizeSchema = isProtein => ({
41
37
  export const getMemoOrfs = (() => {
42
38
  let lastDeps;
43
39
  let lastResult;
44
- return (editorState) => {
45
- const {
46
- sequenceData,
47
- minimumOrfSize,
48
- useAdditionalOrfStartCodons
49
- } = editorState;
40
+ return editorState => {
41
+ const { sequenceData, minimumOrfSize, useAdditionalOrfStartCodons } =
42
+ editorState;
50
43
 
51
44
  const { sequence, circular } = sequenceData;
52
45
 
@@ -14,6 +14,7 @@ import { forEach, camelCase, startCase } from "lodash-es";
14
14
  import { sizeSchema } from "../PropertiesDialog/utils";
15
15
  import { getRangeLength } from "@teselagen/range-utils";
16
16
  import { useFormValue } from "../../utils/useFormValue";
17
+ import { convertDnaCaretPositionOrRangeToAA } from "@teselagen/sequence-utils";
17
18
 
18
19
  const dialogFormName = "RemoveDuplicatesDialog";
19
20
  const dataTableFormName = "duplicatesToRemove";
@@ -33,6 +34,7 @@ const RemoveDuplicatesDialog = props => {
33
34
  const ignoreName = useFormValue(dialogFormName, "ignoreName");
34
35
  const ignoreStartAndEnd = useFormValue(dialogFormName, "ignoreStartAndEnd");
35
36
  const ignoreStrand = useFormValue(dialogFormName, "ignoreStrand");
37
+ const isProteinSeq = isProtein || sequenceData.isProtein;
36
38
 
37
39
  const recomputeDups = useCallback(
38
40
  values => {
@@ -42,19 +44,25 @@ const RemoveDuplicatesDialog = props => {
42
44
  const annotations = sequenceData[type];
43
45
  const newDups = [];
44
46
  const seqsHashByStartEndStrandName = {};
45
- forEach(annotations, a => {
46
- const hash = `${ignoreStartAndEnd ? "" : a.start}&${
47
- ignoreStartAndEnd ? "" : a.end
48
- }&${ignoreStrand ? "" : a.strand}&${ignoreName ? "" : a.name}`;
47
+ forEach(annotations, _annotation => {
48
+ const annotation = isProteinSeq
49
+ ? convertDnaCaretPositionOrRangeToAA(_annotation)
50
+ : _annotation;
51
+ const hash = `${ignoreStartAndEnd ? "" : annotation.start}&${
52
+ ignoreStartAndEnd ? "" : annotation.end
53
+ }&${ignoreStrand ? "" : annotation.strand}&${ignoreName ? "" : annotation.name}`;
49
54
  if (seqsHashByStartEndStrandName[hash]) {
50
- newDups.push({ ...a, size: getRangeLength(a, sequenceLength) });
55
+ newDups.push({
56
+ ...annotation,
57
+ size: getRangeLength(annotation, sequenceLength)
58
+ });
51
59
  } else {
52
60
  seqsHashByStartEndStrandName[hash] = true;
53
61
  }
54
62
  });
55
63
  return newDups;
56
64
  },
57
- [sequenceData, sequenceLength, type]
65
+ [sequenceData, sequenceLength, type, isProteinSeq]
58
66
  );
59
67
 
60
68
  const [dups, setDups] = useState(recomputeDups);
@@ -79,11 +87,11 @@ const RemoveDuplicatesDialog = props => {
79
87
  fields: [
80
88
  { path: "name", type: "string" },
81
89
  // ...(noType ? [] : [{ path: "type", type: "string" }]),
82
- sizeSchema(isProtein),
90
+ sizeSchema(),
83
91
  { path: "strand", type: "string" }
84
92
  ]
85
93
  }),
86
- [isProtein]
94
+ []
87
95
  );
88
96
 
89
97
  return (