Skip to content

Commit

Permalink
added a lookup for uuid in loc (#2549)
Browse files Browse the repository at this point in the history
* added a lookup for uuid in loc

* updated

* made ids linkable
  • Loading branch information
nathandunn authored Dec 17, 2020
1 parent 79d19d1 commit 5f9b6d2
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 17 deletions.
2 changes: 2 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Features
- Added UUID lookup and link [2539](https://github.com/GMOD/Apollo/pull/2539/).
- Added status filter for recent annotations [2543](https://github.com/GMOD/Apollo/pull/2543/).
- Add feature name `loc` to loadLink [2544](https://github.com/GMOD/Apollo/issues/2544).
- `loc` loadLink now supports UUID and ID popup provides link [2549](https://github.com/GMOD/Apollo/issues/2549).

Bug Fixes

Expand All @@ -18,6 +19,7 @@ Bug Fixes
- Now able to resize terminators by dragging [2521](https://github.com/GMOD/Apollo/issues/2521).
- Added missing GO annotations [2535](https://github.com/GMOD/Apollo/pull/2535).
- findAllOrganism webserver failed when user is not an admin and no session is present [2540](https://github.com/GMOD/Apollo/issues/2540).
- Provide minor UI and bug fixes [2548](https://github.com/GMOD/Apollo/pull/2548).

Infrastructure Changes

Expand Down
3 changes: 1 addition & 2 deletions docs/Configure.md
Original file line number Diff line number Diff line change
Expand Up @@ -638,8 +638,7 @@ http://demo.genomearchitect.org/Apollo2/3836/jbrowse/index.html?loc=Group1.31:28

<apollo server url>/<organism>/annotator/loadLink?loc=<location>&organism=<organism>&tracks=<tracks>

- `location` = <sequence name>:<fmin>..<fmax> it can also be the annotated feature name as well
- `uuid` = The uniquename of the feature. It replaces the feature and does not require an organism argument. It is used inplace of the `loc` option.
- `location` = <sequence name>:<fmin>..<fmax> it can also be the annotated feature `name` if an organims is provided or the `uniqueName` (see the ID in the annotation detail window), which is typically a UUID and does not require an organism.
- `organism` is the organism id or common name if unique.
- `tracks` are url-encoded tracks separated by a comma

Expand Down
16 changes: 14 additions & 2 deletions grails-app/controllers/org/bbop/apollo/AnnotatorController.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,14 @@ class AnnotatorController {
organism = featureLocation.sequence.organism
}

if (!allowedOrganisms.contains(organism)) {
if (Feature.countByUniqueName(params.loc)>0) {
Feature feature = Feature.findByUniqueName(params.loc)
FeatureLocation featureLocation = feature.featureLocation
params.loc = featureLocation.sequence.name + ":" + featureLocation.fmin + ".." + featureLocation.fmax
organism = featureLocation.sequence.organism
}

if (!allowedOrganisms.contains(organism)) {
log.error("Can not load organism ${organism?.commonName} so loading ${allowedOrganisms.first().commonName} instead.")
params.loc = null
organism = allowedOrganisms.first()
Expand All @@ -94,10 +101,12 @@ class AnnotatorController {
log.debug "loading organism: ${organism}"
preferenceService.setCurrentOrganism(permissionService.currentUser, organism, clientToken)
String location = params.loc
// assume that the lookup is a symbol lookup value and not a location

// assume that the lookup is a symbol lookup value and not a location
if (location) {
int colonIndex = location.indexOf(':')
int ellipseIndex = location.indexOf('..')

if(colonIndex > 0 && colonIndex < ellipseIndex){
String[] splitString = location.split(':')
log.debug "splitString : ${splitString}"
Expand Down Expand Up @@ -127,6 +136,9 @@ class AnnotatorController {
int fmax = featureLocation.fmax
preferenceService.setCurrentSequenceLocation(sequence.name, fmin, fmax, clientToken)
}
else{
log.error("Failed to process load process loadLink string")
}
}
}

Expand Down
3 changes: 1 addition & 2 deletions src/gwt/org/bbop/apollo/gwt/client/AnnotatorPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -1034,8 +1034,7 @@ public void updateStatus(ChangeEvent changeEvent){

@UiHandler(value = {"annotationLinkButton"})
public void showAnnotationLink(ClickEvent clickEvent){
String url = MainPanel.getInstance().generateApolloUrl(selectedAnnotationInfo.getUniqueName());
String link = "<a href='"+url+"'>"+url+"</a>";
String link =MainPanel.getInstance().generateApolloLink(selectedAnnotationInfo.getUniqueName());
new LinkDialog("Link to '"+selectedAnnotationInfo.getName()+"'",link,true);
}

Expand Down
2 changes: 1 addition & 1 deletion src/gwt/org/bbop/apollo/gwt/client/GeneDetailPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ public void updateData(AnnotationInfo annotationInfo) {

@UiHandler("annotationIdButton")
void getAnnotationInfo(ClickEvent clickEvent) {
Bootbox.alert(internalAnnotationInfo.getUniqueName());
new LinkDialog("UniqueName: "+internalAnnotationInfo.getUniqueName(),"Link to: "+MainPanel.getInstance().generateApolloLink(internalAnnotationInfo.getUniqueName()),true);
}

@UiHandler("gotoAnnotation")
Expand Down
7 changes: 6 additions & 1 deletion src/gwt/org/bbop/apollo/gwt/client/MainPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -953,6 +953,11 @@ public String generateApolloUrl() {
return generateApolloUrl(null);
}

public String generateApolloLink(String uuid) {
String url = generateApolloUrl(uuid);
return "<a href='"+url+"'>"+url+"</a>";
}

public String generateApolloUrl(String uuid) {
String url = Annotator.getRootUrl();
url += "annotator/loadLink";
Expand All @@ -964,7 +969,7 @@ public String generateApolloUrl(String uuid) {
}
}
else{
url += "?uuid="+uuid;
url += "?loc="+uuid;
}
url += "&organism=" + currentOrganism.getId();
url += "&tracks=";
Expand Down
12 changes: 6 additions & 6 deletions src/gwt/org/bbop/apollo/gwt/client/RepeatRegionDetailPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
*/
public class RepeatRegionDetailPanel extends Composite {
private AnnotationInfo internalAnnotationInfo;

interface AnnotationDetailPanelUiBinder extends UiBinder<Widget, RepeatRegionDetailPanel> {
}

Expand Down Expand Up @@ -74,7 +74,7 @@ public RepeatRegionDetailPanel() {

@UiHandler("annotationIdButton")
void getAnnotationInfo(ClickEvent clickEvent) {
Bootbox.alert(internalAnnotationInfo.getUniqueName());
new LinkDialog("UniqueName: "+internalAnnotationInfo.getUniqueName(),"Link to: "+MainPanel.getInstance().generateApolloLink(internalAnnotationInfo.getUniqueName()),true);
}

@UiHandler("gotoAnnotation")
Expand Down Expand Up @@ -184,7 +184,7 @@ void handleNameChange(ChangeEvent e) {
internalAnnotationInfo.setName(updatedName);
updateEntity();
}

@UiHandler("descriptionField")
void handleDescriptionChange(ChangeEvent e) {
String updatedDescription = descriptionField.getText();
Expand All @@ -204,7 +204,7 @@ private void enableFields(boolean enabled) {
descriptionField.setEnabled(enabled);
synonymsField.setEnabled(enabled);
}

private void updateEntity() {
final AnnotationInfo updatedInfo = this.internalAnnotationInfo;
enableFields(false);
Expand All @@ -227,7 +227,7 @@ public void onError(Request request, Throwable exception) {
data.put(FeatureStringEnum.ORGANISM.getValue(),new JSONString(MainPanel.getInstance().getCurrentOrganism().getId()));
RestService.sendRequest(requestCallback, "annotator/updateFeature/", data);
}

public void updateData(AnnotationInfo annotationInfo) {
GWT.log("Updating entity");
this.internalAnnotationInfo = annotationInfo;
Expand Down Expand Up @@ -305,4 +305,4 @@ public void setEditable(boolean editable) {
synonymsField.setEnabled(editable);
deleteAnnotation.setEnabled(editable);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ public void callback(boolean result) {

@UiHandler("annotationIdButton")
void getAnnotationInfo(ClickEvent clickEvent) {
Bootbox.alert(internalAnnotationInfo.getUniqueName());
new LinkDialog("UniqueName: "+internalAnnotationInfo.getUniqueName(),"Link to: "+MainPanel.getInstance().generateApolloLink(internalAnnotationInfo.getUniqueName()),true);
}

@UiHandler("gotoAnnotation")
Expand Down
4 changes: 2 additions & 2 deletions src/gwt/org/bbop/apollo/gwt/client/VariantDetailPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ public void callback(boolean result) {

@UiHandler("annotationIdButton")
void getAnnotationInfo(ClickEvent clickEvent) {
Bootbox.alert(internalAnnotationInfo.getUniqueName());
new LinkDialog("UniqueName: "+internalAnnotationInfo.getUniqueName(),"Link to: "+MainPanel.getInstance().generateApolloLink(internalAnnotationInfo.getUniqueName()),true);
}

@UiHandler("gotoAnnotation")
Expand Down Expand Up @@ -315,4 +315,4 @@ public void onError(Request request, Throwable exception) {
public static boolean isValidDNA(String bases) {
return bases.matches("^[ATCGN]+$");
}
}
}

0 comments on commit 5f9b6d2

Please sign in to comment.