Skip to content

Commit

Permalink
add sort and limit to transcript and region end points. #522
Browse files Browse the repository at this point in the history
  • Loading branch information
julie-sullivan committed Feb 4, 2020
1 parent e51302b commit 3a035dd
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,20 @@ public Response getByEnsemblId(@PathParam("transcriptId") String id) {
})
public Response getGeneById(@PathParam("transcriptId")
@ApiParam(name = "transcriptId", value = ParamConstants.TRANSCRIPT_IDS,
required = true) String id) {
required = true) String id,
@QueryParam("exclude")
@ApiParam(value = ParamConstants.EXCLUDE_DESCRIPTION) String exclude,
@QueryParam("include")
@ApiParam(value = ParamConstants.INCLUDE_DESCRIPTION) String include,
@QueryParam("sort")
@ApiParam(value = ParamConstants.SORT_DESCRIPTION) String sort,
@QueryParam("limit") @DefaultValue("10")
@ApiParam(value = ParamConstants.LIMIT_DESCRIPTION) Integer limit,
@QueryParam("skip") @DefaultValue("0")
@ApiParam(value = ParamConstants.SKIP_DESCRIPTION) Integer skip) {
try {
parseIncludesAndExcludes(exclude, include, sort);
parseLimitAndSkip(limit, skip);
parseQueryParams();
GeneDBAdaptor geneDBAdaptor = dbAdaptorFactory.getGeneDBAdaptor(this.species, this.assembly);
List<Query> queries = createQueries(id, GeneDBAdaptor.QueryParams.TRANSCRIPT_ID.key());
Expand Down Expand Up @@ -275,8 +287,20 @@ public Response getSequencesByIdList(@PathParam("transcriptId")
dataType = "java.util.List", paramType = "query")
})
public Response getProtein(@PathParam("transcriptId") @ApiParam(name = "transcriptId",
value = ParamConstants.TRANSCRIPT_IDS, required = true) String transcriptId) {
value = ParamConstants.TRANSCRIPT_IDS, required = true) String transcriptId,
@QueryParam("exclude")
@ApiParam(value = ParamConstants.EXCLUDE_DESCRIPTION) String exclude,
@QueryParam("include")
@ApiParam(value = ParamConstants.INCLUDE_DESCRIPTION) String include,
@QueryParam("sort")
@ApiParam(value = ParamConstants.SORT_DESCRIPTION) String sort,
@QueryParam("limit") @DefaultValue("10")
@ApiParam(value = ParamConstants.LIMIT_DESCRIPTION) Integer limit,
@QueryParam("skip") @DefaultValue("0")
@ApiParam(value = ParamConstants.SKIP_DESCRIPTION) Integer skip) {
try {
parseIncludesAndExcludes(exclude, include, sort);
parseLimitAndSkip(limit, skip);
parseQueryParams();
ProteinDBAdaptor proteinDBAdaptor = dbAdaptorFactory.getProteinDBAdaptor(this.species, this.assembly);
List<Query> queries = createQueries(transcriptId, ProteinDBAdaptor.QueryParams.XREFS.key());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,19 @@ private boolean hasHistogramQueryParam() {
@ApiImplicitParam(name = "annotation.drugs.name", value = ParamConstants.ANNOTATION_DRUGS_NAME,
required = false, dataType = "java.util.List", paramType = "query")
})
public Response getGenesByRegionPost(@FormParam("region")
@ApiParam(name = "region",
value = "Comma separated list of genomic regions to be queried, e.g.: 1:6635137-6635325",
required = true) String region) {
return getGenesByRegion(region);
public Response getGenesByRegionPost(@FormParam("region") @ApiParam(name = "region",
value = ParamConstants.REGION_DESCRIPTION, required = true) String region,
@QueryParam("exclude")
@ApiParam(value = ParamConstants.EXCLUDE_DESCRIPTION) String exclude,
@QueryParam("include")
@ApiParam(value = ParamConstants.INCLUDE_DESCRIPTION) String include,
@QueryParam("sort")
@ApiParam(value = ParamConstants.SORT_DESCRIPTION) String sort,
@QueryParam("limit") @DefaultValue("10")
@ApiParam(value = ParamConstants.LIMIT_DESCRIPTION) Integer limit,
@QueryParam("skip") @DefaultValue("0")
@ApiParam(value = ParamConstants.SKIP_DESCRIPTION) Integer skip) {
return getGenesByRegion(region, exclude, include, sort, limit, skip);
}

@GET
Expand Down Expand Up @@ -165,9 +173,21 @@ public Response getGenesByRegionPost(@FormParam("region")
})
public Response getGenesByRegion(@PathParam("chrRegionId")
@ApiParam(name = "chrRegionId",
value = "Comma separated list of genomic regions to be queried, e.g.: 1:6635137-6635325",
required = true) String region) {
value = ParamConstants.REGION_DESCRIPTION,
required = true) String region,
@QueryParam("exclude")
@ApiParam(value = ParamConstants.EXCLUDE_DESCRIPTION) String exclude,
@QueryParam("include")
@ApiParam(value = ParamConstants.INCLUDE_DESCRIPTION) String include,
@QueryParam("sort")
@ApiParam(value = ParamConstants.SORT_DESCRIPTION) String sort,
@QueryParam("limit") @DefaultValue("10")
@ApiParam(value = ParamConstants.LIMIT_DESCRIPTION) Integer limit,
@QueryParam("skip") @DefaultValue("0")
@ApiParam(value = ParamConstants.SKIP_DESCRIPTION) Integer skip) {
try {
parseIncludesAndExcludes(exclude, include, sort);
parseLimitAndSkip(limit, skip);
parseQueryParams();
GeneDBAdaptor geneDBAdaptor = dbAdaptorFactory.getGeneDBAdaptor(this.species, this.assembly);

Expand Down Expand Up @@ -209,11 +229,21 @@ public Response getGenesByRegion(@PathParam("chrRegionId")
@ApiImplicitParam(name = "transcripts.tfbs.name", value = ParamConstants.TRANSCRIPT_TFBS_NAMES,
required = false, dataType = "java.util.List", paramType = "query")
})
public Response getTranscriptByRegion(@PathParam("chrRegionId")
@ApiParam(name = "chrRegionId",
value = "comma-separated list of genomic regions to be queried, "
+ "e.g. 1:11869-14412", required = true) String region) {
public Response getTranscriptByRegion(@PathParam("chrRegionId") @ApiParam(name = "chrRegionId",
value = ParamConstants.REGION_DESCRIPTION, required = true) String region,
@QueryParam("exclude")
@ApiParam(value = ParamConstants.EXCLUDE_DESCRIPTION) String exclude,
@QueryParam("include")
@ApiParam(value = ParamConstants.INCLUDE_DESCRIPTION) String include,
@QueryParam("sort")
@ApiParam(value = ParamConstants.SORT_DESCRIPTION) String sort,
@QueryParam("limit") @DefaultValue("10")
@ApiParam(value = ParamConstants.LIMIT_DESCRIPTION) Integer limit,
@QueryParam("skip") @DefaultValue("0")
@ApiParam(value = ParamConstants.SKIP_DESCRIPTION) Integer skip) {
try {
parseIncludesAndExcludes(exclude, include, sort);
parseLimitAndSkip(limit, skip);
parseQueryParams();
TranscriptDBAdaptor transcriptDBAdaptor = dbAdaptorFactory.getTranscriptDBAdaptor(this.species, this.assembly);
List<Query> queries = createQueries(region, TranscriptDBAdaptor.QueryParams.REGION.key());
Expand Down

0 comments on commit 3a035dd

Please sign in to comment.