Skip to content

Commit

Permalink
removed depcrecation and cleaned up code (#2619)
Browse files Browse the repository at this point in the history
* removed depcrecation and cleaned up code

* updated changelog

* updated documentation
  • Loading branch information
nathandunn committed May 12, 2021
1 parent 5eae7d8 commit 180a5b1
Show file tree
Hide file tree
Showing 4 changed files with 1,473 additions and 1,472 deletions.
4 changes: 4 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ Features

- Added method to upload bulk functional annotations from JSON in the interface [2617](https://github.com/GMOD/Apollo/pull/2617),[2618](https://github.com/GMOD/Apollo/pull/2618).

Bug Fix

- Removed deprecation from SequenceController.sequenceByName [2619](https://github.com/GMOD/Apollo/pull/2619).


## 2.6.4

Expand Down
3 changes: 2 additions & 1 deletion grails-app/conf/UrlMappings.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ class UrlMappings {

"/sequence/${organismString}/?loc=${sequenceName}:${fmin}..${fmax}"(controller: "sequence", action: "sequenceByLocation",[params:params])
"/sequence/${organismString}/${sequenceName}:${fmin}..${fmax}"(controller: "sequence", action: "sequenceByLocation",[params:params])
"/sequence/${organismString}/${sequenceName}/${featureName}.${type}"(controller: "sequence", action: "sequenceByName",[params:params])
// mapping not found
// "/sequence/sequenceByName/${organismString}/${sequenceName}/${featureName}.${type}"(controller: "sequence", action: "sequenceByName",[params:params])
"/sequence/cache/clear/${organismName}/${sequenceName}"(controller: "sequence", action: "clearSequenceCache")
"/sequence/cache/clear/${organismName}"(controller: "sequence", action: "clearOrganismCache")

Expand Down
14 changes: 5 additions & 9 deletions grails-app/controllers/org/bbop/apollo/SequenceController.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ class SequenceController {
render view: "report", model: [sequenceInstanceList: sequenceInstanceList, organisms: organisms, organism: organism, sequenceInstanceCount: sequenceInstanceCount]
}

@RestApiMethod(description = "Get sequence data within a range (also works as post)", path = "/sequence/<organism name>/<sequence name>:<fmin>..<fmax>?ignoreCache=<ignoreCache>", verb = RestApiVerb.GET)
@RestApiMethod(description = "Get sequence data within a range (also works as post)", path = "GET /sequence/<organism name>/<sequence name>:<fmin>..<fmax>?ignoreCache=<ignoreCache>, POST /sequence/sequenceByLocation", verb = RestApiVerb.GET)
@RestApiParams(params = [
@RestApiParam(name = "organismString", type = "string", paramType = RestApiParamType.QUERY, description = "Organism common name or ID(required)")
, @RestApiParam(name = "sequenceName", type = "string", paramType = RestApiParamType.QUERY, description = "Sequence name(required)")
Expand All @@ -261,6 +261,8 @@ class SequenceController {
@Transactional
String sequenceByLocation(String organismString, String sequenceName, int fmin, int fmax) {

println "sequence by location "

// handle post data
def inputJSON = request.JSON as JSONObject
organismString = organismString ?: inputJSON.organismString
Expand Down Expand Up @@ -304,15 +306,14 @@ class SequenceController {

}

@RestApiMethod(description = "Get sequence data as for a selected name (also works as post)", path = "/sequence/<organism name>/<sequence name>/<feature name>.<type>?ignoreCache=<ignoreCache>", verb = RestApiVerb.GET)
@RestApiMethod(description = "Get sequence data as for a selected name (also works as post)", path = "/sequence/sequenceByName", verb = RestApiVerb.GET)
@RestApiParams(params = [
@RestApiParam(name = "organismString", type = "string", paramType = RestApiParamType.QUERY, description = "Organism common name or ID (required)")
, @RestApiParam(name = "sequenceName", type = "string", paramType = RestApiParamType.QUERY, description = "Sequence name (required)")
, @RestApiParam(name = "featureName", type = "string", paramType = RestApiParamType.QUERY, description = "The uniqueName (UUID) or given name of the feature (typically transcript) of the element to retrieve sequence from")
, @RestApiParam(name = "type", type = "string", paramType = RestApiParamType.QUERY, description = "(default genomic) Return type: genomic, cds, cdna, peptide")
, @RestApiParam(name = "ignoreCache", type = "boolean", paramType = RestApiParamType.QUERY, description = "(default false). Use cache for request if available.")
])
@Deprecated
@Transactional
String sequenceByName(String organismString, String sequenceName, String featureName, String type) {

Expand Down Expand Up @@ -351,7 +352,6 @@ class SequenceController {
}

Feature feature = Feature.findByUniqueName(featureName)
println "feature name: $featureName"
if (!feature) {
def features = Feature.findAllByName(featureName)

Expand All @@ -366,13 +366,9 @@ class SequenceController {
}
}

println "found a feature: $feature"

if (feature) {
String sequenceString = sequenceService.getSequenceForFeature(feature, type)
println "A: ${sequenceString?.trim()} .. $type"
if(sequenceString?.trim()){
println "B"
render sequenceString
sequenceService.cacheRequest(sequenceString, organismString, sequenceName, featureName, type, paramMap)
return
Expand All @@ -393,7 +389,7 @@ class SequenceController {
JSONObject organismJson = permissionService.handleInput(request, params)
// if global admin
Organism organism = Organism.findByCommonName(organismName) ?: Organism.findById(organismName as Long)
if (permissionService.hasGlobalPermissions(organismJson,GlobalPermissionEnum.ADMIN) || checkPermission(organismName)){
if (organism && permissionService.hasGlobalPermissions(organismJson,GlobalPermissionEnum.ADMIN) || checkPermission(organismName)){
int removed = SequenceCache.countByOrganismNameAndSequenceName(organismName, sequenceName)
SequenceCache.deleteAll(SequenceCache.findAllByOrganismNameAndSequenceName(organismName, sequenceName))
render new JSONObject(removed: removed) as JSON
Expand Down

0 comments on commit 180a5b1

Please sign in to comment.