use of org.jbei.ice.lib.entry.sequence.annotation.Annotations in project ice by JBEI.
the class AnnotationResource method curate.
/**
* Curate available annotations to include or exclude them from auto-annotation feature
*
* @param list list of annotations each with specified curate
*/
@PUT
@Produces(MediaType.APPLICATION_JSON)
public Response curate(List<DNAFeature> list) {
String userId = requireUserId();
Annotations annotations = new Annotations(userId);
try {
final Type fooType = new TypeToken<ArrayList<DNAFeature>>() {
}.getType();
final Gson gson = new GsonBuilder().create();
final ArrayList<DNAFeature> features = gson.fromJson(gson.toJsonTree(list), fooType);
annotations.curate(features);
return super.respond(true);
} catch (PermissionException e) {
Logger.error(e);
throw new WebApplicationException(Response.Status.FORBIDDEN);
}
}
use of org.jbei.ice.lib.entry.sequence.annotation.Annotations in project ice by JBEI.
the class AnnotationResource method getAnnotationsForSequence.
/**
* Generates annotations for the passed sequence
*
* @param sequence sequence wrapper.
* @return annotations for sequence
*/
@POST
public Response getAnnotationsForSequence(FeaturedDNASequence sequence) {
String userId = getUserId();
Annotations annotations = new Annotations(userId);
FeaturedDNASequence annotatedSequence = annotations.generate(sequence);
if (annotatedSequence == null)
throw new WebApplicationException();
return super.respond(annotatedSequence);
}
use of org.jbei.ice.lib.entry.sequence.annotation.Annotations in project ice by JBEI.
the class AnnotationResource method rebuildAnnotations.
@PUT
@Path("/indexes")
public Response rebuildAnnotations() {
String userId = requireUserId();
Annotations annotations = new Annotations(userId);
try {
annotations.rebuild();
} catch (PermissionException pe) {
Logger.error(pe);
throw new WebApplicationException(Response.Status.FORBIDDEN);
}
return super.respond(true);
}
use of org.jbei.ice.lib.entry.sequence.annotation.Annotations in project ice by JBEI.
the class PartResource method getAutoAnnotations.
@GET
@Path("/{id}/annotations/auto")
@Produces(MediaType.APPLICATION_JSON)
public Response getAutoAnnotations(@PathParam("id") long partId, @QueryParam("ownerFeatures") boolean ownerFeatures) {
String userId = requireUserId();
log(userId, "requesting auto annotations for entry " + partId);
Annotations annotations = new Annotations(userId);
return super.respond(annotations.generate(partId, ownerFeatures));
}
use of org.jbei.ice.lib.entry.sequence.annotation.Annotations in project ice by JBEI.
the class AnnotationResource method getFeatures.
/**
* Retrieve list of annotations available.
* Administrative privileges required
*
* @param offset paging start
* @param limit maximum number of results to return
* @param sort sort field
* @param asc sort order
*/
@GET
@Produces(MediaType.APPLICATION_JSON)
public Response getFeatures(@DefaultValue("0") @QueryParam("offset") final int offset, @DefaultValue("15") @QueryParam("limit") final int limit, @DefaultValue("created") @QueryParam("sort") final String sort, @DefaultValue("false") @QueryParam("asc") final boolean asc, @QueryParam("filter") String filter) {
String userId = requireUserId();
Annotations annotations = new Annotations(userId);
try {
if (filter != null && !filter.isEmpty())
return super.respond(annotations.filter(offset, limit, filter));
return super.respond(annotations.get(offset, limit, sort));
} catch (PermissionException pe) {
throw new WebApplicationException(Response.Status.FORBIDDEN);
}
}
Aggregations