Skip to content

Commit

Permalink
added location feature name which fixes #2544 (#2547)
Browse files Browse the repository at this point in the history
  • Loading branch information
nathandunn committed Dec 16, 2020
1 parent d0d5396 commit c1b970f
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 4 deletions.
1 change: 1 addition & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Features
- Added organism and species to menus [2537](https://github.com/GMOD/Apollo/pull/2537).
- 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).

Bug Fixes

Expand Down
30 changes: 30 additions & 0 deletions docs/Configure.md
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,36 @@ You should use ```tracklist=1``` to force showing the native tracklist (or use t

Use ```openAnnotatorPanel=0``` to close the Annotator Panel explicitly on startup.

### Linking to annotations

You can find a link to your current location by clicking the "chain link" icon in the upper, left-hand corner of the Annotator Panel.

It will provide a popup that gives you a public URL to view while not logged in and a one to use while logged in.

####Public URL

<apollo server url>/<organism>/jbrowse/index.html?loc=<location>&tracks=<tracks>

- `location` = <sequence name>:<fmin>..<fmax>
- `organism` is the organism id or common name if unique.
- `tracks` are url-encoded tracks separated by a comma

Example:
http://demo.genomearchitect.org/Apollo2/3836/jbrowse/index.html?loc=Group1.31:287765..336436&tracks=Official%20Gene%20Set%20v3.2,GeneID

####Logged in URL

<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.
- `organism` is the organism id or common name if unique.
- `tracks` are url-encoded tracks separated by a comma

Examples:
- http://demo.genomearchitect.org/Apollo2/annotator/loadLink?loc=Group1.31:287765..336436&organism=3836&tracks=Official%20Gene%20Set%20v3.2,GeneID
- http://demo.genomearchitect.org/Apollo2/annotator/loadLink?loc=GB51936-RA&organism=3836&tracks=Official%20Gene%20Set%20v3.2,GeneID
- http://demo.genomearchitect.org/Apollo2/annotator/loadLink?uuid=355617c7-f8c1-4105-bb11-755cee1855df&tracks=Official%20Gene%20Set%20v3.2,GeneID

### Setting default track list behavior

Expand Down
16 changes: 12 additions & 4 deletions grails-app/controllers/org/bbop/apollo/AnnotatorController.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class AnnotatorController {
clientToken = ClientTokenGenerator.generateRandomString()
log.debug 'generating client token on the backend: ' + clientToken
}
Organism organism
Organism organism = null
// check organism first
if (params.containsKey(FeatureStringEnum.ORGANISM.value)) {
String organismString = params[FeatureStringEnum.ORGANISM.value]
Expand Down Expand Up @@ -96,7 +96,9 @@ class AnnotatorController {
String location = params.loc
// assume that the lookup is a symbol lookup value and not a location
if (location) {
if(location.contains(':') && location.contains('..')){
int colonIndex = location.indexOf(':')
int ellipseIndex = location.indexOf('..')
if(colonIndex > 0 && colonIndex < ellipseIndex){
String[] splitString = location.split(':')
log.debug "splitString : ${splitString}"
String sequenceString = splitString[0]
Expand All @@ -116,8 +118,14 @@ class AnnotatorController {
log.debug "fmin ${fmin} . . fmax ${fmax} . . ${sequence}"
preferenceService.setCurrentSequenceLocation(sequence.name, fmin, fmax, clientToken)
}
else{
searchName = location
else
if(organism && location.trim().length()>0) {
def featureLocationResult = FeatureLocation.executeQuery("select fl,s from Feature f join f.featureLocations fl join fl.sequence s join s.organism o where o = :organism and f.name = :name",[organism:organism,name:location] ).first()
FeatureLocation featureLocation = featureLocationResult[0]
Sequence sequence = featureLocationResult[1]
int fmin = featureLocation.fmin
int fmax = featureLocation.fmax
preferenceService.setCurrentSequenceLocation(sequence.name, fmin, fmax, clientToken)
}
}
}
Expand Down

0 comments on commit c1b970f

Please sign in to comment.