@teselagen/ove 0.5.31-beta.2 → 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.
- package/helperComponents/PropertiesDialog/utils.d.ts +5 -5
- package/index.cjs.js +168 -157
- package/index.es.js +168 -157
- package/index.umd.js +188 -168
- package/package.json +2 -2
- package/src/helperComponents/PropertiesDialog/GenericAnnotationProperties.js +52 -50
- package/src/helperComponents/PropertiesDialog/OrfProperties.js +1 -1
- package/src/helperComponents/PropertiesDialog/utils.js +5 -5
- package/src/helperComponents/RemoveDuplicates/index.js +24 -24
|
@@ -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
|
|
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
|
|
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:
|
|
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:
|
|
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}
|
|
@@ -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
|
|
9
|
-
const record =
|
|
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
|
-
{
|
|
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 (
|