Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes #2129 #2609

Merged
merged 9 commits into from
Apr 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading