ove-auto-annotate 0.0.4 → 0.0.8

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
@@ -1,3 +1,8 @@
1
+ # UI:
2
+ ![image](https://user-images.githubusercontent.com/2730609/125001643-013bf980-e008-11eb-9385-b834b8e9573f.png)
3
+
4
+ ![image](https://user-images.githubusercontent.com/2730609/125001747-38120f80-e008-11eb-9981-292cebba847d.png)
5
+
1
6
  # Usage:
2
7
 
3
8
  ```js
@@ -43,6 +48,9 @@ window.createVectorEditor(yourDomNodeHere, {
43
48
 
44
49
  # Passing a custom list of existing annotations to choose from:
45
50
 
51
+ ![image](https://user-images.githubusercontent.com/2730609/125001693-14e76000-e008-11eb-903b-e7f074a7747c.png)
52
+
53
+
46
54
  ```js
47
55
  async function getCustomAutoAnnotateList ({ annotationType, sequenceData }) { //annotationType = feature|part|oligo
48
56
  const dataToReturn = await fetch("/my/endpoint/here", { ...someParams }); //hit your endpoint here
package/es/index.js CHANGED
@@ -23,6 +23,7 @@ import { formName } from "./constants";
23
23
  import { AutoAnnotateBpMatchingDialog } from "./AutoAnnotateBpMatchingDialog";
24
24
  import { parseCsvFile, validateCSVRequiredHeaders, validateCSVRow } from "./fileUtils";
25
25
  import downloadjs from "downloadjs";
26
+ import { convertProteinSeqToDNAIupac } from "ve-sequence-utils";
26
27
  var _window$addOnGlobals = window.addOnGlobals,
27
28
  shortid = _window$addOnGlobals.shortid,
28
29
  FileUploadField = _window$addOnGlobals.FileUploadField,
@@ -32,8 +33,8 @@ var _window$addOnGlobals = window.addOnGlobals,
32
33
  pluralize = _window$addOnGlobals.pluralize,
33
34
  reduxForm = _window$addOnGlobals.reduxForm,
34
35
  SubmissionError = _window$addOnGlobals.SubmissionError,
35
- featureColors = _window$addOnGlobals.featureColors,
36
- FeatureTypes = _window$addOnGlobals.FeatureTypes,
36
+ getFeatureToColorMap = _window$addOnGlobals.getFeatureToColorMap,
37
+ getFeatureTypes = _window$addOnGlobals.getFeatureTypes,
37
38
  InfoHelper = _window$addOnGlobals.InfoHelper,
38
39
  showConfirmationDialog = _window$addOnGlobals.showConfirmationDialog,
39
40
  wrapDialog = _window$addOnGlobals.wrapDialog,
@@ -79,6 +80,7 @@ export function autoAnnotatePrimers() {
79
80
  }
80
81
  export var AutoAnnotateModal = compose(wrapDialog(function (p) {
81
82
  return {
83
+ canEscapeKeyClose: false,
82
84
  title: "Auto Annotate " + startCase(pluralize(p.annotationType))
83
85
  };
84
86
  }), withEditorProps, reduxForm({
@@ -147,8 +149,9 @@ export var AutoAnnotateModal = compose(wrapDialog(function (p) {
147
149
  }
148
150
  }
149
151
  }, _callee, null, [[2, 9, 13, 16]]);
150
- }))();
151
- }, [getCustomAutoAnnotateList, props]);
152
+ }))(); // eslint-disable-next-line react-hooks/exhaustive-deps
153
+
154
+ }, []);
152
155
 
153
156
  if (newAnnotations) {
154
157
  return /*#__PURE__*/React.createElement(CreateAnnotationsPage, _extends({}, props, {
@@ -163,24 +166,7 @@ export var AutoAnnotateModal = compose(wrapDialog(function (p) {
163
166
  onChange: setSelectedImportType,
164
167
  selectedTabId: fileType
165
168
  }, /*#__PURE__*/React.createElement(Tab, {
166
- panel: /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", null, "Select a CSV file with the following columns -", /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("div", {
167
- style: {
168
- display: "flex"
169
- }
170
- }, "name,description,sequence,type,", /*#__PURE__*/React.createElement("span", {
171
- style: {
172
- display: "flex"
173
- }
174
- }, "isRegex \xA0", /*#__PURE__*/React.createElement(InfoHelper, {
175
- onClick: function onClick(e) {
176
- e.stopPropagation();
177
- e.preventDefault();
178
- showDialog({
179
- ModalComponent: AutoAnnotateBpMatchingDialog
180
- });
181
- },
182
- content: true ? /*#__PURE__*/React.createElement("span", null, "Any valid regexes allowed. Click for more info about regex matching") : "All valid IUPAC bases allowed as well as a couple special characters. Click for more info"
183
- }))), /*#__PURE__*/React.createElement("br", null), annotationType !== "feature" && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("i", null, "Note: the \"type\" column is optional"), /*#__PURE__*/React.createElement("br", null)), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("a", {
169
+ panel: /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", null, "Select a CSV file (", /*#__PURE__*/React.createElement("a", {
184
170
  onClick: function onClick() {
185
171
  var rows = [_extends({
186
172
  name: "Example " + startCase(annotationType) + " 1",
@@ -189,7 +175,17 @@ export var AutoAnnotateModal = compose(wrapDialog(function (p) {
189
175
  }, annotationType === "feature" && {
190
176
  type: "cds"
191
177
  }, {
192
- isRegex: false
178
+ isRegex: false,
179
+ matchType: "dna"
180
+ }), _extends({
181
+ name: "Example Protein " + startCase(annotationType),
182
+ description: "I'm a description",
183
+ sequence: "APGSGTGGGSGSAPG"
184
+ }, annotationType === "feature" && {
185
+ type: "cds"
186
+ }, {
187
+ isRegex: false,
188
+ matchType: "protein"
193
189
  }), _extends({
194
190
  name: "Example " + startCase(annotationType) + " 2",
195
191
  description: "I'm another description",
@@ -197,7 +193,8 @@ export var AutoAnnotateModal = compose(wrapDialog(function (p) {
197
193
  }, annotationType === "feature" && {
198
194
  type: "cds"
199
195
  }, {
200
- isRegex: true
196
+ isRegex: true,
197
+ matchType: "dna"
201
198
  })];
202
199
  var csv = unparse(rows); // const blob = new Blob([convert(sequenceData)], { type: "text/plain" });
203
200
  // const filename = `${sequenceData.name || "Untitled_Sequence"}.${fileExt}`;
@@ -205,7 +202,25 @@ export var AutoAnnotateModal = compose(wrapDialog(function (p) {
205
202
 
206
203
  downloadjs(csv, "Example CSV Annotation Upload File.csv", "text/plain");
207
204
  }
208
- }, "download example")), /*#__PURE__*/React.createElement(FileUploadField, {
205
+ }, "download example"), ") with the following columns:", /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("div", {
206
+ style: {
207
+ display: "flex"
208
+ }
209
+ }, "name,description,sequence,type,", /*#__PURE__*/React.createElement("span", {
210
+ style: {
211
+ display: "flex"
212
+ }
213
+ }, "isRegex \xA0", /*#__PURE__*/React.createElement(InfoHelper, {
214
+ onClick: function onClick(e) {
215
+ e.stopPropagation();
216
+ e.preventDefault();
217
+ showDialog({
218
+ ModalComponent: AutoAnnotateBpMatchingDialog
219
+ });
220
+ },
221
+ content: true ? /*#__PURE__*/React.createElement("span", null, "Any valid regexes allowed. Click for more info about regex matching") : "All valid IUPAC bases allowed as well as a couple special characters. Click for more info"
222
+ })), ",matchType"), /*#__PURE__*/React.createElement("br", null), annotationType !== "feature" && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("i", null, "Note: the \"type\" column is optional"), /*#__PURE__*/React.createElement("br", null))), /*#__PURE__*/React.createElement(FileUploadField, {
223
+ validateAgainstSchema: validateAgainstSchema,
209
224
  name: "csvFile",
210
225
  fileLimit: 1,
211
226
  isRequired: true,
@@ -234,10 +249,10 @@ export var AutoAnnotateModal = compose(wrapDialog(function (p) {
234
249
  }), getCustomAutoAnnotateList && (loadingCustomAnnList ? /*#__PURE__*/React.createElement(Tab, {
235
250
  disabled: true,
236
251
  title: "Loading..."
237
- }) : customAnnResponse && /*#__PURE__*/React.createElement(Tab, {
252
+ }) : customAnnResponse && customAnnResponse.list && /*#__PURE__*/React.createElement(Tab, {
238
253
  id: "implementerDefined",
239
- title: customAnnResponse && customAnnResponse.title || "Custom List",
240
- panel: customAnnResponse && customAnnResponse.list && customAnnResponse.list.length ? /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(DataTable, {
254
+ title: customAnnResponse.title || "Custom List",
255
+ panel: customAnnResponse.list.length ? /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(DataTable, {
241
256
  isInfinite: true,
242
257
  schema: annotationType === "feature" ? customAnnsSchema : customAnnsSchemaNoType,
243
258
  entities: customAnnResponse.list
@@ -247,7 +262,7 @@ export var AutoAnnotateModal = compose(wrapDialog(function (p) {
247
262
  disabled: fileType === "implementerDefined" && !(customAnnResponse && customAnnResponse.list && customAnnResponse.list.length),
248
263
  onClick: handleSubmit( /*#__PURE__*/function () {
249
264
  var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(_ref2) {
250
- var apeFile, csvFile, convertNonStandardTypes, annsToCheck, _seqsToAnnotateById, validateRow, _iterator, _step, _step$value, i, _step$value$, name, sequence, type, isRegex, csvHeaders, _yield$parseCsvFile, data, fields, _error, _iterator2, _step2, _step2$value, index, row, _error2, _yield$parseCsvFile2, _data, _iterator3, _step3, _step3$value, _i, _step3$value$, _name, _sequence, _type, annotationsToCheckById, seqId, _autoAnnotate, newAnns, _SubmissionError;
265
+ var apeFile, csvFile, convertNonStandardTypes, annsToCheck, _seqsToAnnotateById, validateRow, _iterator, _step, _step$value, i, _step$value$, name, sequence, matchType, type, isRegex, csvHeaders, _yield$parseCsvFile, data, fields, _error, _iterator2, _step2, _step2$value, index, row, _error2, _yield$parseCsvFile2, _data, _iterator3, _step3, _step3$value, _i, _step3$value$, _name, _sequence, _type, annotationsToCheckById, seqId, _autoAnnotate, newAnns, _SubmissionError;
251
266
 
252
267
  return _regeneratorRuntime.wrap(function _callee3$(_context3) {
253
268
  while (1) {
@@ -273,7 +288,7 @@ export var AutoAnnotateModal = compose(wrapDialog(function (p) {
273
288
  break;
274
289
  }
275
290
 
276
- cleanedType = FeatureTypes.find(function (t) {
291
+ cleanedType = getFeatureTypes().find(function (t) {
277
292
  return t.toLowerCase() === type.toLowerCase();
278
293
  });
279
294
 
@@ -380,11 +395,12 @@ export var AutoAnnotateModal = compose(wrapDialog(function (p) {
380
395
  }
381
396
 
382
397
  _step$value = _step.value, // eslint-disable-next-line no-unused-vars
383
- i = _step$value[0], _step$value$ = _step$value[1], name = _step$value$.name, sequence = _step$value$.sequence, type = _step$value$.type, isRegex = _step$value$.isRegex;
398
+ i = _step$value[0], _step$value$ = _step$value[1], name = _step$value$.name, sequence = _step$value$.sequence, matchType = _step$value$.matchType, type = _step$value$.type, isRegex = _step$value$.isRegex;
384
399
  _context3.next = 11;
385
400
  return validateRow({
386
401
  name: name,
387
402
  sequence: sequence,
403
+ matchType: matchType,
388
404
  type: type,
389
405
  isRegex: isRegex ? "TRUE" : "FALSE"
390
406
  }, "Row " + (i + 1) + " (" + name + ")");
@@ -514,6 +530,10 @@ export var AutoAnnotateModal = compose(wrapDialog(function (p) {
514
530
  case 57:
515
531
  annotationsToCheckById = {};
516
532
  annsToCheck.forEach(function (ann) {
533
+ if (ann.matchType === "protein") {
534
+ ann.sequence = convertProteinSeqToDNAIupac(ann.sequence);
535
+ }
536
+
517
537
  var id = shortid();
518
538
  annotationsToCheckById[id] = _extends({}, ann, {
519
539
  sequence: ann.isRegex ? ann.sequence : convertApELikeRegexToRegex(ann.sequence),
@@ -535,7 +555,7 @@ export var AutoAnnotateModal = compose(wrapDialog(function (p) {
535
555
  id: shortid()
536
556
  });
537
557
 
538
- toRet.color = toRet.color || featureColors[toRet.type];
558
+ toRet.color = toRet.color || getFeatureToColorMap()[toRet.type];
539
559
  return toRet;
540
560
  }));
541
561
  } else {
@@ -580,4 +600,31 @@ window._ove_addons.autoAnnotateFeatures = autoAnnotateFeatures;
580
600
  window._ove_addons.autoAnnotateParts = autoAnnotateParts;
581
601
  window._ove_addons.autoAnnotatePrimers = autoAnnotatePrimers;
582
602
  var customAnnsSchema = ["name", "sequence", typeField, "isRegex"];
583
- var customAnnsSchemaNoType = ["name", "sequence", typeField, "isRegex"];
603
+ var customAnnsSchemaNoType = ["name", "sequence", typeField, "isRegex"];
604
+ var validateAgainstSchema = {
605
+ fields: [{
606
+ path: "name",
607
+ type: "string",
608
+ isRequired: true
609
+ }, {
610
+ path: "description",
611
+ type: "string"
612
+ }, {
613
+ path: "sequence",
614
+ type: "string",
615
+ isRequired: true
616
+ }, {
617
+ path: "type",
618
+ type: "dropdown",
619
+ values: getFeatureTypes(),
620
+ defaultValue: "misc_feature"
621
+ }, {
622
+ path: "isRegex",
623
+ type: "boolean"
624
+ }, {
625
+ path: "matchType",
626
+ type: "dropdown",
627
+ defaultValue: "dna",
628
+ values: ["dna", "protein"]
629
+ }]
630
+ };
package/lib/index.js CHANGED
@@ -20,6 +20,8 @@ var _fileUtils = require("./fileUtils");
20
20
 
21
21
  var _downloadjs = _interopRequireDefault(require("downloadjs"));
22
22
 
23
+ var _veSequenceUtils = require("ve-sequence-utils");
24
+
23
25
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
24
26
 
25
27
  function _createForOfIteratorHelperLoose(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (it) return (it = it.call(o)).next.bind(it); if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; return function () { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
@@ -43,8 +45,8 @@ var _window$addOnGlobals = window.addOnGlobals,
43
45
  pluralize = _window$addOnGlobals.pluralize,
44
46
  reduxForm = _window$addOnGlobals.reduxForm,
45
47
  SubmissionError = _window$addOnGlobals.SubmissionError,
46
- featureColors = _window$addOnGlobals.featureColors,
47
- FeatureTypes = _window$addOnGlobals.FeatureTypes,
48
+ getFeatureToColorMap = _window$addOnGlobals.getFeatureToColorMap,
49
+ getFeatureTypes = _window$addOnGlobals.getFeatureTypes,
48
50
  InfoHelper = _window$addOnGlobals.InfoHelper,
49
51
  showConfirmationDialog = _window$addOnGlobals.showConfirmationDialog,
50
52
  wrapDialog = _window$addOnGlobals.wrapDialog,
@@ -94,6 +96,7 @@ function autoAnnotatePrimers() {
94
96
 
95
97
  var AutoAnnotateModal = compose(wrapDialog(function (p) {
96
98
  return {
99
+ canEscapeKeyClose: false,
97
100
  title: "Auto Annotate " + startCase(pluralize(p.annotationType))
98
101
  };
99
102
  }), withEditorProps, reduxForm({
@@ -162,8 +165,9 @@ var AutoAnnotateModal = compose(wrapDialog(function (p) {
162
165
  }
163
166
  }
164
167
  }, _callee, null, [[2, 9, 13, 16]]);
165
- }))();
166
- }, [getCustomAutoAnnotateList, props]);
168
+ }))(); // eslint-disable-next-line react-hooks/exhaustive-deps
169
+
170
+ }, []);
167
171
 
168
172
  if (newAnnotations) {
169
173
  return /*#__PURE__*/React.createElement(_CreateAnnotationsPage["default"], _extends({}, props, {
@@ -178,24 +182,7 @@ var AutoAnnotateModal = compose(wrapDialog(function (p) {
178
182
  onChange: setSelectedImportType,
179
183
  selectedTabId: fileType
180
184
  }, /*#__PURE__*/React.createElement(Tab, {
181
- panel: /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", null, "Select a CSV file with the following columns -", /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("div", {
182
- style: {
183
- display: "flex"
184
- }
185
- }, "name,description,sequence,type,", /*#__PURE__*/React.createElement("span", {
186
- style: {
187
- display: "flex"
188
- }
189
- }, "isRegex \xA0", /*#__PURE__*/React.createElement(InfoHelper, {
190
- onClick: function onClick(e) {
191
- e.stopPropagation();
192
- e.preventDefault();
193
- showDialog({
194
- ModalComponent: _AutoAnnotateBpMatchingDialog.AutoAnnotateBpMatchingDialog
195
- });
196
- },
197
- content: true ? /*#__PURE__*/React.createElement("span", null, "Any valid regexes allowed. Click for more info about regex matching") : "All valid IUPAC bases allowed as well as a couple special characters. Click for more info"
198
- }))), /*#__PURE__*/React.createElement("br", null), annotationType !== "feature" && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("i", null, "Note: the \"type\" column is optional"), /*#__PURE__*/React.createElement("br", null)), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("a", {
185
+ panel: /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", null, "Select a CSV file (", /*#__PURE__*/React.createElement("a", {
199
186
  onClick: function onClick() {
200
187
  var rows = [_extends({
201
188
  name: "Example " + startCase(annotationType) + " 1",
@@ -204,7 +191,17 @@ var AutoAnnotateModal = compose(wrapDialog(function (p) {
204
191
  }, annotationType === "feature" && {
205
192
  type: "cds"
206
193
  }, {
207
- isRegex: false
194
+ isRegex: false,
195
+ matchType: "dna"
196
+ }), _extends({
197
+ name: "Example Protein " + startCase(annotationType),
198
+ description: "I'm a description",
199
+ sequence: "APGSGTGGGSGSAPG"
200
+ }, annotationType === "feature" && {
201
+ type: "cds"
202
+ }, {
203
+ isRegex: false,
204
+ matchType: "protein"
208
205
  }), _extends({
209
206
  name: "Example " + startCase(annotationType) + " 2",
210
207
  description: "I'm another description",
@@ -212,7 +209,8 @@ var AutoAnnotateModal = compose(wrapDialog(function (p) {
212
209
  }, annotationType === "feature" && {
213
210
  type: "cds"
214
211
  }, {
215
- isRegex: true
212
+ isRegex: true,
213
+ matchType: "dna"
216
214
  })];
217
215
  var csv = (0, _papaparse.unparse)(rows); // const blob = new Blob([convert(sequenceData)], { type: "text/plain" });
218
216
  // const filename = `${sequenceData.name || "Untitled_Sequence"}.${fileExt}`;
@@ -220,7 +218,25 @@ var AutoAnnotateModal = compose(wrapDialog(function (p) {
220
218
 
221
219
  (0, _downloadjs["default"])(csv, "Example CSV Annotation Upload File.csv", "text/plain");
222
220
  }
223
- }, "download example")), /*#__PURE__*/React.createElement(FileUploadField, {
221
+ }, "download example"), ") with the following columns:", /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("div", {
222
+ style: {
223
+ display: "flex"
224
+ }
225
+ }, "name,description,sequence,type,", /*#__PURE__*/React.createElement("span", {
226
+ style: {
227
+ display: "flex"
228
+ }
229
+ }, "isRegex \xA0", /*#__PURE__*/React.createElement(InfoHelper, {
230
+ onClick: function onClick(e) {
231
+ e.stopPropagation();
232
+ e.preventDefault();
233
+ showDialog({
234
+ ModalComponent: _AutoAnnotateBpMatchingDialog.AutoAnnotateBpMatchingDialog
235
+ });
236
+ },
237
+ content: true ? /*#__PURE__*/React.createElement("span", null, "Any valid regexes allowed. Click for more info about regex matching") : "All valid IUPAC bases allowed as well as a couple special characters. Click for more info"
238
+ })), ",matchType"), /*#__PURE__*/React.createElement("br", null), annotationType !== "feature" && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("i", null, "Note: the \"type\" column is optional"), /*#__PURE__*/React.createElement("br", null))), /*#__PURE__*/React.createElement(FileUploadField, {
239
+ validateAgainstSchema: validateAgainstSchema,
224
240
  name: "csvFile",
225
241
  fileLimit: 1,
226
242
  isRequired: true,
@@ -249,10 +265,10 @@ var AutoAnnotateModal = compose(wrapDialog(function (p) {
249
265
  }), getCustomAutoAnnotateList && (loadingCustomAnnList ? /*#__PURE__*/React.createElement(Tab, {
250
266
  disabled: true,
251
267
  title: "Loading..."
252
- }) : customAnnResponse && /*#__PURE__*/React.createElement(Tab, {
268
+ }) : customAnnResponse && customAnnResponse.list && /*#__PURE__*/React.createElement(Tab, {
253
269
  id: "implementerDefined",
254
- title: customAnnResponse && customAnnResponse.title || "Custom List",
255
- panel: customAnnResponse && customAnnResponse.list && customAnnResponse.list.length ? /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(DataTable, {
270
+ title: customAnnResponse.title || "Custom List",
271
+ panel: customAnnResponse.list.length ? /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(DataTable, {
256
272
  isInfinite: true,
257
273
  schema: annotationType === "feature" ? customAnnsSchema : customAnnsSchemaNoType,
258
274
  entities: customAnnResponse.list
@@ -262,7 +278,7 @@ var AutoAnnotateModal = compose(wrapDialog(function (p) {
262
278
  disabled: fileType === "implementerDefined" && !(customAnnResponse && customAnnResponse.list && customAnnResponse.list.length),
263
279
  onClick: handleSubmit( /*#__PURE__*/function () {
264
280
  var _ref3 = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee3(_ref2) {
265
- var apeFile, csvFile, convertNonStandardTypes, annsToCheck, _seqsToAnnotateById, validateRow, _iterator, _step, _step$value, i, _step$value$, name, sequence, type, isRegex, csvHeaders, _yield$parseCsvFile, data, fields, _error, _iterator2, _step2, _step2$value, index, row, _error2, _yield$parseCsvFile2, _data, _iterator3, _step3, _step3$value, _i, _step3$value$, _name, _sequence, _type, annotationsToCheckById, seqId, _autoAnnotate, newAnns, _SubmissionError;
281
+ var apeFile, csvFile, convertNonStandardTypes, annsToCheck, _seqsToAnnotateById, validateRow, _iterator, _step, _step$value, i, _step$value$, name, sequence, matchType, type, isRegex, csvHeaders, _yield$parseCsvFile, data, fields, _error, _iterator2, _step2, _step2$value, index, row, _error2, _yield$parseCsvFile2, _data, _iterator3, _step3, _step3$value, _i, _step3$value$, _name, _sequence, _type, annotationsToCheckById, seqId, _autoAnnotate, newAnns, _SubmissionError;
266
282
 
267
283
  return _regenerator["default"].wrap(function _callee3$(_context3) {
268
284
  while (1) {
@@ -288,7 +304,7 @@ var AutoAnnotateModal = compose(wrapDialog(function (p) {
288
304
  break;
289
305
  }
290
306
 
291
- cleanedType = FeatureTypes.find(function (t) {
307
+ cleanedType = getFeatureTypes().find(function (t) {
292
308
  return t.toLowerCase() === type.toLowerCase();
293
309
  });
294
310
 
@@ -395,11 +411,12 @@ var AutoAnnotateModal = compose(wrapDialog(function (p) {
395
411
  }
396
412
 
397
413
  _step$value = _step.value, // eslint-disable-next-line no-unused-vars
398
- i = _step$value[0], _step$value$ = _step$value[1], name = _step$value$.name, sequence = _step$value$.sequence, type = _step$value$.type, isRegex = _step$value$.isRegex;
414
+ i = _step$value[0], _step$value$ = _step$value[1], name = _step$value$.name, sequence = _step$value$.sequence, matchType = _step$value$.matchType, type = _step$value$.type, isRegex = _step$value$.isRegex;
399
415
  _context3.next = 11;
400
416
  return validateRow({
401
417
  name: name,
402
418
  sequence: sequence,
419
+ matchType: matchType,
403
420
  type: type,
404
421
  isRegex: isRegex ? "TRUE" : "FALSE"
405
422
  }, "Row " + (i + 1) + " (" + name + ")");
@@ -529,6 +546,10 @@ var AutoAnnotateModal = compose(wrapDialog(function (p) {
529
546
  case 57:
530
547
  annotationsToCheckById = {};
531
548
  annsToCheck.forEach(function (ann) {
549
+ if (ann.matchType === "protein") {
550
+ ann.sequence = (0, _veSequenceUtils.convertProteinSeqToDNAIupac)(ann.sequence);
551
+ }
552
+
532
553
  var id = shortid();
533
554
  annotationsToCheckById[id] = _extends({}, ann, {
534
555
  sequence: ann.isRegex ? ann.sequence : convertApELikeRegexToRegex(ann.sequence),
@@ -550,7 +571,7 @@ var AutoAnnotateModal = compose(wrapDialog(function (p) {
550
571
  id: shortid()
551
572
  });
552
573
 
553
- toRet.color = toRet.color || featureColors[toRet.type];
574
+ toRet.color = toRet.color || getFeatureToColorMap()[toRet.type];
554
575
  return toRet;
555
576
  }));
556
577
  } else {
@@ -596,4 +617,31 @@ window._ove_addons.autoAnnotateFeatures = autoAnnotateFeatures;
596
617
  window._ove_addons.autoAnnotateParts = autoAnnotateParts;
597
618
  window._ove_addons.autoAnnotatePrimers = autoAnnotatePrimers;
598
619
  var customAnnsSchema = ["name", "sequence", typeField, "isRegex"];
599
- var customAnnsSchemaNoType = ["name", "sequence", typeField, "isRegex"];
620
+ var customAnnsSchemaNoType = ["name", "sequence", typeField, "isRegex"];
621
+ var validateAgainstSchema = {
622
+ fields: [{
623
+ path: "name",
624
+ type: "string",
625
+ isRequired: true
626
+ }, {
627
+ path: "description",
628
+ type: "string"
629
+ }, {
630
+ path: "sequence",
631
+ type: "string",
632
+ isRequired: true
633
+ }, {
634
+ path: "type",
635
+ type: "dropdown",
636
+ values: getFeatureTypes(),
637
+ defaultValue: "misc_feature"
638
+ }, {
639
+ path: "isRegex",
640
+ type: "boolean"
641
+ }, {
642
+ path: "matchType",
643
+ type: "dropdown",
644
+ defaultValue: "dna",
645
+ values: ["dna", "protein"]
646
+ }]
647
+ };
package/package.json CHANGED
@@ -1,12 +1,11 @@
1
1
  {
2
2
  "name": "ove-auto-annotate",
3
- "version": "0.0.4",
3
+ "version": "0.0.8",
4
4
  "scripts": {
5
5
  "build": "nwb build-react-component --copy-files --no-demo",
6
- "prepublish": "npm run build"
6
+ "prepublishOnly": "npm run build"
7
7
  },
8
8
  "dependencies": {
9
- "downloadjs": "^1.4.7",
10
9
  "papaparse": "^5.3.1"
11
10
  },
12
11
  "devDependencies": {