Skip to content

Commit

Permalink
fixes #2129 (#2609)
Browse files Browse the repository at this point in the history
* fixes #2129

* updated menu

* fixed linting error

* updated

* reformatted and synced the apis

* removed redundant method

* updated javadoc

* everything seems to be working now

* cleaned up
  • Loading branch information
nathandunn committed Apr 15, 2021
1 parent 1728c28 commit 2f54601
Show file tree
Hide file tree
Showing 6 changed files with 4,732 additions and 4,692 deletions.
1 change: 1 addition & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Features
- Added getAttributions method [2591](https://github.com/GMOD/Apollo/pull/2591) via @mbc32.
- Make getting track features by location optional to pull unique code [2600](https://github.com/GMOD/Apollo/pull/2600).
- Added additional websocket authentication support [2598](https://github.com/GMOD/Apollo/pull/2598).
- Added 'set optimal ORF' function [2129](https://github.com/GMOD/Apollo/pull/2129).

Bug Fix

Expand Down
46 changes: 40 additions & 6 deletions client/apollo/js/View/Track/AnnotTrack.js
Original file line number Diff line number Diff line change
Expand Up @@ -2130,7 +2130,13 @@ define([
this.setLongestORFForSelectedFeatures(selected);
},

setLongestORFForSelectedFeatures: function (selection) {
setOptimalORF: function () {
var selected = this.selectionManager.getSelection();
this.selectionManager.clearSelection();
this.setLongestORFForSelectedFeatures(selected,false);
},

setLongestORFForSelectedFeatures: function (selection,allowPartials = true) {
var track = this;
var features = '"features": [';
for (var i in selection) {
Expand All @@ -2140,19 +2146,16 @@ define([
// just checking to ensure that all features in selection are from
// this track
if (atrack === track) {
var trackdiv = track.div;
var trackName = track.getUniqueTrackName();

if (i > 0) {
features += ',';
}
features += ' { "uniquename": "' + uniqueName + '" } ';
features += ` { "uniquename": "${uniqueName}" } `;
}
}
features += ']';
var operation = "set_longest_orf";
var trackName = track.getUniqueTrackName();
var postData = '{ "track": "' + trackName + '", ' + features + ', "operation": "' + operation + '" }';
var postData = `{ "track": "${trackName}", ${features} , "operation": "${operation}" , "allow_partials": ${allowPartials} }`;
track.executeUpdateOperation(postData);
},

Expand Down Expand Up @@ -6956,6 +6959,15 @@ define([
}));
contextMenuItems["set_longest_orf"] = index++;


annot_context_menu.addChild(new dijit.MenuItem({
label: "Set Optimal ORF",
onClick: function (event) {
thisB.setOptimalORF();
}
}));
contextMenuItems["set_optimal_orf"] = index++;

annot_context_menu.addChild(new dijit.MenuItem({
label: "Remove CDS",
onClick: function (event) {
Expand Down Expand Up @@ -7271,6 +7283,7 @@ define([
this.updateSetTranslationStartMenuItem();
this.updateSetTranslationEndMenuItem();
this.updateSetLongestOrfMenuItem();
this.updateSetOptimalOrfMenuItem();
this.updateRemoveCDSMenuItem();
this.updateAssociateTranscriptToGeneItem();
this.updateDissociateTranscriptFromGeneItem();
Expand Down Expand Up @@ -7662,6 +7675,27 @@ define([
menuItem.set("disabled", false);
},

updateSetOptimalOrfMenuItem: function () {
var menuItem = this.getMenuItem("set_optimal_orf");
var selected = this.selectionManager.getSelection();
if (selected.length > 1) {
menuItem.set("disabled", true);
return;
}
for (var i = 0; i < selected.length; ++i) {
if (!this.isProteinCoding(selected[i].feature)) {
menuItem.set("disabled", true);
return;
}
if (!this.canEdit(selected[i].feature)) {
menuItem.set("disabled", true);
return;
}
}

menuItem.set("disabled", false);
},

updateSetReadthroughStopCodonMenuItem: function () {
var menuItem = this.getMenuItem("set_readthrough_stop_codon");
var selected = this.selectionManager.getSelection();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,7 @@ class AnnotationEditorController extends AbstractApolloController implements Ann
, @RestApiParam(name = "sequence", type = "string", paramType = RestApiParamType.QUERY, description = "(optional) Sequence name")
, @RestApiParam(name = "organism", type = "string", paramType = RestApiParamType.QUERY, description = "(optional) Organism ID or common name")
, @RestApiParam(name = "features", type = "JSONArray", paramType = RestApiParamType.QUERY, description = "JSONArray containing a single JSONObject feature that contains {'uniquename':'ABCD-1234'}")
, @RestApiParam(name = "allow_partials", type = "boolean", paramType = RestApiParamType.QUERY, description = "(optional) Default true. Allow partials when setting longest ORF.")
])
def setLongestOrf() {
log.debug "setLongestORF ${params}"
Expand Down

0 comments on commit 2f54601

Please sign in to comment.