From cd5bdee386e40ca39b0a46b1afbde3c79e17b3ab Mon Sep 17 00:00:00 2001 From: John Brestelli Date: Wed, 2 Oct 2024 09:52:15 -0400 Subject: [PATCH] add appVersion to service calls for Jbrowse --- .../services/jbrowse/JBrowseService.java | 118 +++++++++++------- 1 file changed, 74 insertions(+), 44 deletions(-) diff --git a/Service/src/main/java/org/apidb/apicommon/service/services/jbrowse/JBrowseService.java b/Service/src/main/java/org/apidb/apicommon/service/services/jbrowse/JBrowseService.java index 36db811e4..86859a935 100644 --- a/Service/src/main/java/org/apidb/apicommon/service/services/jbrowse/JBrowseService.java +++ b/Service/src/main/java/org/apidb/apicommon/service/services/jbrowse/JBrowseService.java @@ -65,15 +65,21 @@ public Response getJbrowseFeatures(@PathParam("refseq_name") String refseqName, @GET @Path("dnaseq/{organismAbbrev}") @Produces(MediaType.APPLICATION_JSON) - public Response getJbrowseDNASeqTracks(@PathParam("organismAbbrev") String organismAbbrev) throws IOException { + public Response getJbrowseDNASeqTracks(@PathParam("organismAbbrev") String organismAbbrev, + @DefaultValue("1") @QueryParam("appVersion") String appVersion) throws IOException { String gusHome = getWdkModel().getGusHome(); String projectId = getWdkModel().getProjectId(); + String buildNumber = getWdkModel().getBuildNumber(); + String webservicesDir = getWdkModel().getProperties().get("WEBSERVICEMIRROR"); List command = new ArrayList(); command.add(gusHome + "/bin/jbrowseDNASeqTracks"); command.add(organismAbbrev); command.add(projectId); + command.add(buildNumber); + command.add(webservicesDir); + command.add(appVersion); return responseFromCommand(command); } @@ -81,7 +87,10 @@ public Response getJbrowseDNASeqTracks(@PathParam("organismAbbrev") String organ @GET @Path("rnaseqJunctions/{organismAbbrev}") @Produces(MediaType.APPLICATION_JSON) - public Response getJbrowseRNASeqJunctionTracks(@PathParam("organismAbbrev") String organismAbbrev, @DefaultValue("0") @QueryParam("isApollo") String isApollo) throws IOException { + public Response getJbrowseRNASeqJunctionTracks(@PathParam("organismAbbrev") String organismAbbrev, + @DefaultValue("0") @QueryParam("isApollo") String isApollo, + @DefaultValue("1") @QueryParam("appVersion") String appVersion + ) throws IOException { String gusHome = getWdkModel().getGusHome(); String projectId = getWdkModel().getProjectId(); @@ -91,6 +100,7 @@ public Response getJbrowseRNASeqJunctionTracks(@PathParam("organismAbbrev") Stri command.add(organismAbbrev); command.add(projectId); command.add(isApollo); + command.add(appVersion); return responseFromCommand(command); } @@ -99,7 +109,9 @@ public Response getJbrowseRNASeqJunctionTracks(@PathParam("organismAbbrev") Stri @GET @Path("{tracks}/{publicOrganismAbbrev}/aa/trackList.json") @Produces(MediaType.APPLICATION_JSON) - public Response getJbrowseAaTracks(@PathParam("publicOrganismAbbrev") String publicOrganismAbbrev, @PathParam("tracks") String tracks) throws IOException { + public Response getJbrowseAaTracks(@PathParam("publicOrganismAbbrev") String publicOrganismAbbrev, + @DefaultValue("1") @QueryParam("appVersion") String appVersion, + @PathParam("tracks") String tracks) throws IOException { //NOTE: this service call is public facing so we use the publicOrganismAbbrev here @@ -113,6 +125,7 @@ public Response getJbrowseAaTracks(@PathParam("publicOrganismAbbrev") String pub command.add(projectId); command.add(String.valueOf(isPbrowse)); command.add(tracks); + command.add(appVersion); return responseFromCommand(command); } @@ -120,7 +133,9 @@ public Response getJbrowseAaTracks(@PathParam("publicOrganismAbbrev") String pub @GET @Path("{tracks}/{publicOrganismAbbrev}/trackList.json") @Produces(MediaType.APPLICATION_JSON) - public Response getJbrowseTracks(@PathParam("publicOrganismAbbrev") String publicOrganismAbbrev, @PathParam("tracks") String tracks) throws IOException { + public Response getJbrowseTracks(@PathParam("publicOrganismAbbrev") String publicOrganismAbbrev, + @DefaultValue("1") @QueryParam("appVersion") String appVersion, + @PathParam("tracks") String tracks) throws IOException { //NOTE: this service call is public facing so we use the publicOrganismAbbrev here @@ -135,14 +150,16 @@ public Response getJbrowseTracks(@PathParam("publicOrganismAbbrev") String publi command.add(projectId); command.add(String.valueOf(isPbrowse)); command.add(tracks); - + command.add(appVersion); return responseFromCommand(command); } @GET @Path("organismSpecific/{organismAbbrev}") @Produces(MediaType.APPLICATION_JSON) - public Response getJbrowseOrganismSpecificTracks(@PathParam("organismAbbrev") String organismAbbrev, @DefaultValue("0") @QueryParam("isApollo") String isApollo) throws IOException { + public Response getJbrowseOrganismSpecificTracks(@PathParam("organismAbbrev") String organismAbbrev, + @DefaultValue("1") @QueryParam("appVersion") String appVersion, + @DefaultValue("0") @QueryParam("isApollo") String isApollo) throws IOException { String gusHome = getWdkModel().getGusHome(); String projectId = getWdkModel().getProjectId(); @@ -157,14 +174,15 @@ public Response getJbrowseOrganismSpecificTracks(@PathParam("organismAbbrev") St command.add(isApollo); command.add(buildNumber); command.add(webservicesDir); - + command.add(appVersion); return responseFromCommand(command); } @GET @Path("organismSpecificPbrowse/{organismAbbrev}") @Produces(MediaType.APPLICATION_JSON) - public Response getJbrowseOrganismSpecificPbrowseTracks(@PathParam("organismAbbrev") String organismAbbrev) throws IOException { + public Response getJbrowseOrganismSpecificPbrowseTracks(@PathParam("organismAbbrev") String organismAbbrev, + @DefaultValue("1") @QueryParam("appVersion") String appVersion,) throws IOException { String gusHome = getWdkModel().getGusHome(); String projectId = getWdkModel().getProjectId(); @@ -173,7 +191,7 @@ public Response getJbrowseOrganismSpecificPbrowseTracks(@PathParam("organismAbbr command.add(gusHome + "/bin/jbrowseOrganismSpecificPbrowseTracks"); command.add(organismAbbrev); command.add(projectId); - + command.add(appVersion); return responseFromCommand(command); } @@ -195,7 +213,8 @@ public Response getOrganismList() throws IOException { @GET @Path("rnaseq/{organismAbbrev}") @Produces(MediaType.APPLICATION_JSON) - public Response getJbrowseRNASeqTracks(@PathParam("organismAbbrev") String organismAbbrev) throws IOException { + public Response getJbrowseRNASeqTracks(@PathParam("organismAbbrev") String organismAbbrev, + @DefaultValue("1") @QueryParam("appVersion") String appVersion) throws IOException { String gusHome = getWdkModel().getGusHome(); String projectId = getWdkModel().getProjectId(); @@ -209,14 +228,15 @@ public Response getJbrowseRNASeqTracks(@PathParam("organismAbbrev") String organ command.add(buildNumber); command.add(webservicesDir); command.add("RNASeq"); - + command.add(appVersion); return responseFromCommand(command); } @GET @Path("chipseq/{organismAbbrev}") @Produces(MediaType.APPLICATION_JSON) - public Response getJbrowseChIPSeqTracks(@PathParam("organismAbbrev") String organismAbbrev) throws IOException { + public Response getJbrowseChIPSeqTracks(@PathParam("organismAbbrev") String organismAbbrev, + @DefaultValue("1") @QueryParam("appVersion") String appVersion) throws IOException { String gusHome = getWdkModel().getGusHome(); String projectId = getWdkModel().getProjectId(); @@ -230,7 +250,7 @@ public Response getJbrowseChIPSeqTracks(@PathParam("organismAbbrev") String orga command.add(buildNumber); command.add(webservicesDir); command.add("ChIPSeq"); - + command.add(appVersion); return responseFromCommand(command); } @@ -278,46 +298,52 @@ private static String checkPath(String fileSystemPath) { return fileSystemPath; } - @GET - @Path("seq/{organismAbbrev}") - @Produces(MediaType.APPLICATION_JSON) - public Response getJbrowseRefSeqs(@PathParam("organismAbbrev") String organismAbbrev ) throws IOException { - String gusHome = getWdkModel().getGusHome(); - String projectId = getWdkModel().getProjectId(); + // THIS SHOULD BE REPLACED BY INDEXED FASTA IN WEBSERVICES + // @GET + // @Path("seq/{organismAbbrev}") + // @Produces(MediaType.APPLICATION_JSON) + // public Response getJbrowseRefSeqs(@PathParam("organismAbbrev") String organismAbbrev ) throws IOException { - List command = new ArrayList(); - command.add(gusHome + "/bin/jbrowseRefSeqs"); - command.add(gusHome); - command.add(projectId); - command.add(organismAbbrev); - command.add("genomic"); + // String gusHome = getWdkModel().getGusHome(); + // String projectId = getWdkModel().getProjectId(); - return responseFromCommand(command); - } + // List command = new ArrayList(); + // command.add(gusHome + "/bin/jbrowseRefSeqs"); + // command.add(gusHome); + // command.add(projectId); + // command.add(organismAbbrev); + // command.add("genomic"); - @GET - @Path("aaseq/{organismAbbrev}") - @Produces(MediaType.APPLICATION_JSON) - public Response getJbrowseAaRefSeqs(@PathParam("organismAbbrev") String organismAbbrev ) throws IOException { + // return responseFromCommand(command); + // } - String gusHome = getWdkModel().getGusHome(); - String projectId = getWdkModel().getProjectId(); + // THIS SHOULD BE REPLACED BY INDEXED FASTA IN WEBSERVICES + // @GET + // @Path("aaseq/{organismAbbrev}") + // @Produces(MediaType.APPLICATION_JSON) + // public Response getJbrowseAaRefSeqs(@PathParam("organismAbbrev") String organismAbbrev ) throws IOException { - List command = new ArrayList(); - command.add(gusHome + "/bin/jbrowseRefSeqs"); - command.add(gusHome); - command.add(projectId); - command.add(organismAbbrev); - command.add("protein"); + // String gusHome = getWdkModel().getGusHome(); + // String projectId = getWdkModel().getProjectId(); - return responseFromCommand(command); - } + // List command = new ArrayList(); + // command.add(gusHome + "/bin/jbrowseRefSeqs"); + // command.add(gusHome); + // command.add(projectId); + // command.add(organismAbbrev); + // command.add("protein"); + + // return responseFromCommand(command); + // } @GET @Path("names/{organismAbbrev}") @Produces(MediaType.APPLICATION_JSON) - public Response getJbrowseNames(@PathParam("organismAbbrev") String organismAbbrev, @QueryParam("equals") String eq, @QueryParam("startswith") String startsWith) throws IOException { + public Response getJbrowseNames(@PathParam("organismAbbrev") String organismAbbrev, + @QueryParam("equals") String eq, + @DefaultValue("1") @QueryParam("appVersion") String appVersion, + @QueryParam("startswith") String startsWith) throws IOException { if ((startsWith == null || startsWith.isBlank()) && (eq == null || eq.isBlank())) { throw new BadRequestException("Request must include one of the following query parameters: ['startswith', 'equals']"); @@ -341,15 +367,18 @@ public Response getJbrowseNames(@PathParam("organismAbbrev") String organismAbbr command.add(organismAbbrev); command.add("genomic"); command.add(String.valueOf(isPartial)); + command.add(appVersion); command.add(sourceId); - return responseFromCommand(command); } @GET @Path("aanames/{organismAbbrev}") @Produces(MediaType.APPLICATION_JSON) - public Response getJbrowseAaNames(@PathParam("organismAbbrev") String organismAbbrev, @QueryParam("equals") String eq, @QueryParam("startswith") String startsWith) throws IOException { + public Response getJbrowseAaNames(@PathParam("organismAbbrev") String organismAbbrev, + @QueryParam("equals") String eq, + @DefaultValue("1") @QueryParam("appVersion") String appVersion, + @QueryParam("startswith") String startsWith) throws IOException { String gusHome = getWdkModel().getGusHome(); String projectId = getWdkModel().getProjectId(); @@ -369,6 +398,7 @@ public Response getJbrowseAaNames(@PathParam("organismAbbrev") String organismAb command.add(organismAbbrev); command.add("protein"); command.add(String.valueOf(isPartial)); + command.add(appVersion); command.add(sourceId); return responseFromCommand(command);