Esempio n. 1
0
 @GET
 @Path("/{id}/xref")
 @ApiOperation(httpMethod = "GET", value = "Retrieves all the external references for the ID")
 public Response getByFeatureId(
     @PathParam("id") String query, @DefaultValue("") @QueryParam("dbname") String dbname) {
   try {
     checkParams();
     XRefsDBAdaptor xRefDBAdaptor = dbAdaptorFactory.getXRefDBAdaptor(this.species, this.assembly);
     if (!dbname.equals("")) {
       queryOptions.put("dbname", Splitter.on(",").splitToList(dbname));
     }
     return createOkResponse(
         xRefDBAdaptor.getAllByDBNameList(Splitter.on(",").splitToList(query), queryOptions));
     //            if (dbName.equals("")) {
     //                return generateResponse(query, "XREF",
     // x.getAllByDBNameList(Splitter.on(",").splitToList(query), null));
     //            }
     //            else {
     //                return generateResponse(query, "XREF",
     // x.getAllByDBNameList(Splitter.on(",").splitToList(query),
     // Splitter.on(",").splitToList(dbName)));
     //            }
   } catch (Exception e) {
     e.printStackTrace();
     return createErrorResponse("getAllByAccessions", e.toString());
   }
 }
Esempio n. 2
0
 @GET
 @Path("/{id}/contains")
 /*
     @ApiOperation(httpMethod = "GET", value = "Get the genes that contain the given string")
 */
 public Response getByContainsQuery(@PathParam("id") String query) {
   try {
     checkParams();
     XRefsDBAdaptor x = dbAdaptorFactory.getXRefDBAdaptor(this.species, this.assembly);
     List<List<Xref>> xrefs = x.getByContainsQueryList(Splitter.on(",").splitToList(query));
     if (query.startsWith("rs")
         || query.startsWith("AFFY_")
         || query.startsWith("SNP_")
         || query.startsWith("VAR_")
         || query.startsWith("CRTAP_")
         || query.startsWith("FKBP10_")
         || query.startsWith("LEPRE1_")
         || query.startsWith("PPIB_")) {
       List<QueryResult> snpXrefs =
           x.getByStartsWithSnpQueryList(Splitter.on(",").splitToList(query), queryOptions);
       //                for (List<Xref> xrefList : snpXrefs) {
       //                    xrefs.get(0).addAll(xrefList);
       //                }
     }
     return generateResponse(query, xrefs);
   } catch (Exception e) {
     e.printStackTrace();
     return createErrorResponse("getAllByAccessions", e.toString());
   }
 }