Commit 060b25d3 authored by tim.tucholski's avatar tim.tucholski
Browse files

Added support for multiple ID requests, fixed pom.xml

parent bfe24052
......@@ -3,7 +3,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>de.unigoettingen.ibeetlebase.api.core</groupId>
<artifactId>geneinfoservice_new</artifactId>
<artifactId>geneinfoservice</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<compiler-plugin.version>3.8.1</compiler-plugin.version>
......
package de.unigoettingen.ibeetlebase.api;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import io.quarkus.runtime.Quarkus;
......@@ -11,6 +13,7 @@ import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import org.eclipse.microprofile.metrics.annotation.Metered;
import de.unigoettingen.ibeetlebase.api.core.FlyBase;
......@@ -64,6 +67,27 @@ public class GeneinfoResource implements QuarkusApplication {
return tb.retrieve(tc);
}
/**
* Accepts multiple comma-separated gene IDs and returns the resulting gene information.
* @param ids The list of IDs
* @return Gene information for each queried ID
*/
@GET
@Metered
@Path(VERSION_STRING + "/gene")
public List<Gene> getInfo(@QueryParam("ids") final String ids) {
List<Gene> result_list = new ArrayList<Gene>();
for (String id : ids.split(",")) {
if (checkTCID(id)) {
result_list.add(tb.retrieve(id));
}
else if (checkFBgnID(id)) {
result_list.add(fb.retrieve(id));
}
}
return result_list;
}
/**
* Checks if a FlyBase gene identifier (FBgn) is in the right format
* @param fbgn The Flybase gene identifier to be checked
......@@ -89,7 +113,7 @@ public class GeneinfoResource implements QuarkusApplication {
*/
@GET
@Metered
@Path(VERSION_STRING + "/flybase/all")
@Path(VERSION_STRING + "/flybase/identifiers")
public Map<String, String> getAllFlybaseIDs(@PathParam("dataversion") final String dataversion) {
return fb.getAllIDs();
}
......@@ -101,7 +125,7 @@ public class GeneinfoResource implements QuarkusApplication {
*/
@GET
@Metered
@Path(VERSION_STRING + "/tribolium/all")
@Path(VERSION_STRING + "/tribolium/identifiers")
public Map<String, String> getAllTriboliumIDs(@PathParam("dataversion") final String dataversion) {
return tb.getAllIDs();
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment