Skip to content

Commit

Permalink
Added menu items for exporting both DNA and AA as FASTA TeselaGen#61
Browse files Browse the repository at this point in the history
  • Loading branch information
ryan-stackwave committed Feb 28, 2024
1 parent 31250ca commit db5d481
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 12 deletions.
14 changes: 7 additions & 7 deletions packages/bio-parsers/src/jsonToFasta.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ export default function jsonToFasta(jsonSequence, options) {
proteinSequence
} = cleanedData;

options = options || {};
let seqToUse = sequence;
let sizeToUse = size;
if (isProtein && proteinSequence && !options?.useDNA) {
seqToUse = proteinSequence;
sizeToUse = proteinSize;
}
options = {
sequence: isProtein && proteinSequence ? proteinSequence : size,
size: isProtein && proteinSequence ? proteinSize : sequence,
...options
};
const seqToUse = options.sequence;
const sizeToUse = options.size;
// options.reformatSeqName = options.reformatSeqName === false ? false : true;
let fastaString = "";
fastaString += `>${name || "Untitled Sequence"}|`;
Expand Down
2 changes: 1 addition & 1 deletion packages/ove/src/MenuBar/defaultConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ export default [
showInSearchMenu: true,
submenu: [
{ cmd: "exportSequenceAsGenbank" },
{ cmd: "exportSequenceAsFasta" },
{ cmd: "exportDNASequenceAsFasta" },
{ cmd: "exportProteinSequenceAsFasta" },
{ cmd: "exportSequenceAsTeselagenJson" }
]
},
Expand Down
2 changes: 1 addition & 1 deletion packages/ove/src/SimpleCircularOrLinearView.js
Original file line number Diff line number Diff line change
Expand Up @@ -291,8 +291,8 @@ const DownloadBtn = withHandlers({ exportSequenceToFile })(props => {
showContextMenu(
[
"exportSequenceAsGenbank",
"exportSequenceAsFasta",
"exportDNASequenceAsFasta",
"exportProteinSequenceAsFasta",
"exportSequenceAsTeselagenJson"
],
[
Expand Down
2 changes: 1 addition & 1 deletion packages/ove/src/ToolBar/downloadTool.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ const Dropdown = withEditorProps(props => {
{createCommandMenu(
[
"exportSequenceAsGenbank",
"exportSequenceAsFasta",
"exportDNASequenceAsFasta",
"exportProteinSequenceAsFasta",
"exportSequenceAsTeselagenJson"
],
getCommands({ props })
Expand Down
17 changes: 15 additions & 2 deletions packages/ove/src/commands/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,21 @@ const fileCommandDefs = {
},
exportDNASequenceAsFasta: {
name: "Download DNA FASTA File",
isHidden: props => !isProtein(props) || !props.sequenceData.sequence,
handler: props => props.exportSequenceToFile("fasta", { useDNA: true })
isHidden: props => !props.sequenceData.sequence,
handler: props =>
props.exportSequenceToFile("fasta", {
sequence: props.sequenceData.sequence,
size: props.sequenceData.size
})
},
exportProteinSequenceAsFasta: {
name: "Download AA FASTA File",
isHidden: props => !props.sequenceData.proteinSequence,
handler: props =>
props.exportSequenceToFile("fasta", {
sequence: props.sequenceData.proteinSequence,
size: props.sequenceData.proteinSize
})
},
exportSequenceAsTeselagenJson: {
name: "Download Teselagen JSON File",
Expand Down

0 comments on commit db5d481

Please sign in to comment.