X-Git-Url: http://source.jalview.org/gitweb/?p=jalview.git;a=blobdiff_plain;f=src%2Fjalview%2Ffts%2Fservice%2Funiprot%2FUniProtFTSRestClient.java;h=182729314c88773d772e2c66b8aa59957ae00aca;hp=05ccba7da248ab0c45fe3391b3d83755d7594004;hb=76bc0f9104ff45cc30648e9ad883f1393a7c7b6d;hpb=735e346c658597baaa9194dfb160b294a1198eae diff --git a/src/jalview/fts/service/uniprot/UniProtFTSRestClient.java b/src/jalview/fts/service/uniprot/UniProtFTSRestClient.java index 05ccba7..1827293 100644 --- a/src/jalview/fts/service/uniprot/UniProtFTSRestClient.java +++ b/src/jalview/fts/service/uniprot/UniProtFTSRestClient.java @@ -19,32 +19,6 @@ * The Jalview Authors are detailed in the 'AUTHORS' file. */ -/* - * 2022-07-20 bsoares - * See https://issues.jalview.org/browse/JAL-4036 - * The new Uniprot API is not dissimilar to the old one, but has some important changes. - * Some group names have changed slightly, some old groups have gone and there are quite a few new groups. - * - * Most changes are mappings of old column ids to new field ids. There are a handful of old - * columns not mapped to new fields, and new fields without an old column. - * [aside: not all possible columns were listed in the resources/fts/uniprot_data_columns.txt file. - * These were presumably additions after the file was created] - * For existing/mapped fields, the same preferences found in the resource file have been migrated to - * the new file with the new field name, id and group. - * - * The new mapped groups and files are stored and read from resources/fts/uniprot_data_columns-2022.txt. - * - * There is now no "sort" query string parameter. - * - * See https://www.uniprot.org/help/api_queries - * - * SIGNIFICANT CHANGE: Pagination is no longer performed using a record offset, but with a "cursor" - * query string parameter that is not really a cursor. The value is an opaque string that is passed (or - * rather a whole URL is passed) in the "Link" header of the HTTP response of the previous page. - * Where such a link is passed it is put into the cursors ArrayList. - * There are @Overridden methods in UniprotFTSPanel. - */ - package jalview.fts.service.uniprot; import java.lang.invoke.MethodHandles; @@ -73,6 +47,32 @@ import jalview.util.ChannelProperties; import jalview.util.MessageManager; import jalview.util.Platform; +/* + * 2022-07-20 bsoares + * See https://issues.jalview.org/browse/JAL-4036 + * The new Uniprot API is not dissimilar to the old one, but has some important changes. + * Some group names have changed slightly, some old groups have gone and there are quite a few new groups. + * + * Most changes are mappings of old column ids to new field ids. There are a handful of old + * columns not mapped to new fields, and new fields without an old column. + * [aside: not all possible columns were listed in the resources/fts/uniprot_data_columns.txt file. + * These were presumably additions after the file was created] + * For existing/mapped fields, the same preferences found in the resource file have been migrated to + * the new file with the new field name, id and group. + * + * The new mapped groups and files are stored and read from resources/fts/uniprot_data_columns-2022.txt. + * + * There is now no "sort" query string parameter. + * + * See https://www.uniprot.org/help/api_queries + * + * SIGNIFICANT CHANGE: Pagination is no longer performed using a record offset, but with a "cursor" + * query string parameter that is not really a cursor. The value is an opaque string that is passed (or + * rather a whole URL is passed) in the "Link" header of the HTTP response of the previous page. + * Where such a link is passed it is put into the cursors ArrayList. + * There are @Overridden methods in UniprotFTSPanel. + */ + public class UniProtFTSRestClient extends FTSRestClient { private static final String DEFAULT_UNIPROT_DOMAIN = "https://rest.uniprot.org"; @@ -95,7 +95,7 @@ public class UniProtFTSRestClient extends FTSRestClient { super(); this.clearCursors(); - uniprotSearchEndpoint = Cache.getDefault("UNIPROT_DOMAIN", + uniprotSearchEndpoint = Cache.getDefault("UNIPROT_2022_DOMAIN", DEFAULT_UNIPROT_DOMAIN) + "/uniprotkb/search"; } @@ -247,7 +247,8 @@ public class UniProtFTSRestClient extends FTSRestClient uniprotRestRequest, xTotalResults); } catch (Exception e) { - Console.debug("Exception caught from response", e); + Console.warn("Problem with the query: " + e.getMessage()); + Console.debug("Exception stacktrace:", e); String exceptionMsg = e.getMessage(); if (exceptionMsg.contains("SocketException")) { @@ -545,8 +546,7 @@ public class UniProtFTSRestClient extends FTSRestClient } } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); + Console.warn("Could not obtain next page 'cursor' value from 'u"); } return null; }