@teselagen/ove 0.5.31-beta.1 → 0.5.31-beta.3

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.
@@ -429,7 +429,7 @@ class AddOrEditAnnotationDialog extends React.Component {
429
429
  <RenderBases
430
430
  {...{
431
431
  // ...this.props,
432
- // bases,
432
+ bases,
433
433
  defaultLinkedOligoMessage,
434
434
  getLinkedOligoLink,
435
435
  readOnly: this.props.readOnly,
@@ -25,7 +25,6 @@ import { Menu, MenuItem } from "@blueprintjs/core";
25
25
  import MeltingTemp from "../../StatusBar/MeltingTemp";
26
26
  import { getStructuredBases } from "../../RowItem/StackedAnnotations/getStructuredBases";
27
27
 
28
- // TODO: Default value here is not working
29
28
  const CustomContentEditable = generateField(function CustomContentEditable({
30
29
  input,
31
30
  disabled,
@@ -34,9 +33,9 @@ const CustomContentEditable = generateField(function CustomContentEditable({
34
33
  start,
35
34
  end,
36
35
  primerBindsOn,
37
- bases,
38
36
  forward
39
37
  }) {
38
+ const bases = input.value;
40
39
  const [hasTempError, setTempError] = useState(false);
41
40
  const inputRef = useRef(null);
42
41
  const [caretPosition, setCaretPosition] = useState({ start: 0, end: 0 });
@@ -171,7 +170,6 @@ const RenderBases = props => {
171
170
  normalizedSelection,
172
171
  sequenceData.sequence
173
172
  );
174
- console.log("bps", bps);
175
173
  if (!forward) {
176
174
  bps = getReverseComplementSequenceString(bps);
177
175
  }
@@ -372,7 +372,6 @@ class EnzymesDialog extends React.Component {
372
372
  <h5>Edit group name</h5>
373
373
  <div style={{ display: "flex" }}>
374
374
  <InputGroup
375
- // TODO: Table is failing here so no way to test it
376
375
  defaultValue={selectedEnzymeGroup}
377
376
  autoFocus
378
377
  className="veEditEnzymeGroupName"
@@ -44,15 +44,58 @@ const genericAnnotationProperties = ({
44
44
  constructor(props) {
45
45
  super(props);
46
46
  this.commands = commands(this);
47
+ }
48
+ onRowSelect = ([record]) => {
49
+ if (!record) return;
50
+ const { dispatch, editorName } = this.props;
51
+ dispatch({
52
+ type: "SELECTION_LAYER_UPDATE",
53
+ payload: record,
54
+ meta: {
55
+ editorName
56
+ }
57
+ });
58
+ };
59
+ render() {
60
+ const {
61
+ readOnly,
62
+ annotations = {},
63
+ annotationVisibility,
64
+ sequenceLength,
65
+ selectionLayer,
66
+ sequence,
67
+ isProtein,
68
+ allPartTags,
69
+ annotationPropertiesSelectedEntities:
70
+ _annotationPropertiesSelectedEntities,
71
+ selectedAnnotationId
72
+ } = this.props;
73
+ const annotationPropertiesSelectedEntities =
74
+ _annotationPropertiesSelectedEntities.filter(a => annotations[a.id]);
75
+
76
+ const deleteAnnotation = this.props[`delete${annotationTypeUpper}`];
77
+
78
+ const annotationsToUse = map(annotations, annotation => {
79
+ return {
80
+ ...annotation,
81
+ ...(annotation.strand === undefined && {
82
+ strand: annotation.forward ? 1 : -1
83
+ }),
84
+ size: getRangeLength(annotation, sequenceLength)
85
+ };
86
+ });
87
+
88
+ const keyedPartTags = getKeyedTagsAndTagOptions(allPartTags) ?? {};
89
+
47
90
  this.schema = {
48
91
  fields: [
49
92
  {
50
93
  path: "name",
51
94
  type: "string",
52
95
 
53
- render: (name, ann, row, props) => {
96
+ render: (name, ann) => {
54
97
  const checked =
55
- !props.annotationVisibility[
98
+ !this.props.annotationVisibility[
56
99
  `${annotationType}IndividualToHide`
57
100
  ][ann.id];
58
101
 
@@ -64,9 +107,9 @@ const genericAnnotationProperties = ({
64
107
  e.stopPropagation();
65
108
  const upperType = startCase(annotationType);
66
109
  if (checked) {
67
- props[`hide${upperType}Individual`]([ann.id]);
110
+ this.props[`hide${upperType}Individual`]([ann.id]);
68
111
  } else {
69
- props[`show${upperType}Individual`]([ann.id]);
112
+ this.props[`show${upperType}Individual`]([ann.id]);
70
113
  }
71
114
  }}
72
115
  style={{
@@ -89,10 +132,10 @@ const genericAnnotationProperties = ({
89
132
  {
90
133
  path: "bases",
91
134
  type: "string",
92
- render: (bases, primer, row, props) => {
135
+ render: (bases, primer) => {
93
136
  let bps = bases;
94
137
  if (!bases) {
95
- bps = getSequenceWithinRange(primer, props.sequence);
138
+ bps = getSequenceWithinRange(primer, this.props.sequence);
96
139
  if (!primer.forward) {
97
140
  bps = getReverseComplementSequenceString(bps);
98
141
  }
@@ -121,13 +164,13 @@ const genericAnnotationProperties = ({
121
164
  }
122
165
  }
123
166
  ]),
124
- sizeSchema,
167
+ sizeSchema(this.props.isProtein),
125
168
  ...(withTags && this.props.allPartTags
126
169
  ? [
127
170
  {
128
171
  path: "tags",
129
172
  type: "string",
130
- getValueToFilterOn: (o, { keyedPartTags }) => {
173
+ getValueToFilterOn: o => {
131
174
  const toRet = (o.tags || [])
132
175
  .map(tagId => {
133
176
  const tag = keyedPartTags[tagId];
@@ -137,7 +180,7 @@ const genericAnnotationProperties = ({
137
180
  .join(" ");
138
181
  return toRet;
139
182
  },
140
- render: (tags, b, c, { keyedPartTags = {} }) => {
183
+ render: tags => {
141
184
  return (
142
185
  <div style={{ display: "flex" }}>
143
186
  {(tags || []).map((tagId, i) => {
@@ -154,46 +197,6 @@ const genericAnnotationProperties = ({
154
197
  { path: "strand", type: "number" }
155
198
  ]
156
199
  };
157
- }
158
- onRowSelect = ([record]) => {
159
- if (!record) return;
160
- const { dispatch, editorName } = this.props;
161
- dispatch({
162
- type: "SELECTION_LAYER_UPDATE",
163
- payload: record,
164
- meta: {
165
- editorName
166
- }
167
- });
168
- };
169
- render() {
170
- const {
171
- readOnly,
172
- annotations = {},
173
- annotationVisibility,
174
- sequenceLength,
175
- selectionLayer,
176
- sequence,
177
- isProtein,
178
- allPartTags,
179
- annotationPropertiesSelectedEntities:
180
- _annotationPropertiesSelectedEntities,
181
- selectedAnnotationId
182
- } = this.props;
183
- const annotationPropertiesSelectedEntities =
184
- _annotationPropertiesSelectedEntities.filter(a => annotations[a.id]);
185
-
186
- const deleteAnnotation = this.props[`delete${annotationTypeUpper}`];
187
-
188
- const annotationsToUse = map(annotations, annotation => {
189
- return {
190
- ...annotation,
191
- ...(annotation.strand === undefined && {
192
- strand: annotation.forward ? 1 : -1
193
- }),
194
- size: getRangeLength(annotation, sequenceLength)
195
- };
196
- });
197
200
 
198
201
  return (
199
202
  <DataTable
@@ -337,7 +340,6 @@ const genericAnnotationProperties = ({
337
340
  formName="annotationProperties"
338
341
  noRouter
339
342
  isProtein={isProtein}
340
- keyedPartTags={getKeyedTagsAndTagOptions(allPartTags)}
341
343
  compact
342
344
  isInfinite
343
345
  schema={this.schema}
@@ -80,7 +80,7 @@ class OrfProperties extends React.Component {
80
80
  displayName: "Size (aa)",
81
81
  type: "number"
82
82
  },
83
- sizeSchema,
83
+ sizeSchema(this.props.isProtein),
84
84
  { path: "frame", type: "number" },
85
85
  { path: "strand", type: "number" }
86
86
  ]
@@ -2,11 +2,11 @@ import React from "react";
2
2
  import { convertDnaCaretPositionOrRangeToAA } from "@teselagen/sequence-utils";
3
3
  import { convertRangeTo1Based } from "@teselagen/range-utils";
4
4
 
5
- export const sizeSchema = {
5
+ export const sizeSchema = isProtein => ({
6
6
  path: "size",
7
7
  type: "number",
8
- render: (val, _record, i, props) => {
9
- const record = props.isProtein
8
+ render: (val, _record) => {
9
+ const record = isProtein
10
10
  ? convertDnaCaretPositionOrRangeToAA(_record)
11
11
  : _record;
12
12
  const base1Range = convertRangeTo1Based(record);
@@ -14,7 +14,7 @@ export const sizeSchema = {
14
14
 
15
15
  return (
16
16
  <span>
17
- {props.isProtein ? Math.floor(val / 3) : val}{" "}
17
+ {isProtein ? Math.floor(val / 3) : val}{" "}
18
18
  <span style={{ fontSize: 10 }}>
19
19
  {hasJoinedLocations ? (
20
20
  record.locations.map((loc, i) => {
@@ -34,4 +34,4 @@ export const sizeSchema = {
34
34
  </span>
35
35
  );
36
36
  }
37
- };
37
+ });
@@ -17,30 +17,6 @@ import { forEach, camelCase, startCase } from "lodash-es";
17
17
  import { sizeSchema } from "../PropertiesDialog/utils";
18
18
  import { getRangeLength } from "@teselagen/range-utils";
19
19
 
20
- const schema = {
21
- fields: [
22
- // ...(noColor
23
- // ? []
24
- // : [
25
- // {
26
- // path: "color",
27
- // type: "string",
28
- // render: color => {
29
- // return (
30
- // <ColorPickerPopover>
31
- // <div style={{ height: 20, width: 20, background: color }} />
32
- // </ColorPickerPopover>
33
- // );
34
- // }
35
- // }
36
- // ]),
37
- { path: "name", type: "string" },
38
- // ...(noType ? [] : [{ path: "type", type: "string" }]),
39
- sizeSchema,
40
- { path: "strand", type: "string" }
41
- ]
42
- };
43
-
44
20
  class RemoveDuplicatesDialog extends React.Component {
45
21
  state = {
46
22
  dups: []
@@ -89,6 +65,30 @@ class RemoveDuplicatesDialog extends React.Component {
89
65
  const { duplicatesToRemoveSelectedEntities, hideModal, type } = this.props;
90
66
 
91
67
  const selectedIds = this.state.dups.map(d => d.id);
68
+
69
+ const schema = {
70
+ fields: [
71
+ // ...(noColor
72
+ // ? []
73
+ // : [
74
+ // {
75
+ // path: "color",
76
+ // type: "string",
77
+ // render: color => {
78
+ // return (
79
+ // <ColorPickerPopover>
80
+ // <div style={{ height: 20, width: 20, background: color }} />
81
+ // </ColorPickerPopover>
82
+ // );
83
+ // }
84
+ // }
85
+ // ]),
86
+ { path: "name", type: "string" },
87
+ // ...(noType ? [] : [{ path: "type", type: "string" }]),
88
+ sizeSchema(this.props.isProtein),
89
+ { path: "strand", type: "string" }
90
+ ]
91
+ };
92
92
  // const sequenceLength = sequenceData.sequence.length;
93
93
  // const isCirc = (this.state || {}).circular;
94
94
  return (