Skip to content

Commit

Permalink
re-ordered, adding debugging and better error correction
Browse files Browse the repository at this point in the history
  • Loading branch information
nathandunn committed Jun 27, 2019
1 parent 4758b4b commit 535f96e
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions grails-app/controllers/org/bbop/apollo/VcfController.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,6 @@ class VcfController {
JSONArray featuresArray = new JSONArray()
Organism organism = preferenceService.getOrganismForToken(organismString)
JSONObject trackListObject = trackService.getTrackList(organism.directory)
String trackUrlTemplate
for(JSONObject track : trackListObject.getJSONArray(FeatureStringEnum.TRACKS.value)) {
if(track.getString(FeatureStringEnum.LABEL.value) == trackName) {
trackUrlTemplate = track.urlTemplate
break
}
}

Boolean ignoreCache = params.ignoreCache != null ? Boolean.valueOf(params.ignoreCache) : false
if (!ignoreCache) {
Expand All @@ -57,6 +50,19 @@ class VcfController {
}
}

String trackUrlTemplate = null
for(JSONObject track : trackListObject.getJSONArray(FeatureStringEnum.TRACKS.value)) {
log.debug "comparing ${track.label} to ${trackName}"
if(track.getString(FeatureStringEnum.LABEL.value) == trackName) {
log.debug "found ${track} -> ${track.urlTemplate}"
trackUrlTemplate = track.urlTemplate
break
}
}
if(!trackUrlTemplate){
throw new RuntimeException("Track url template not found for '${trackName}'")
}

File file = new File(organism.directory + File.separator + trackUrlTemplate)
try {
VCFFileReader vcfFileReader = new VCFFileReader(file)
Expand Down

0 comments on commit 535f96e

Please sign in to comment.