@@ -236,6 +236,7 @@ class AnnotatorController {
236
236
feature. name = data. name
237
237
feature. symbol = data. symbol
238
238
feature. description = data. description
239
+ feature. isObsolete = data. obsolete
239
240
if (data. containsKey(" obsolete" )) {
240
241
feature. isObsolete = data. getBoolean(" obsolete" )
241
242
}
@@ -328,6 +329,76 @@ class AnnotatorController {
328
329
render updateFeatureContainer
329
330
}
330
331
332
+ /**
333
+ * updates shallow properties of gene / feature
334
+ * @return
335
+ */
336
+ @RestApiMethod (description = " Update partial fmin / famx" , path = " /annotator/updatePartials" , verb = RestApiVerb .POST )
337
+ @RestApiParams (params = [
338
+ @RestApiParam (name = " username" , type = " email" , paramType = RestApiParamType .QUERY )
339
+ , @RestApiParam (name = " password" , type = " password" , paramType = RestApiParamType .QUERY )
340
+ , @RestApiParam (name = " uniquename" , type = " string" , paramType = RestApiParamType .QUERY , description = " Uniquename (UUID) of the feature we are editing" )
341
+ , @RestApiParam (name = " data" , type = " string" , paramType = RestApiParamType .QUERY , description = " Annotation Info object" )
342
+ ]
343
+ )
344
+ @Transactional
345
+ def updatePartials () {
346
+ log. debug " update partials ${ params.data} "
347
+ JSONObject data = permissionService. handleInput(request, params)
348
+ if (! permissionService. hasPermissions(data, PermissionEnum . WRITE )) {
349
+ render status : HttpStatus . UNAUTHORIZED
350
+ return
351
+ }
352
+ Feature feature = Feature . findByUniqueName(data. uniquename)
353
+ FeatureLocation featureLocation = feature. featureLocation
354
+
355
+ boolean isFminPartial = feature. featureLocation. isFminPartial
356
+ boolean isFmaxPartial = feature. featureLocation. isFmaxPartial
357
+
358
+ JSONObject originalFeatureJsonObject = featureService. convertFeatureToJSON(feature)
359
+ FeatureOperation featureOperation
360
+ if (data. containsKey(FeatureStringEnum . IS_FMIN_PARTIAL . value)
361
+ &&
362
+ data. getBoolean(FeatureStringEnum . IS_FMIN_PARTIAL . value) != isFminPartial
363
+ ){
364
+ featureOperation = FeatureOperation . SET_PARTIAL_FMIN
365
+ // featureLocation.isFminPartial = data.getBoolean(FeatureStringEnum.IS_FMIN_PARTIAL.value)
366
+ featureService. setPartialFmin(feature,data. getBoolean(FeatureStringEnum . IS_FMIN_PARTIAL . value). booleanValue(),feature. featureLocation. fmin)
367
+ }
368
+ else
369
+ if (data. containsKey(FeatureStringEnum . IS_FMAX_PARTIAL . value)
370
+ &&
371
+ data. getBoolean(FeatureStringEnum . IS_FMAX_PARTIAL . value) != isFmaxPartial
372
+ ){
373
+ featureOperation = FeatureOperation . SET_PARTIAL_FMAX
374
+ featureService. setPartialFmax(feature,data. getBoolean(FeatureStringEnum . IS_FMAX_PARTIAL . value). booleanValue(),feature. featureLocation. fmax)
375
+ }
376
+ else {
377
+ throw new AnnotationException (" Partials have not changed, so not doing anything" )
378
+ }
379
+ featureLocation. save(flush : true , failOnError : true ,insert :false )
380
+
381
+ JSONObject updateFeatureContainer = jsonWebUtilityService. createJSONFeatureContainer();
382
+ // its either a gene or
383
+
384
+ User user = permissionService. getCurrentUser(data)
385
+ JSONObject currentFeatureJsonObject = featureService. convertFeatureToJSON(feature)
386
+
387
+ JSONArray oldFeaturesJsonArray = new JSONArray ()
388
+ oldFeaturesJsonArray. add(originalFeatureJsonObject)
389
+ JSONArray newFeaturesJsonArray = new JSONArray ()
390
+ newFeaturesJsonArray. add(currentFeatureJsonObject)
391
+ featureEventService. addNewFeatureEvent(featureOperation,
392
+ feature. name,
393
+ feature. uniqueName,
394
+ data,
395
+ oldFeaturesJsonArray,
396
+ newFeaturesJsonArray,
397
+ user)
398
+
399
+ render updateFeatureContainer
400
+ }
401
+
331
402
332
403
@RestApiMethod (description = " Update exon boundaries" , path = " /annotator/setExonBoundaries" , verb = RestApiVerb .POST )
333
404
@RestApiParams (params = [
@@ -991,6 +1062,7 @@ class AnnotatorController {
991
1062
if (! compareNullToBlank(feature. symbol,data. symbol)) return FeatureOperation . SET_SYMBOL
992
1063
if (! compareNullToBlank(feature. description,data. description)) return FeatureOperation . SET_DESCRIPTION
993
1064
if (! compareNullToBlank(feature. status,data. status)) return FeatureOperation . SET_STATUS
1065
+ if (feature. isObsolete != data. obsolete ) return FeatureOperation . SET_OBSOLETE
994
1066
995
1067
log. warn(" Updated generic feature" )
996
1068
null
0 commit comments