@teselagen/ove 0.4.3 → 0.4.4
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/index.cjs.js +221 -196
- package/index.es.js +221 -196
- package/index.umd.js +159 -170
- package/package.json +2 -2
- package/src/MenuBar/defaultConfig.js +2 -1
- package/src/SimpleCircularOrLinearView.js +4 -3
- package/src/ToolBar/downloadTool.js +2 -1
- package/src/commands/index.js +18 -3
- package/src/withEditorProps/index.js +16 -14
package/src/commands/index.js
CHANGED
|
@@ -264,9 +264,24 @@ const fileCommandDefs = {
|
|
|
264
264
|
handler: props =>
|
|
265
265
|
props.exportSequenceToFile(isProtein(props) ? "genpept" : "genbank")
|
|
266
266
|
},
|
|
267
|
-
|
|
268
|
-
name:
|
|
269
|
-
|
|
267
|
+
exportDNASequenceAsFasta: {
|
|
268
|
+
name: props =>
|
|
269
|
+
`Download ${props.sequenceData.isProtein ? "DNA " : ""}FASTA File`,
|
|
270
|
+
isHidden: props => !props.sequenceData.sequence,
|
|
271
|
+
handler: props =>
|
|
272
|
+
props.exportSequenceToFile("fasta", {
|
|
273
|
+
sequence: props.sequenceData.sequence,
|
|
274
|
+
size: props.sequenceData.size
|
|
275
|
+
})
|
|
276
|
+
},
|
|
277
|
+
exportProteinSequenceAsFasta: {
|
|
278
|
+
name: "Download AA FASTA File",
|
|
279
|
+
isHidden: props => !props.sequenceData.proteinSequence,
|
|
280
|
+
handler: props =>
|
|
281
|
+
props.exportSequenceToFile("fasta", {
|
|
282
|
+
sequence: props.sequenceData.proteinSequence,
|
|
283
|
+
size: props.sequenceData.proteinSize
|
|
284
|
+
})
|
|
270
285
|
},
|
|
271
286
|
exportSequenceAsTeselagenJson: {
|
|
272
287
|
name: "Download Teselagen JSON File",
|
|
@@ -50,8 +50,8 @@ const getUpperOrLowerSeq = defaultMemoize(
|
|
|
50
50
|
uppercaseSequenceMapFont === "uppercase"
|
|
51
51
|
? sequence.toUpperCase()
|
|
52
52
|
: uppercaseSequenceMapFont === "lowercase"
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
? sequence.toLowerCase()
|
|
54
|
+
: sequence
|
|
55
55
|
);
|
|
56
56
|
|
|
57
57
|
const getTypesToOmit = annotationsToSupport => {
|
|
@@ -284,7 +284,7 @@ export const importSequenceFromFile =
|
|
|
284
284
|
}
|
|
285
285
|
};
|
|
286
286
|
|
|
287
|
-
export const exportSequenceToFile = props => format => {
|
|
287
|
+
export const exportSequenceToFile = props => (format, options) => {
|
|
288
288
|
const { sequenceData } = props;
|
|
289
289
|
let convert, fileExt;
|
|
290
290
|
|
|
@@ -304,7 +304,9 @@ export const exportSequenceToFile = props => format => {
|
|
|
304
304
|
console.error(`Invalid export format: '${format}'`); // dev error
|
|
305
305
|
return;
|
|
306
306
|
}
|
|
307
|
-
const blob = new Blob([convert(sequenceData)], {
|
|
307
|
+
const blob = new Blob([convert(sequenceData, options)], {
|
|
308
|
+
type: "text/plain"
|
|
309
|
+
});
|
|
308
310
|
const filename = `${sequenceData.name || "Untitled_Sequence"}.${fileExt}`;
|
|
309
311
|
FileSaver.saveAs(blob, filename);
|
|
310
312
|
window.toastr.success("File Downloaded Successfully");
|
|
@@ -441,16 +443,16 @@ export default compose(
|
|
|
441
443
|
selectionLayer.start > -1
|
|
442
444
|
? { ...selectionLayer, id: undefined }
|
|
443
445
|
: caretPosition > -1
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
446
|
+
? {
|
|
447
|
+
start: caretPosition,
|
|
448
|
+
end: sequenceData.isProtein
|
|
449
|
+
? caretPosition + 2
|
|
450
|
+
: caretPosition
|
|
451
|
+
}
|
|
452
|
+
: {
|
|
453
|
+
start: 0,
|
|
454
|
+
end: sequenceData.isProtein ? 2 : 0
|
|
455
|
+
};
|
|
454
456
|
showAddOrEditAnnotationDialog({
|
|
455
457
|
type: key.toLowerCase(),
|
|
456
458
|
annotation: {
|