@teselagen/ove 0.3.13 → 0.3.14

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.
@@ -39,7 +39,7 @@ import { store, view } from "@risingstack/react-easy-state";
39
39
 
40
40
  import withEditorProps from "../../withEditorProps";
41
41
  import { withProps } from "recompose";
42
- import { map, flatMap } from "lodash";
42
+ import { map, flatMap, round } from "lodash";
43
43
  import "./style.css";
44
44
 
45
45
  class AddOrEditAnnotationDialog extends React.Component {
@@ -58,30 +58,30 @@ class AddOrEditAnnotationDialog extends React.Component {
58
58
  formatStart = val => {
59
59
  const { isProtein } = this.props.sequenceData || {};
60
60
  if (isProtein) {
61
- return (val + 2) / 3;
61
+ return round((val + 2) / 3);
62
62
  }
63
- return val;
63
+ return round(val);
64
64
  };
65
65
  formatEnd = val => {
66
66
  const { isProtein } = this.props.sequenceData || {};
67
67
  if (isProtein) {
68
- return val / 3;
68
+ return round(val / 3);
69
69
  }
70
- return val;
70
+ return round(val);
71
71
  };
72
72
  parseStart = val => {
73
73
  const { isProtein } = this.props.sequenceData || {};
74
74
  if (isProtein) {
75
- return val * 3 - 2;
75
+ return round(val * 3 - 2);
76
76
  }
77
- return val;
77
+ return round(val);
78
78
  };
79
79
  parseEnd = val => {
80
80
  const { isProtein } = this.props.sequenceData || {};
81
81
  if (isProtein) {
82
- return val * 3;
82
+ return round(val * 3);
83
83
  }
84
- return val;
84
+ return round(val);
85
85
  };
86
86
  renderLocations = props => {
87
87
  const { fields } = props;
@@ -105,7 +105,6 @@ class GeneralProperties extends React.Component {
105
105
  className={"veReadOnlySelect"}
106
106
  disabled={!onSave || disableSetReadOnly}
107
107
  onChange={val =>
108
- console.log(`val:`, val) ||
109
108
  handleReadOnlyChange(val === "readOnly", this.props)
110
109
  }
111
110
  value={readOnly ? "readOnly" : "editable"}
@@ -571,6 +571,7 @@ function mapStateToProps(state, ownProps) {
571
571
  if (!editorState) {
572
572
  return editorReducer({}, {});
573
573
  }
574
+ const sequenceLength = s.sequenceLengthSelector(editorState);
574
575
 
575
576
  const { findTool, annotationsToSupport = {} } = editorState;
576
577
  const visibilities = getVisibilities(editorState);
@@ -582,7 +583,13 @@ function mapStateToProps(state, ownProps) {
582
583
  ].forEach(([n, type, annotationTypePlural]) => {
583
584
  const vals = getFormValues(n)(state);
584
585
  if (vals) {
585
- annotationToAdd = getAnnToAdd(vals, n, type, annotationTypePlural);
586
+ annotationToAdd = getAnnToAdd(
587
+ vals,
588
+ n,
589
+ type,
590
+ annotationTypePlural,
591
+ sequenceLength
592
+ );
586
593
  }
587
594
  });
588
595
 
@@ -613,7 +620,6 @@ function mapStateToProps(state, ownProps) {
613
620
  editorState,
614
621
  ownProps.additionalEnzymes
615
622
  );
616
- const sequenceLength = s.sequenceLengthSelector(editorState);
617
623
 
618
624
  const { matchedSearchLayer, searchLayers, matchesTotal } =
619
625
  getSearchLayersAndMatch(editorState);
@@ -955,22 +961,28 @@ const getFindTool = createSelector(
955
961
  }
956
962
  );
957
963
 
958
- const getAnnToAdd = defaultMemoize((vals, n, type, annotationTypePlural) => {
959
- const annToAdd = {
960
- color: getFeatureToColorMap({ includeHidden: true })[
961
- vals.type || "primer_bind"
962
- ], //we won't have the correct color yet so we set it here
963
- ...vals,
964
- formName: n,
965
- type,
966
- annotationTypePlural,
967
- name: vals.name || "Untitled"
968
- };
969
- if (!vals.useLinkedOligo) {
970
- delete annToAdd.bases;
964
+ const getAnnToAdd = defaultMemoize(
965
+ (vals, n, type, annotationTypePlural, sequenceLength) => {
966
+ const annToAdd = normalizeRange(
967
+ {
968
+ color: getFeatureToColorMap({ includeHidden: true })[
969
+ vals.type || "primer_bind"
970
+ ], //we won't have the correct color yet so we set it here
971
+ ...vals,
972
+ formName: n,
973
+ type,
974
+ annotationTypePlural,
975
+ name: vals.name || "Untitled"
976
+ },
977
+ sequenceLength
978
+ );
979
+
980
+ if (!vals.useLinkedOligo) {
981
+ delete annToAdd.bases;
982
+ }
983
+ return annToAdd;
971
984
  }
972
- return annToAdd;
973
- });
985
+ );
974
986
  const getSeqDataWithAnnToAdd = defaultMemoize(
975
987
  (seqData, ann, allowMultipleFeatureDirections) => {
976
988
  if (ann) {