From 2f528f5e7d5e1555ee23dc2e8ef9b0bffc16520d Mon Sep 17 00:00:00 2001 From: rohan katyal Date: Fri, 13 Mar 2015 15:23:55 +0530 Subject: [PATCH 1/8] [FIX #53] update python BDK to beacon 0.2 API --- beacon-adapters/beacon-python/beacon.py | 112 ++++++++++++++++++++++-- 1 file changed, 106 insertions(+), 6 deletions(-) diff --git a/beacon-adapters/beacon-python/beacon.py b/beacon-adapters/beacon-python/beacon.py index e6aae62..580d44e 100755 --- a/beacon-adapters/beacon-python/beacon.py +++ b/beacon-adapters/beacon-python/beacon.py @@ -28,15 +28,81 @@ app = Flask(__name__) -# beacon details +#--------------- Information endpont (start) --------------------# + # TODO: override with the details of your beacon + +########### DataSetResource for beacon details ############ + +# required field(s): name +DataUseRequirementResource = { + 'name': u'string', + 'description': u'string' +} + +# required field(s): variants +DataSizeResource = { + 'variants': 1, # integer + 'samples': 1 # integer +} + +#required field(s): category +DataUseResource = { + 'category': u'string', + 'description': u'string', + 'requirements': [ + DataUseRequirementResource + ] +} + +# required field(s): id +DataSetResource = { + 'id': u'string', + 'description': u'string', + 'reference': u'string', + 'size': DataSizeResource, # Dimensions of the data set (required if the beacon reports allele frequencies) + 'multiple': False, + 'datasets': [ + u'string' + ], + 'data_uses': [ + DataUseResource # Data use limitations + ] +} + +########### QueryResource for beacon details ############### + +# required field(s): allele, chromosome, position, reference +QueryResource = { + 'allele': u'string', + 'chromosome': u'string', + 'position': 1, # integer + 'reference': u'string', + 'dataset_id': u'string' +} + +################### Beacon details ######################### + +# required field(s): id, name, organization, api beacon = { 'id': u'foo', 'name': u'bar', - 'organization': u'org', - 'description': u'sample beacon' + 'organization': u'org', + 'api': u'0.1/0.2', + 'description': u'sample beacon', + 'datasets': [ + DataSetResource # Datasets served by the beacon + ], + 'homepage': u'http://dnastack.com/ga4gh/bob/', + 'email': u'beacon@dnastack.com', + 'auth': u'string', # OAUTH2, defaults to none + 'queries': [ + QueryResource # Examples of interesting queries + ] } +#--------------- Information endpoint (end) ----------------------# + # info function @app.route('/beacon-python/rest/info', methods=['GET']) def info(): @@ -51,11 +117,44 @@ def query(): position = long(request.args.get('pos')) allele = request.args.get('allele') reference = request.args.get('ref') + dataset = request.args.get('dataset') if 'dataset' in request.args else beacon['datasets'][0]['id'] + + +#---- TODO: override with the necessary response details ----# +############## AlleleResource for response ############### + + # required field(s): allele + AlleleResource = { + 'allele': u'string', + 'frequency': 0.5 # double between 0 & 1 + } + +############# ErrorResource for response ################# + + # required field(s): name + ErrorResource = { + 'name': u'string', + 'description': u'string' + } + +################### Response object ######################### + # generate response - response = True + # required field(s): exists + response = { + 'exists': True, + 'observed': '0', # min 0 + 'alleles': [ + AlleleResource + ], + 'info': u'string', + 'error': ErrorResource + } - return jsonify({ "beacon" : beacon, "query" : { 'chromosome' : chromosome, 'position' : position, 'allele' : allele, 'reference' : reference }, 'response' : response }) +#--------------------------------------------------------------# + + return jsonify({ "beacon" : beacon, "query" : { 'chromosome' : chromosome, 'position' : position, 'allele' : allele, 'reference' : reference, 'dataset_id': dataset }, 'response' : response }) # errors in JSON @app.errorhandler(404) @@ -63,4 +162,5 @@ def not_found(error): return make_response(jsonify({'error': 'Not found'}), 404) if __name__ == '__main__': - app.run() \ No newline at end of file + app.run() + From 93eb2dab0c9a6bfbc1e554364484f4b5622ff5a5 Mon Sep 17 00:00:00 2001 From: rohan katyal Date: Sat, 14 Mar 2015 09:56:34 +0530 Subject: [PATCH 2/8] [FIX #53] minor changes to python-bdk api version: 0.2 removed /rest from endpoints query response returns beacon id added sample welcome page for /beacon-python non existant url error: internal server -> 404 --- beacon-adapters/beacon-python/.gitignore | 50 +++++++++++++++++++++ beacon-adapters/beacon-python/beacon.py | 57 ++++++++++++------------ 2 files changed, 79 insertions(+), 28 deletions(-) create mode 100644 beacon-adapters/beacon-python/.gitignore diff --git a/beacon-adapters/beacon-python/.gitignore b/beacon-adapters/beacon-python/.gitignore new file mode 100644 index 0000000..89adf73 --- /dev/null +++ b/beacon-adapters/beacon-python/.gitignore @@ -0,0 +1,50 @@ +# Maven +target/ +pom.xml.tag +pom.xml.releaseBackup +pom.xml.next +release.properties + +# IDEs +nb-configuration.xml +nbactions*.xml + +# auxiliary scripts +*.sh + +# log files +*.log + +# python files +flask + +# nodejs files +node_modules + +*target* +*.jar +*.war +*.ear +*.class + +# eclipse specific git ignore +*.pydevproject +.project +.metadata +bin/** +tmp/** +tmp/**/* +*.tmp +*.bak +*.swp +*~.nib +local.properties +.classpath +.settings/ +.loadpath + +# External tool builders +.externalToolBuilders/ + +# Locally stored "Eclipse launch configurations" +*.launch \ No newline at end of file diff --git a/beacon-adapters/beacon-python/beacon.py b/beacon-adapters/beacon-python/beacon.py index 580d44e..f3e948c 100755 --- a/beacon-adapters/beacon-python/beacon.py +++ b/beacon-adapters/beacon-python/beacon.py @@ -36,8 +36,8 @@ # required field(s): name DataUseRequirementResource = { - 'name': u'string', - 'description': u'string' + 'name': u'example name', + 'description': u'example description' } # required field(s): variants @@ -46,10 +46,10 @@ 'samples': 1 # integer } -#required field(s): category +# required field(s): category DataUseResource = { - 'category': u'string', - 'description': u'string', + 'category': u'example use category', + 'description': u'example description', 'requirements': [ DataUseRequirementResource ] @@ -57,14 +57,10 @@ # required field(s): id DataSetResource = { - 'id': u'string', - 'description': u'string', - 'reference': u'string', + 'id': u'example Id', + 'description': u'dataset description', + 'reference': u'reference genome', 'size': DataSizeResource, # Dimensions of the data set (required if the beacon reports allele frequencies) - 'multiple': False, - 'datasets': [ - u'string' - ], 'data_uses': [ DataUseResource # Data use limitations ] @@ -74,11 +70,11 @@ # required field(s): allele, chromosome, position, reference QueryResource = { - 'allele': u'string', - 'chromosome': u'string', + 'allele': u'allele string', + 'chromosome': u'chromosome Id', 'position': 1, # integer - 'reference': u'string', - 'dataset_id': u'string' + 'reference': u'genome Id', + 'dataset_id': u'dataset Id' } ################### Beacon details ######################### @@ -89,13 +85,13 @@ 'name': u'bar', 'organization': u'org', 'api': u'0.1/0.2', - 'description': u'sample beacon', + 'description': u'beacon description', 'datasets': [ DataSetResource # Datasets served by the beacon ], 'homepage': u'http://dnastack.com/ga4gh/bob/', 'email': u'beacon@dnastack.com', - 'auth': u'string', # OAUTH2, defaults to none + 'auth': u'oauth2', # OAUTH2, defaults to none 'queries': [ QueryResource # Examples of interesting queries ] @@ -104,13 +100,13 @@ #--------------- Information endpoint (end) ----------------------# # info function -@app.route('/beacon-python/rest/info', methods=['GET']) +@app.route('/beacon-python/info', methods=['GET']) def info(): return jsonify(beacon) # query function # TODO: plug in the functionality of your beacon -@app.route('/beacon-python/rest/query', methods=['GET']) +@app.route('/beacon-python/query', methods=['GET']) def query(): # parse query chromosome = request.args.get('chrom') @@ -126,7 +122,7 @@ def query(): # required field(s): allele AlleleResource = { - 'allele': u'string', + 'allele': allele, 'frequency': 0.5 # double between 0 & 1 } @@ -134,8 +130,8 @@ def query(): # required field(s): name ErrorResource = { - 'name': u'string', - 'description': u'string' + 'name': u'error name/code', + 'description': u'error message' } ################### Response object ######################### @@ -144,22 +140,27 @@ def query(): # required field(s): exists response = { 'exists': True, - 'observed': '0', # min 0 + 'observed': 0, # integer, min 0 'alleles': [ AlleleResource ], - 'info': u'string', + 'info': u'response information', 'error': ErrorResource } #--------------------------------------------------------------# - return jsonify({ "beacon" : beacon, "query" : { 'chromosome' : chromosome, 'position' : position, 'allele' : allele, 'reference' : reference, 'dataset_id': dataset }, 'response' : response }) + return jsonify({ "beacon" : beacon['id'], "query" : { 'chromosome' : chromosome, 'position' : position, 'allele' : allele, 'reference' : reference, 'dataset_id': dataset }, 'response' : response }) + +# info function +@app.route('/beacon-python', methods=['GET']) +def welcome(): + return 'WELCOME!!! Beacon of Beacons Project (BoB) provides a unified REST API to publicly available GA4GH Beacons. BoB standardizes the way beacons are accessed and aggregates their results, thus addressing one of the missing parts of the Beacon project itself. BoB was designed with ease of programmatic access in mind. It provides XML, JSON and plaintext responses to accommodate needs of all the clients across all the programming languages. The API to use is determined using the header supplied by the client in its GET request, e.g.: "Accept: application/json".' -# errors in JSON +# page not found @app.errorhandler(404) def not_found(error): - return make_response(jsonify({'error': 'Not found'}), 404) + return 'Page not found (Bad URL)', 404 if __name__ == '__main__': app.run() From 5b704265d0521f5eb8b254a0659df62d547e7e57 Mon Sep 17 00:00:00 2001 From: mcupak Date: Fri, 13 Mar 2015 13:40:11 -0400 Subject: [PATCH 3/8] fixed cafe cardiokit beacon --- .../com/dnastack/bob/dao/BeaconDaoImpl.java | 13 ++--- .../bob/rest/BeaconResponsesTest.java | 2 +- .../com/dnastack/bob/rest/BeaconsTest.java | 2 +- .../bob/rest/CafeVariomeResponseTest.java | 56 +++++++++---------- 4 files changed, 36 insertions(+), 37 deletions(-) diff --git a/bob-data/src/main/java/com/dnastack/bob/dao/BeaconDaoImpl.java b/bob-data/src/main/java/com/dnastack/bob/dao/BeaconDaoImpl.java index ab3f593..f639b5e 100644 --- a/bob-data/src/main/java/com/dnastack/bob/dao/BeaconDaoImpl.java +++ b/bob-data/src/main/java/com/dnastack/bob/dao/BeaconDaoImpl.java @@ -125,9 +125,8 @@ private void setUpBeacons() { Beacon curoverse = new Beacon("curoverse", "PGP", integerBeaconizerService, true, "Curoverse"); Beacon curoverseRef = new Beacon("curoverse-ref", "GA4GH Example Data", integerBeaconizerService, true, "Curoverse"); -// Beacon cafeVariome = new Beacon("cafe-variome", "Cafe Variome", cafeVariomeService, true, "University of Leicester"); Beacon cafeVariomeCentral = new Beacon("cafe-central", "Cafe Variome", cafeVariomeService, true, "University of Leicester"); -// Beacon cafeCardioKit = new Beacon("cafe-cardiokit", "Cafe CardioKit", cafeVariomeService, true, "University of Leicester"); + Beacon cafeCardioKit = new Beacon("cafe-cardiokit", "Cafe CardioKit", cafeVariomeService, true, "University of Leicester"); // set up aggregators Beacon google = new Beacon("google", "Google Genomics Public Data", null, true, "Google"); @@ -135,9 +134,9 @@ private void setUpBeacons() { thousandGenomes.addAggregator(google); thousandGenomesPhase3.addAggregator(google); -// Beacon cafeVariome = new Beacon("cafe-variome", "Cafe Variome", null, true, "University of Leicester"); -// cafeVariomeCentral.addAggregator(cafeVariome); -// cafeCardioKit.addAggregator(cafeVariome); + Beacon cafeVariome = new Beacon("cafe-variome", "Cafe Variome", null, true, "University of Leicester"); + cafeVariomeCentral.addAggregator(cafeVariome); + cafeCardioKit.addAggregator(cafeVariome); Beacon broad = new Beacon("broad", "Broad Institute", broadInstituteService, true, "Broad Institute"); @@ -163,9 +162,9 @@ private void setUpBeacons() { beacons.add(curoverse); beacons.add(curoverseRef); -// beacons.add(cafeVariome); + beacons.add(cafeVariome); beacons.add(cafeVariomeCentral); -// beacons.add(cafeCardioKit); + beacons.add(cafeCardioKit); beacons.add(broad); diff --git a/bob-rest/src/test/java/com/dnastack/bob/rest/BeaconResponsesTest.java b/bob-rest/src/test/java/com/dnastack/bob/rest/BeaconResponsesTest.java index a0b33f2..d1a128c 100644 --- a/bob-rest/src/test/java/com/dnastack/bob/rest/BeaconResponsesTest.java +++ b/bob-rest/src/test/java/com/dnastack/bob/rest/BeaconResponsesTest.java @@ -58,7 +58,7 @@ public class BeaconResponsesTest extends BasicTest { public static final String QUERY_BEACON_WITH_REF_TEMPLATE = "rest/responses?beacon=%s&chrom=%s&pos=%s&allele=%s&ref=%s"; public static final String QUERY_TEMPLATE = "rest/responses?chrom=%s&pos=%s&allele=%s"; public static final String QUERY_WITH_REF_TEMPLATE = "rest/responses?chrom=%s&pos=%s&allele=%s&ref=%s"; - private static final Set BEACON_IDS = ImmutableSet.of("clinvar", "uniprot", "lovd", "ebi", "ncbi", "wtsi", "amplab", "kaviar", "broad", "icgc", "cafe-central", "bob"); + private static final Set BEACON_IDS = ImmutableSet.of("clinvar", "uniprot", "lovd", "ebi", "ncbi", "wtsi", "amplab", "kaviar", "broad", "icgc", "cafe-variome", "bob"); protected static String getUrl(String b, String[] params) { String res = null; diff --git a/bob-rest/src/test/java/com/dnastack/bob/rest/BeaconsTest.java b/bob-rest/src/test/java/com/dnastack/bob/rest/BeaconsTest.java index b8f95b3..e0d9fb7 100644 --- a/bob-rest/src/test/java/com/dnastack/bob/rest/BeaconsTest.java +++ b/bob-rest/src/test/java/com/dnastack/bob/rest/BeaconsTest.java @@ -54,7 +54,7 @@ public class BeaconsTest extends BasicTest { public static final String BEACONS_TEMPLATE = "rest/beacons"; public static final String BEACONS_FILTERED_TEMPLATE = "rest/beacons?beacon=%s"; public static final String BEACON_TEMPLATE = "rest/beacons/%s"; - public static final Set BEACON_IDS = ImmutableSet.of("clinvar", "uniprot", "lovd", "ebi", "ncbi", "wtsi", "amplab", "kaviar", "broad", "icgc", "cafe-central", "bob"); + public static final Set BEACON_IDS = ImmutableSet.of("clinvar", "uniprot", "lovd", "ebi", "ncbi", "wtsi", "amplab", "kaviar", "broad", "icgc", "cafe-variome", "bob"); public static String getUrl() { return BEACONS_TEMPLATE; diff --git a/bob-rest/src/test/java/com/dnastack/bob/rest/CafeVariomeResponseTest.java b/bob-rest/src/test/java/com/dnastack/bob/rest/CafeVariomeResponseTest.java index 94e3957..1ff0253 100644 --- a/bob-rest/src/test/java/com/dnastack/bob/rest/CafeVariomeResponseTest.java +++ b/bob-rest/src/test/java/com/dnastack/bob/rest/CafeVariomeResponseTest.java @@ -53,7 +53,7 @@ @RunAsClient public class CafeVariomeResponseTest extends AbstractResponseTest { - private static final String BEACON = "cafe-central"; + private static final String BEACON = "cafe-variome"; @Override @Test @@ -67,29 +67,29 @@ public void testAllRefsFound(@ArquillianResource URL url) throws JAXBException, assertTrue(br.getResponse()); } -// @Test -// public void testFoundCafeCardioKit(@ArquillianResource URL url) throws JAXBException, MalformedURLException { -// String b = "cafe-cardiokit"; -// String[] query = {"2", "179393691", "T", null}; -// BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(b, query)); -// -// assertNotNull(br); -// assertTrue(beaconsMatch(br.getBeacon(), b)); -// assertTrue(queriesMatch(br.getQuery(), query)); -// assertTrue(br.getResponse()); -// } - -// @Test -// public void testFoundCafeCentral(@ArquillianResource URL url) throws JAXBException, MalformedURLException { -// String b = "cafe-central"; -// String[] query = {"2", "179612321", "T", null}; -// BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(b, query)); -// -// assertNotNull(br); -// assertTrue(beaconsMatch(br.getBeacon(), b)); -// assertTrue(queriesMatch(br.getQuery(), query)); -// assertTrue(br.getResponse()); -// } + @Test + public void testFoundCafeCardioKit(@ArquillianResource URL url) throws JAXBException, MalformedURLException { + String b = "cafe-cardiokit"; + String[] query = {"2", "179393691", "T", null}; + BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(b, query)); + + assertNotNull(br); + assertTrue(beaconsMatch(br.getBeacon(), b)); + assertTrue(queriesMatch(br.getQuery(), query)); + assertTrue(br.getResponse()); + } + + @Test + public void testFoundCafeCentral(@ArquillianResource URL url) throws JAXBException, MalformedURLException { + String b = "cafe-central"; + String[] query = {"2", "179612321", "T", null}; + BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(b, query)); + + assertNotNull(br); + assertTrue(beaconsMatch(br.getBeacon(), b)); + assertTrue(queriesMatch(br.getQuery(), query)); + assertTrue(br.getResponse()); + } @Test @Override @@ -152,7 +152,7 @@ public void testStringAllele(@ArquillianResource URL url) throws JAXBException, assertTrue(queriesMatch(br.getQuery(), query)); // unsupported - assertNull(br.getResponse()); + assertTrue(br.getResponse() != true); } @Test @@ -166,7 +166,7 @@ public void testDel(@ArquillianResource URL url) throws JAXBException, Malformed assertTrue(queriesMatch(br.getQuery(), query)); // unsupported - assertNull(br.getResponse()); + assertTrue(br.getResponse() != true); } @Test @@ -180,7 +180,7 @@ public void testIns(@ArquillianResource URL url) throws JAXBException, Malformed assertTrue(queriesMatch(br.getQuery(), query)); // unsupported - assertNull(br.getResponse()); + assertTrue(br.getResponse() != true); } @Test @@ -269,7 +269,7 @@ public void testChromMT(@ArquillianResource URL url) throws JAXBException, Malfo assertTrue(queriesMatch(br.getQuery(), query)); // unsupported - assertNull(br.getResponse()); + assertTrue(br.getResponse() != true); } @Override From b697ce6e62b9cf94f99cecabd24543b020449e95 Mon Sep 17 00:00:00 2001 From: mcupak Date: Fri, 13 Mar 2015 18:09:47 -0400 Subject: [PATCH 4/8] [fixed #66] monitoring google beacons --- .../bob/rest/BeaconResponsesTest.java | 50 ++- .../dnastack/bob/rest/GoogleResponseTest.java | 291 ++++++++++++++++++ 2 files changed, 340 insertions(+), 1 deletion(-) create mode 100644 bob-rest/src/test/java/com/dnastack/bob/rest/GoogleResponseTest.java diff --git a/bob-rest/src/test/java/com/dnastack/bob/rest/BeaconResponsesTest.java b/bob-rest/src/test/java/com/dnastack/bob/rest/BeaconResponsesTest.java index d1a128c..e56c0a4 100644 --- a/bob-rest/src/test/java/com/dnastack/bob/rest/BeaconResponsesTest.java +++ b/bob-rest/src/test/java/com/dnastack/bob/rest/BeaconResponsesTest.java @@ -58,7 +58,7 @@ public class BeaconResponsesTest extends BasicTest { public static final String QUERY_BEACON_WITH_REF_TEMPLATE = "rest/responses?beacon=%s&chrom=%s&pos=%s&allele=%s&ref=%s"; public static final String QUERY_TEMPLATE = "rest/responses?chrom=%s&pos=%s&allele=%s"; public static final String QUERY_WITH_REF_TEMPLATE = "rest/responses?chrom=%s&pos=%s&allele=%s&ref=%s"; - private static final Set BEACON_IDS = ImmutableSet.of("clinvar", "uniprot", "lovd", "ebi", "ncbi", "wtsi", "amplab", "kaviar", "broad", "icgc", "cafe-variome", "bob"); + private static final Set BEACON_IDS = ImmutableSet.of("clinvar", "uniprot", "lovd", "ebi", "ncbi", "wtsi", "amplab", "kaviar", "broad", "icgc", "cafe-variome", "google", "thousandgenomes", "thousandgenomes-phase3", "platinum", "bob"); protected static String getUrl(String b, String[] params) { String res = null; @@ -287,6 +287,54 @@ public void testResponsesFilteredForBob(@ArquillianResource URL url) throws JAXB assertTrue(br.getResponse()); } + @Test + public void testResponsesFilteredForGoogle(@ArquillianResource URL url) throws JAXBException, MalformedURLException { + String b = "google"; + String[] q = {"9", "1795573", "G", null}; + BeaconResponseTo br = readResponses(url.toExternalForm() + getUrl(b, q)).get(0); + + assertNotNull(br); + assertTrue(beaconsMatch(br.getBeacon(), b)); + assertTrue(queriesMatch(br.getQuery(), q)); + assertTrue(br.getResponse()); + } + + @Test + public void testResponsesFilteredForThousandGenomes(@ArquillianResource URL url) throws JAXBException, MalformedURLException { + String b = "thousandgenomes"; + String[] q = {"9", "1795573", "G", null}; + BeaconResponseTo br = readResponses(url.toExternalForm() + getUrl(b, q)).get(0); + + assertNotNull(br); + assertTrue(beaconsMatch(br.getBeacon(), b)); + assertTrue(queriesMatch(br.getQuery(), q)); + assertTrue(br.getResponse()); + } + + @Test + public void testResponsesFilteredForThousandGenomesPhase3(@ArquillianResource URL url) throws JAXBException, MalformedURLException { + String b = "thousandgenomes-phase3"; + String[] q = {"16", "59180320", "G", null}; + BeaconResponseTo br = readResponses(url.toExternalForm() + getUrl(b, q)).get(0); + + assertNotNull(br); + assertTrue(beaconsMatch(br.getBeacon(), b)); + assertTrue(queriesMatch(br.getQuery(), q)); + assertTrue(br.getResponse()); + } + + @Test + public void testResponsesFilteredForPlatinum(@ArquillianResource URL url) throws JAXBException, MalformedURLException { + String b = "platinum"; + String[] q = {"5", "145125627", "G", null}; + BeaconResponseTo br = readResponses(url.toExternalForm() + getUrl(b, q)).get(0); + + assertNotNull(br); + assertTrue(beaconsMatch(br.getBeacon(), b)); + assertTrue(queriesMatch(br.getQuery(), q)); + assertTrue(br.getResponse()); + } + @Test public void testMultipleResponsesFiltered(@ArquillianResource URL url) throws JAXBException, MalformedURLException { String id1 = "amplab"; diff --git a/bob-rest/src/test/java/com/dnastack/bob/rest/GoogleResponseTest.java b/bob-rest/src/test/java/com/dnastack/bob/rest/GoogleResponseTest.java new file mode 100644 index 0000000..9f1dc11 --- /dev/null +++ b/bob-rest/src/test/java/com/dnastack/bob/rest/GoogleResponseTest.java @@ -0,0 +1,291 @@ +/* + * The MIT License + * + * Copyright 2014 DNAstack. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ +package com.dnastack.bob.rest; + +import com.dnastack.bob.dto.BeaconResponseTo; +import com.dnastack.bob.dto.ReferenceTo; +import java.net.MalformedURLException; +import java.net.URL; +import javax.xml.bind.JAXBException; +import org.jboss.arquillian.container.test.api.RunAsClient; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.arquillian.test.api.ArquillianResource; +import org.junit.Test; +import org.junit.runner.RunWith; + +import static com.dnastack.bob.rest.util.BeaconResponseTestUtils.beaconsMatch; +import static com.dnastack.bob.rest.util.BeaconResponseTestUtils.getNonMachingFields; +import static com.dnastack.bob.rest.util.BeaconResponseTestUtils.queriesMatch; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; + +/** + * Test of Google beaconizer services. + * + * @author Miroslav Cupak (mirocupak@gmail.com) + * @version 1.0 + */ +@RunWith(Arquillian.class) +@RunAsClient +public class GoogleResponseTest extends AbstractResponseTest { + + private static final String BEACON = "google"; + + @Override + @Test + public void testAllRefsFound(@ArquillianResource URL url) throws JAXBException, MalformedURLException { + String[] query = {"9", "1795573", "G", null}; + BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); + + assertNotNull(br); + assertTrue(beaconsMatch(br.getBeacon(), BEACON)); + assertTrue(queriesMatch(br.getQuery(), query)); + assertTrue(br.getResponse()); + } + + @Test + public void testFoundPlatinum(@ArquillianResource URL url) throws JAXBException, MalformedURLException { + String b = "platinum"; + String[] query = {"5", "145125627", "G", null}; + BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(b, query)); + + assertNotNull(br); + assertTrue(beaconsMatch(br.getBeacon(), b)); + assertTrue(queriesMatch(br.getQuery(), query)); + assertTrue(br.getResponse()); + } + + @Test + public void testFoundThousandGenomes(@ArquillianResource URL url) throws JAXBException, MalformedURLException { + String b = "thousandgenomes"; + String[] query = {"9", "1795573", "G", null}; + BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(b, query)); + + assertNotNull(br); + assertTrue(beaconsMatch(br.getBeacon(), b)); + assertTrue(queriesMatch(br.getQuery(), query)); + assertTrue(br.getResponse()); + } + + @Test + public void testFoundThousandGenomesPhase3(@ArquillianResource URL url) throws JAXBException, MalformedURLException { + String b = "thousandgenomes-phase3"; + String[] query = {"16", "59180320", "G", null}; + BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(b, query)); + + assertNotNull(br); + assertTrue(beaconsMatch(br.getBeacon(), b)); + assertTrue(queriesMatch(br.getQuery(), query)); + assertTrue(br.getResponse()); + } + + @Test + @Override + public void testSpecificRefFound(@ArquillianResource URL url) throws JAXBException, MalformedURLException { + String[] query = {"16", "59180320", "G", "hg19"}; + BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); + + assertNotNull(br); + assertTrue(beaconsMatch(br.getBeacon(), BEACON)); + assertTrue(queriesMatch(br.getQuery(), query)); + assertTrue(br.getResponse()); + } + + @Test + @Override + public void testSpecificRefNotFound(@ArquillianResource URL url) throws JAXBException, MalformedURLException { + String[] query = {"16", "59180320", "G", "hg38"}; + BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); + + assertNotNull(br); + assertTrue(beaconsMatch(br.getBeacon(), BEACON)); + assertTrue(queriesMatch(br.getQuery(), query)); + assertTrue(br.getResponse() == null || !br.getResponse()); + } + + @Test + @Override + public void testInvalidRef(@ArquillianResource URL url) throws JAXBException, MalformedURLException { + String[] query = {"17", "41197712", "G", "hg100"}; + BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); + + assertNotNull(br); + assertTrue(beaconsMatch(br.getBeacon(), BEACON)); + assertTrue(getNonMachingFields(br.getQuery(), query).size() == 1); + assertEquals(br.getQuery().getReference(), null); + assertNull(br.getResponse()); + } + + @Test + @Override + public void testRefConversion(@ArquillianResource URL url) throws JAXBException, MalformedURLException { + String[] query = {"17", "41197712", "G", "grch37"}; + BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); + + assertNotNull(br); + assertTrue(beaconsMatch(br.getBeacon(), BEACON)); + assertTrue(getNonMachingFields(br.getQuery(), query).size() == 1); + assertEquals(br.getQuery().getReference(), ReferenceTo.HG19); + assertNotNull(br.getResponse()); + } + + @Test + @Override + public void testStringAllele(@ArquillianResource URL url) throws JAXBException, MalformedURLException { + String[] query = {"17", "41197712", "TGT", null}; + BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); + + assertNotNull(br); + assertTrue(beaconsMatch(br.getBeacon(), BEACON)); + assertTrue(queriesMatch(br.getQuery(), query)); + + // unsupported + assertNotNull(br.getResponse()); + } + + @Test + @Override + public void testDel(@ArquillianResource URL url) throws JAXBException, MalformedURLException { + String[] query = {"17", "41197712", "D", null}; + BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); + + assertNotNull(br); + assertTrue(beaconsMatch(br.getBeacon(), BEACON)); + assertTrue(queriesMatch(br.getQuery(), query)); + + // unsupported + assertNotNull(br.getResponse()); + } + + @Test + @Override + public void testIns(@ArquillianResource URL url) throws JAXBException, MalformedURLException { + String[] query = {"17", "41197712", "I", null}; + BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); + + assertNotNull(br); + assertTrue(beaconsMatch(br.getBeacon(), BEACON)); + assertTrue(queriesMatch(br.getQuery(), query)); + + // unsupported + assertNotNull(br.getResponse()); + } + + @Test + @Override + public void testAllRefsNotFound(@ArquillianResource URL url) throws JAXBException, MalformedURLException { + String[] query = {"1", "41197713", "G", null}; + BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); + + assertNotNull(br); + assertTrue(beaconsMatch(br.getBeacon(), BEACON)); + assertTrue(queriesMatch(br.getQuery(), query)); + assertFalse(br.getResponse()); + } + + @Test + @Override + public void testInvalidAllele(@ArquillianResource URL url) throws JAXBException, MalformedURLException { + String[] query = {"17", "41197712", "DC", null}; + BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); + + assertNotNull(br); + assertTrue(beaconsMatch(br.getBeacon(), BEACON)); + assertTrue(getNonMachingFields(br.getQuery(), query).size() == 1); + assertNull(br.getQuery().getAllele()); + assertNull(br.getResponse()); + } + + @Test + @Override + public void testAlleleConversion(@ArquillianResource URL url) throws JAXBException, MalformedURLException { + String[] query = {"17", "41197712", "g", null}; + BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); + + assertNotNull(br); + assertTrue(beaconsMatch(br.getBeacon(), BEACON)); + assertTrue(getNonMachingFields(br.getQuery(), query).size() == 1); + assertEquals(query[2].toUpperCase(), br.getQuery().getAllele()); + assertNotNull(br.getResponse()); + } + + @Test + @Override + public void testChromConversion(@ArquillianResource URL url) throws JAXBException, MalformedURLException { + String[] query = {"chrom17", "41197712", "G", null}; + BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); + + assertNotNull(br); + assertTrue(beaconsMatch(br.getBeacon(), BEACON)); + assertTrue((getNonMachingFields(br.getQuery(), query).size() == 1) && (getNonMachingFields(br.getQuery(), query).contains(0))); + assertNotNull(br.getResponse()); + } + + @Test + @Override + public void testInvalidChrom(@ArquillianResource URL url) throws JAXBException, MalformedURLException { + String[] query = {"30", "41087870", "A", null}; + BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); + + assertNotNull(br); + assertTrue(beaconsMatch(br.getBeacon(), BEACON)); + assertTrue(getNonMachingFields(br.getQuery(), query).size() == 1); + assertNull(br.getQuery().getChromosome()); + assertNull(br.getResponse()); + } + + @Test + @Override + public void testChromX(@ArquillianResource URL url) throws JAXBException, MalformedURLException { + String[] query = {"X", "31224684", "C", null}; + BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); + + assertNotNull(br); + assertTrue(beaconsMatch(br.getBeacon(), BEACON)); + assertTrue(queriesMatch(br.getQuery(), query)); + assertNotNull(br.getResponse()); + } + + @Test + @Override + public void testChromMT(@ArquillianResource URL url) throws JAXBException, MalformedURLException { + String[] query = {"MT", "41087870", "A", null}; + BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); + + assertNotNull(br); + assertTrue(beaconsMatch(br.getBeacon(), BEACON)); + assertTrue(queriesMatch(br.getQuery(), query)); + + // unsupported + assertNotNull(br.getResponse()); + } + + @Override + public void testDifferentGenome(URL url) throws JAXBException, MalformedURLException { + // intentionally empty + } +} From f5009d1feef9157325c565adb115df15a9346dc5 Mon Sep 17 00:00:00 2001 From: rohan katyal Date: Sat, 14 Mar 2015 15:54:11 +0530 Subject: [PATCH 5/8] [FIX #51] update node.js BDK to API 0.2 update BDK to API 0.2 removed /rest from endpoints added sample welcome page for /beacon-nodejs --- beacon-adapters/beacon-nodejs/beacon.js | 136 +++++++++++++++++++++--- 1 file changed, 124 insertions(+), 12 deletions(-) mode change 100755 => 100644 beacon-adapters/beacon-nodejs/beacon.js diff --git a/beacon-adapters/beacon-nodejs/beacon.js b/beacon-adapters/beacon-nodejs/beacon.js old mode 100755 new mode 100644 index a559d69..43c8e1b --- a/beacon-adapters/beacon-nodejs/beacon.js +++ b/beacon-adapters/beacon-nodejs/beacon.js @@ -23,9 +23,76 @@ */ var restify = require('restify'); -// beacon details +//--------------- Information endpont (start) --------------------// + // TODO: override with the details of your beacon -var beacon = {'description': 'sample beacon', 'id': 'foo', 'name': 'bar', 'organization': 'org'}; + +//############# DataSetResource for beacon details ############// + +// required field(s): name +var DataUseRequirementResource = { + 'name': 'example name', + 'description': 'example description' +}; + +// required field(s): variants +var DataSizeResource = { + 'variants': 1, // integer + 'samples': 1 // integer +}; + +// required field(s): category +var DataUseResource = { + 'category': 'example use category', + 'description': 'example description', + 'requirements': [ + DataUseRequirementResource + ] +}; + +// required field(s): id +var DataSetResource = { + 'id': 'example Id', + 'description': 'dataset description', + 'reference': 'reference genome', + 'size': DataSizeResource, // Dimensions of the data set (required if the beacon reports allele frequencies) + 'data_uses': [ + DataUseResource // Data use limitations + ] +}; + +//########## QueryResource for beacon details ###############// + +// required field(s): allele, chromosome, position, reference +var QueryResource = { + 'allele': 'allele string', + 'chromosome': 'chromosome Id', + 'position': 1, // integer + 'reference': 'genome Id', + 'dataset_id': 'dataset Id' +}; + +//################## Beacon details #########################// + +// required field(s): id, name, organization, api +var beacon = { + 'id': 'foo', + 'name': 'bar', + 'organization': 'org', + 'api': '0.1/0.2', + 'description': 'beacon description', + 'datasets': [ + DataSetResource // Datasets served by the beacon + ], + 'homepage': 'http://dnastack.com/ga4gh/bob/', + 'email': 'beacon@dnastack.com', + 'auth': 'oauth2', // OAUTH2, defaults to none + 'queries': [ + QueryResource // Examples of interesting queries + ] +}; + +//--------------- Information endpoint (end) ----------------------// // info function function info(req, res, next) { @@ -36,26 +103,71 @@ function info(req, res, next) { // query function // TODO: plug in your data/functionality here function query(req, res, next) { + // parse query - chromosome = req.query.chrom; - position = parseInt(req.query.pos); - allele = req.query.allele; - reference = req.query.ref; - query = {'chromosome': chromosome, 'position': position, 'allele': allele, 'reference': reference}; + var chromosome = req.query.chrom; + var position = parseInt(req.query.pos); + var allele = req.query.allele; + var reference = req.query.ref; + var dataset = req.query.dataset; + if (dataset == undefined) { + dataset = beacon['datasets'][0]['id']; + } + +//---- TODO: override with the necessary response details ----// + +//############# AlleleResource for response ##############// + + // required field(s): allele + var AlleleResource = { + 'allele': allele, + 'frequency': 0.5 // double between 0 & 1 + }; + +//############ ErrorResource for response #################// + + // required field(s): name + var ErrorResource = { + 'name': 'error name/code', + 'description': 'error message' + }; + +//################## Response object ########################// + // generate response - response = true; + // required field(s): exists + var response = { + 'exists': 'True', + 'observed': 0, // integer, min 0 + 'alleles': [ + AlleleResource + ], + 'info': 'response information', + 'error': ErrorResource + }; + +//--------------------------------------------------------------// + + var query = {'chromosome': chromosome, 'position': position, 'allele': allele, 'reference': reference, 'dataset': dataset}; res.send({"beacon": beacon, "query": query, 'response': response}); next(); } +function welcome(req, res, next) { + var message = 'WELCOME!!! Beacon of Beacons Project (BoB) provides a unified REST API to publicly available GA4GH Beacons. BoB standardizes the way beacons are accessed and aggregates their results, thus addressing one of the missing parts of the Beacon project itself. BoB was designed with ease of programmatic access in mind. It provides XML, JSON and plaintext responses to accommodate needs of all the clients across all the programming languages. The API to use is determined using the header supplied by the client in its GET request, e.g.: "Accept: application/json".'; + res.send(message); + next(); +} + var server = restify.createServer({name: 'beacon'}); server.use(restify.queryParser()); -server.get('/beacon-nodejs/rest/info', info); -server.head('/beacon-nodejs/rest/info', info); -server.get('/beacon-nodejs/rest/query', query); -server.head('/beacon-nodejs/rest/query', query); +server.get('/beacon-nodejs/info', info); +server.head('/beacon-nodejs/info', info); +server.get('/beacon-nodejs/query', query); +server.head('/beacon-nodejs/query', query); +server.get('/beacon-nodejs', welcome); server.listen(8080, function () { console.log('%s listening at %s', server.name, server.url); From 435c422af73241cd3c595ab6db88524b7ab8b252 Mon Sep 17 00:00:00 2001 From: rohan katyal Date: Mon, 16 Mar 2015 19:42:30 +0530 Subject: [PATCH 6/8] [FIX #52] Update Java BDK to beacon 0.2 API update BDK to API 0.2 removed /rest from endpoints --- .../com/dnastack/beacon/entity/Beacon.java | 98 ++++++++++++++++++- .../beacon/entity/BeaconResponse.java | 36 ++++--- .../com/dnastack/beacon/entity/Query.java | 20 +++- .../entity/resources/AlleleResource.java | 36 +++++++ .../entity/resources/DataSetResource.java | 67 +++++++++++++ .../entity/resources/DataSizeResource.java | 41 ++++++++ .../resources/DataUseRequirementResource.java | 37 +++++++ .../entity/resources/DataUseResource.java | 54 ++++++++++ .../entity/resources/ErrorResource.java | 35 +++++++ .../entity/resources/QueryResource.java | 65 ++++++++++++ .../entity/resources/ResponseResource.java | 68 +++++++++++++ .../beacon/rest/BeaconApplication.java | 2 +- .../dnastack/beacon/rest/BeaconResource.java | 4 +- .../beacon/service/BeaconService.java | 3 +- .../beacon/service/SampleBeaconService.java | 28 ++++-- .../com/dnastack/beacon/util/QueryUtils.java | 5 +- 16 files changed, 564 insertions(+), 35 deletions(-) create mode 100644 beacon-adapters/beacon-java/src/main/java/com/dnastack/beacon/entity/resources/AlleleResource.java create mode 100644 beacon-adapters/beacon-java/src/main/java/com/dnastack/beacon/entity/resources/DataSetResource.java create mode 100644 beacon-adapters/beacon-java/src/main/java/com/dnastack/beacon/entity/resources/DataSizeResource.java create mode 100644 beacon-adapters/beacon-java/src/main/java/com/dnastack/beacon/entity/resources/DataUseRequirementResource.java create mode 100644 beacon-adapters/beacon-java/src/main/java/com/dnastack/beacon/entity/resources/DataUseResource.java create mode 100644 beacon-adapters/beacon-java/src/main/java/com/dnastack/beacon/entity/resources/ErrorResource.java create mode 100644 beacon-adapters/beacon-java/src/main/java/com/dnastack/beacon/entity/resources/QueryResource.java create mode 100644 beacon-adapters/beacon-java/src/main/java/com/dnastack/beacon/entity/resources/ResponseResource.java diff --git a/beacon-adapters/beacon-java/src/main/java/com/dnastack/beacon/entity/Beacon.java b/beacon-adapters/beacon-java/src/main/java/com/dnastack/beacon/entity/Beacon.java index 9c896e9..cc0744b 100644 --- a/beacon-adapters/beacon-java/src/main/java/com/dnastack/beacon/entity/Beacon.java +++ b/beacon-adapters/beacon-java/src/main/java/com/dnastack/beacon/entity/Beacon.java @@ -24,9 +24,16 @@ package com.dnastack.beacon.entity; import java.io.Serializable; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; import java.util.Objects; + import javax.xml.bind.annotation.XmlRootElement; +import com.dnastack.beacon.entity.resources.DataSetResource; +import com.dnastack.beacon.entity.resources.QueryResource; + /** * Beacon. * @@ -42,18 +49,79 @@ public class Beacon implements Serializable { private String name; private String organization; private String description; + private String api; + private String homepage; + private String email; + private String auth = null; + + private List queries; + private List datasets; public Beacon() { // needed for JAXB } - public Beacon(String id, String name, String organization, String description) { - this.id = id; + public Beacon(String id, String name, String organization, String description, String api, String homepage, String email, String auth, List queries, List datasets) { + this.id = id; this.name = name; this.organization = organization; this.description = description; + this.api = api; + this.homepage = homepage; + this.email = email; + this.auth = auth; + this.queries = queries; + this.datasets = datasets; } + public String getApi() { + return api; + } + + public void setApi(String api) { + this.api = api; + } + + public String getHomepage() { + return homepage; + } + + public void setHomepage(String homepage) { + this.homepage = homepage; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public String getAuth() { + return auth; + } + + public void setAuth(String auth) { + this.auth = auth; + } + + public List getQueries() { + return queries; + } + + public void setQueries(List queries) { + this.queries = queries; + } + + public List getDatasets() { + return datasets; + } + + public void setDatasets(List datasets) { + this.datasets = datasets; + } + public String getId() { return id; } @@ -93,6 +161,12 @@ public int hashCode() { hash = 61 * hash + Objects.hashCode(this.name); hash = 61 * hash + Objects.hashCode(this.organization); hash = 61 * hash + Objects.hashCode(this.description); + hash = 61 * hash + Objects.hashCode(this.api); + hash = 61 * hash + Objects.hashCode(this.homepage); + hash = 61 * hash + Objects.hashCode(this.email); + hash = 61 * hash + Objects.hashCode(this.auth); + hash = 61 * hash + Objects.hashCode(this.queries); + hash = 61 * hash + Objects.hashCode(this.datasets); return hash; } @@ -117,12 +191,30 @@ public boolean equals(Object obj) { if (!Objects.equals(this.description, other.description)) { return false; } + if (!Objects.equals(this.api, other.api)) { + return false; + } + if (!Objects.equals(this.homepage, other.homepage)) { + return false; + } + if (!Objects.equals(this.email, other.email)) { + return false; + } + if (!Objects.equals(this.auth, other.auth)) { + return false; + } + if (!Objects.equals(this.queries, other.queries)) { + return false; + } + if (!Objects.equals(this.datasets, other.datasets)) { + return false; + } return true; } @Override public String toString() { - return "Beacon{" + "id=" + id + ", name=" + name + ", organization=" + organization + ", description=" + description + '}'; + return "Beacon{" + "id=" + id + ", name=" + name + ", organization=" + organization + ", description=" + description + ", api=" + api + ", homepage=" + ", email=" + email + ", auth=" + auth + " + " + ", queries=" + queries + ", datasets=" + datasets + "}"; } } diff --git a/beacon-adapters/beacon-java/src/main/java/com/dnastack/beacon/entity/BeaconResponse.java b/beacon-adapters/beacon-java/src/main/java/com/dnastack/beacon/entity/BeaconResponse.java index 5d188b3..759beba 100644 --- a/beacon-adapters/beacon-java/src/main/java/com/dnastack/beacon/entity/BeaconResponse.java +++ b/beacon-adapters/beacon-java/src/main/java/com/dnastack/beacon/entity/BeaconResponse.java @@ -24,8 +24,12 @@ package com.dnastack.beacon.entity; import java.io.Serializable; +import java.util.Objects; + import javax.xml.bind.annotation.XmlRootElement; +import com.dnastack.beacon.entity.resources.ResponseResource; + /** * Beacon response. * @@ -37,29 +41,29 @@ public class BeaconResponse implements Serializable { private static final long serialVersionUID = 54L; - private Beacon beacon; + private String beacon_id; private Query query; - private Boolean response = null; + private ResponseResource response = null; public BeaconResponse() { // needed for JAXB } - public BeaconResponse(Beacon beacon, Query query, Boolean response) { - this.beacon = beacon; + public BeaconResponse(String beacon_id, Query query, ResponseResource response) { + this.beacon_id = beacon_id; this.query = query; this.response = response; } - public Beacon getBeacon() { - return beacon; - } + public String getBeacon_id() { + return beacon_id; + } - public void setBeacon(Beacon beacon) { - this.beacon = beacon; - } + public void setBeacon_id(String beacon_id) { + this.beacon_id = beacon_id; + } - public Query getQuery() { + public Query getQuery() { return query; } @@ -67,18 +71,18 @@ public void setQuery(Query query) { this.query = query; } - public Boolean getResponse() { + public ResponseResource getResponse() { return response; } - public void setResponse(Boolean response) { + public void setResponse(ResponseResource response) { this.response = response; } @Override public int hashCode() { int hash = 7; - hash = 41 * hash + (this.beacon != null ? this.beacon.hashCode() : 0); + hash = 41 * hash + Objects.hashCode(this.beacon_id); hash = 41 * hash + (this.query != null ? this.query.hashCode() : 0); hash = 41 * hash + (this.response != null ? this.response.hashCode() : 0); return hash; @@ -93,7 +97,7 @@ public boolean equals(Object obj) { return false; } final BeaconResponse other = (BeaconResponse) obj; - if (this.beacon != other.beacon && (this.beacon == null || !this.beacon.equals(other.beacon))) { + if (this.beacon_id != other.beacon_id && (this.beacon_id == null || !this.beacon_id.equals(other.beacon_id))) { return false; } if (this.query != other.query && (this.query == null || !this.query.equals(other.query))) { @@ -107,7 +111,7 @@ public boolean equals(Object obj) { @Override public String toString() { - return "Response of '" + beacon + "' to '" + query + "': '" + response + "'"; + return "Response of '" + beacon_id + "' to '" + query + "': '" + response + "'"; } } diff --git a/beacon-adapters/beacon-java/src/main/java/com/dnastack/beacon/entity/Query.java b/beacon-adapters/beacon-java/src/main/java/com/dnastack/beacon/entity/Query.java index 2ab9be0..89792b8 100644 --- a/beacon-adapters/beacon-java/src/main/java/com/dnastack/beacon/entity/Query.java +++ b/beacon-adapters/beacon-java/src/main/java/com/dnastack/beacon/entity/Query.java @@ -42,16 +42,18 @@ public class Query implements Serializable { private Long position; private String allele; private Reference reference; + private String dataset; public Query() { // needed for JAXB } - public Query(Chromosome chromosome, Long position, String allele, Reference reference) { + public Query(Chromosome chromosome, Long position, String allele, Reference reference, String dataset) { this.chromosome = chromosome; this.position = position; this.allele = allele; this.reference = reference; + this.dataset = dataset; } public Chromosome getChromosome() { @@ -86,13 +88,22 @@ public void setReference(Reference reference) { this.reference = reference; } - @Override + public String getDataset() { + return dataset; + } + + public void setDataset(String dataset) { + this.dataset = dataset; + } + + @Override public int hashCode() { int hash = 3; hash = 89 * hash + Objects.hashCode(this.chromosome); hash = 89 * hash + Objects.hashCode(this.position); hash = 89 * hash + Objects.hashCode(this.allele); hash = 89 * hash + Objects.hashCode(this.reference); + hash = 89 * hash + Objects.hashCode(this.dataset); return hash; } @@ -117,12 +128,15 @@ public boolean equals(Object obj) { if (this.reference != other.reference) { return false; } + if (this.dataset != other.dataset) { + return false; + } return true; } @Override public String toString() { - return "Query{" + "chromosome=" + chromosome + ", position=" + position + ", allele=" + allele + ", reference=" + reference + '}'; + return "Query{" + "chromosome=" + chromosome + ", position=" + position + ", allele=" + allele + ", reference=" + reference + ", dataset=" + dataset + '}'; } } diff --git a/beacon-adapters/beacon-java/src/main/java/com/dnastack/beacon/entity/resources/AlleleResource.java b/beacon-adapters/beacon-java/src/main/java/com/dnastack/beacon/entity/resources/AlleleResource.java new file mode 100644 index 0000000..9ad6088 --- /dev/null +++ b/beacon-adapters/beacon-java/src/main/java/com/dnastack/beacon/entity/resources/AlleleResource.java @@ -0,0 +1,36 @@ +package com.dnastack.beacon.entity.resources; + +public class AlleleResource { + + private String allele; + private Double frequency; + + public AlleleResource() { + // needed for JAXB + } + + /* + * Required field(s): allele + * frequency is a double between 0 & 1 + */ + public AlleleResource(String allele, Double frequency) { + this.allele = allele; + this.frequency = frequency; + } + + public String getAllele() { + return allele; + } + + public void setAllele(String allele) { + this.allele = allele; + } + + public Double getFrequency() { + return frequency; + } + + public void setFrequency(Double frequency) { + this.frequency = frequency; + } +} diff --git a/beacon-adapters/beacon-java/src/main/java/com/dnastack/beacon/entity/resources/DataSetResource.java b/beacon-adapters/beacon-java/src/main/java/com/dnastack/beacon/entity/resources/DataSetResource.java new file mode 100644 index 0000000..05fc47d --- /dev/null +++ b/beacon-adapters/beacon-java/src/main/java/com/dnastack/beacon/entity/resources/DataSetResource.java @@ -0,0 +1,67 @@ +package com.dnastack.beacon.entity.resources; + +import java.util.List; + +public class DataSetResource { + + private String id; + private String description; + private String reference; + private DataSizeResource size; + private List data_uses; + + public DataSetResource() { + // needed for JAXB + } + + /* + * required field(s): id + */ + public DataSetResource(String id, String description, String reference, DataSizeResource size, List data_uses) { + this.id = id; + this.description = description; + this.reference = reference; + this.size = size; + this.data_uses = data_uses; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getReference() { + return reference; + } + + public void setReference(String reference) { + this.reference = reference; + } + + public DataSizeResource getSize() { + return size; + } + + public void setSize(DataSizeResource size) { + this.size = size; + } + + public List getData_uses() { + return data_uses; + } + + public void setData_uses(List data_uses) { + this.data_uses = data_uses; + } +} diff --git a/beacon-adapters/beacon-java/src/main/java/com/dnastack/beacon/entity/resources/DataSizeResource.java b/beacon-adapters/beacon-java/src/main/java/com/dnastack/beacon/entity/resources/DataSizeResource.java new file mode 100644 index 0000000..b97f8b3 --- /dev/null +++ b/beacon-adapters/beacon-java/src/main/java/com/dnastack/beacon/entity/resources/DataSizeResource.java @@ -0,0 +1,41 @@ +package com.dnastack.beacon.entity.resources; + +/* + * Dimensions of the data set (required if the beacon reports allele frequencies) + */ +public class DataSizeResource { + + private Integer variants; + private Integer samples; + + public DataSizeResource() { + // needed for JAXB + } + + /* + * required field(s): variants + */ + public DataSizeResource(Integer variants, Integer samples) { + this.variants = variants; + this.samples = samples; + } + + public Integer getVariants() { + return variants; + } + + public void setVariants(Integer variants) { + this.variants = variants; + } + + public Integer getSamples() { + return samples; + } + + public void setSamples(Integer samples) { + this.samples = samples; + } + + + +} diff --git a/beacon-adapters/beacon-java/src/main/java/com/dnastack/beacon/entity/resources/DataUseRequirementResource.java b/beacon-adapters/beacon-java/src/main/java/com/dnastack/beacon/entity/resources/DataUseRequirementResource.java new file mode 100644 index 0000000..70e0b2b --- /dev/null +++ b/beacon-adapters/beacon-java/src/main/java/com/dnastack/beacon/entity/resources/DataUseRequirementResource.java @@ -0,0 +1,37 @@ +package com.dnastack.beacon.entity.resources; + +public class DataUseRequirementResource { + + private String name; + private String description; + + public DataUseRequirementResource() { + // needed for JAXB + } + + + /* + * required field(s): name + */ + public DataUseRequirementResource(String name, String description) { + this.name = name; + this.description = description; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + +} diff --git a/beacon-adapters/beacon-java/src/main/java/com/dnastack/beacon/entity/resources/DataUseResource.java b/beacon-adapters/beacon-java/src/main/java/com/dnastack/beacon/entity/resources/DataUseResource.java new file mode 100644 index 0000000..1d43f42 --- /dev/null +++ b/beacon-adapters/beacon-java/src/main/java/com/dnastack/beacon/entity/resources/DataUseResource.java @@ -0,0 +1,54 @@ +package com.dnastack.beacon.entity.resources; + +import java.util.List; + + +/* + * Data use limitations + */ +public class DataUseResource { + + private String category; + private String description; + private List requirements; + + public DataUseResource() { + // needed for JAXB + } + + /* + * required field(s): category + */ + public DataUseResource(String category, String description, List requirements) { + this.category = category; + this.description = description; + this.requirements = requirements; + } + + public String getCategory() { + return category; + } + + public void setCategory(String category) { + this.category = category; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public List getRequirements() { + return requirements; + } + + public void setRequirements(List requirements) { + this.requirements = requirements; + } + + + +} diff --git a/beacon-adapters/beacon-java/src/main/java/com/dnastack/beacon/entity/resources/ErrorResource.java b/beacon-adapters/beacon-java/src/main/java/com/dnastack/beacon/entity/resources/ErrorResource.java new file mode 100644 index 0000000..47ddce6 --- /dev/null +++ b/beacon-adapters/beacon-java/src/main/java/com/dnastack/beacon/entity/resources/ErrorResource.java @@ -0,0 +1,35 @@ +package com.dnastack.beacon.entity.resources; + +public class ErrorResource { + + private String name; + private String description; + + public ErrorResource() { + // needed for JAXB + } + + /* + * required field(s): name + */ + public ErrorResource(String name, String description) { + this.name = name; + this.description = description; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } +} diff --git a/beacon-adapters/beacon-java/src/main/java/com/dnastack/beacon/entity/resources/QueryResource.java b/beacon-adapters/beacon-java/src/main/java/com/dnastack/beacon/entity/resources/QueryResource.java new file mode 100644 index 0000000..534bc72 --- /dev/null +++ b/beacon-adapters/beacon-java/src/main/java/com/dnastack/beacon/entity/resources/QueryResource.java @@ -0,0 +1,65 @@ +package com.dnastack.beacon.entity.resources; + +public class QueryResource { + + private String allele; + private String chromosome; + private Integer position; + private String reference; + private String dataset_id; + + /* + * required field(s): allele, chromosome, position, reference + */ + public QueryResource(String allele, String chromosome, Integer position, String reference, String dataset_id) { + this.allele = allele; + this.chromosome = chromosome; + this.position = position; + this.reference = reference; + this.dataset_id = dataset_id; + } + + public QueryResource() { + // needed for JAXB + } + + public String getAllele() { + return allele; + } + + public void setAllele(String allele) { + this.allele = allele; + } + + public String getChromosome() { + return chromosome; + } + + public void setChromosome(String chromosome) { + this.chromosome = chromosome; + } + + public Integer getPosition() { + return position; + } + + public void setPosition(Integer position) { + this.position = position; + } + + public String getReference() { + return reference; + } + + public void setReference(String reference) { + this.reference = reference; + } + + public String getDataset_id() { + return dataset_id; + } + + public void setDataset_id(String dataset_id) { + this.dataset_id = dataset_id; + } +} diff --git a/beacon-adapters/beacon-java/src/main/java/com/dnastack/beacon/entity/resources/ResponseResource.java b/beacon-adapters/beacon-java/src/main/java/com/dnastack/beacon/entity/resources/ResponseResource.java new file mode 100644 index 0000000..34f266d --- /dev/null +++ b/beacon-adapters/beacon-java/src/main/java/com/dnastack/beacon/entity/resources/ResponseResource.java @@ -0,0 +1,68 @@ +package com.dnastack.beacon.entity.resources; + +import java.util.List; + +public class ResponseResource { + + private String exists; + private Integer observed; + private List alleles; + private String info; + private ErrorResource error; + + /* + * required field(s): exists + * observed is an Integer with min value 0 + */ + public ResponseResource(String exists, Integer observed, List alleles, String info, ErrorResource error) { + this.exists = exists; + this.observed = observed; + this.alleles = alleles; + this.info = info; + this.error = error; + } + + public ResponseResource() { + // needed for JAXB + } + + public String getExists() { + return exists; + } + + public void setExists(String exists) { + this.exists = exists; + } + + public Integer getObserved() { + return observed; + } + + public void setObserved(Integer observed) { + this.observed = observed; + } + + public List getAlleles() { + return alleles; + } + + public void setAlleles(List alleles) { + this.alleles = alleles; + } + + public String getInfo() { + return info; + } + + public void setInfo(String info) { + this.info = info; + } + + public ErrorResource getError() { + return error; + } + + public void setError(ErrorResource error) { + this.error = error; + } +} diff --git a/beacon-adapters/beacon-java/src/main/java/com/dnastack/beacon/rest/BeaconApplication.java b/beacon-adapters/beacon-java/src/main/java/com/dnastack/beacon/rest/BeaconApplication.java index 0b8633e..367e8bf 100644 --- a/beacon-adapters/beacon-java/src/main/java/com/dnastack/beacon/rest/BeaconApplication.java +++ b/beacon-adapters/beacon-java/src/main/java/com/dnastack/beacon/rest/BeaconApplication.java @@ -35,7 +35,7 @@ * @author Miroslav Cupak (mirocupak@gmail.com) * @version 1.0 */ -@ApplicationPath("/rest") +@ApplicationPath("/") public class BeaconApplication extends Application { @Override diff --git a/beacon-adapters/beacon-java/src/main/java/com/dnastack/beacon/rest/BeaconResource.java b/beacon-adapters/beacon-java/src/main/java/com/dnastack/beacon/rest/BeaconResource.java index 8366643..28ff820 100644 --- a/beacon-adapters/beacon-java/src/main/java/com/dnastack/beacon/rest/BeaconResource.java +++ b/beacon-adapters/beacon-java/src/main/java/com/dnastack/beacon/rest/BeaconResource.java @@ -46,7 +46,7 @@ public class BeaconResource { private BeaconService service; @GET - public BeaconResponse query(@QueryParam("chrom") String chrom, @QueryParam("pos") Long pos, @QueryParam("allele") String allele, @QueryParam("ref") String ref) { - return service.query(chrom, pos, allele, ref); + public BeaconResponse query(@QueryParam("chrom") String chrom, @QueryParam("pos") Long pos, @QueryParam("allele") String allele, @QueryParam("ref") String ref, @QueryParam("dataset") String dataset) { + return service.query(chrom, pos, allele, ref, dataset); } } diff --git a/beacon-adapters/beacon-java/src/main/java/com/dnastack/beacon/service/BeaconService.java b/beacon-adapters/beacon-java/src/main/java/com/dnastack/beacon/service/BeaconService.java index a53d9ed..7f38506 100644 --- a/beacon-adapters/beacon-java/src/main/java/com/dnastack/beacon/service/BeaconService.java +++ b/beacon-adapters/beacon-java/src/main/java/com/dnastack/beacon/service/BeaconService.java @@ -41,10 +41,11 @@ public interface BeaconService { * @param pos position * @param allele allele * @param ref reference genome (optional) + * @param dataset dataset * * @return list of beacon responses */ - BeaconResponse query(String chrom, Long pos, String allele, String ref); + BeaconResponse query(String chrom, Long pos, String allele, String ref, String dataset); /** * Obtains beacon information. diff --git a/beacon-adapters/beacon-java/src/main/java/com/dnastack/beacon/service/SampleBeaconService.java b/beacon-adapters/beacon-java/src/main/java/com/dnastack/beacon/service/SampleBeaconService.java index e9cd30f..4d4508e 100644 --- a/beacon-adapters/beacon-java/src/main/java/com/dnastack/beacon/service/SampleBeaconService.java +++ b/beacon-adapters/beacon-java/src/main/java/com/dnastack/beacon/service/SampleBeaconService.java @@ -23,8 +23,14 @@ */ package com.dnastack.beacon.service; +import java.util.ArrayList; +import java.util.List; + import com.dnastack.beacon.entity.Beacon; import com.dnastack.beacon.entity.BeaconResponse; +import com.dnastack.beacon.entity.resources.DataSetResource; +import com.dnastack.beacon.entity.resources.QueryResource; +import com.dnastack.beacon.entity.resources.ResponseResource; import com.dnastack.beacon.util.QueryUtils; /** @@ -37,17 +43,23 @@ */ public class SampleBeaconService implements BeaconService { - private static final Beacon beacon = new Beacon("foo", "bar", "org", "sample beacon"); + DataSetResource dataSetResource = new DataSetResource("id", "description", "reference", null, null); + List datasets = new ArrayList(); + + QueryResource queryResource = new QueryResource("allele string", "chromosome id", 1, "genome Id", "dataset Id"); + List queries = new ArrayList(); + private final Beacon beacon = new Beacon("foo", "bar", "org", "sample beacon", "0.1/0.2", "http://dnastack.com/ga4gh/bob/", "beacon@dnastack.com", "oauth2", datasets, queries); + @Override - public BeaconResponse query(String chrom, Long pos, String allele, String ref) { - BeaconResponse response = new BeaconResponse(beacon, QueryUtils.getQuery(chrom, pos, allele, ref), null); - + public BeaconResponse query(String chrom, Long pos, String allele, String ref, String dataset) { + BeaconResponse response = new BeaconResponse(beacon.getId(), QueryUtils.getQuery(chrom, pos, allele, ref, dataset), null); + ResponseResource responseResource = new ResponseResource("true", 0, null, "bla", null); // generate a sample response if (pos % 2 == 0) { - response.setResponse(true); + response.setResponse(responseResource); } else { - response.setResponse(false); + response.setResponse(responseResource); } return response; @@ -55,7 +67,9 @@ public BeaconResponse query(String chrom, Long pos, String allele, String ref) { @Override public Beacon info() { - return beacon; + queries.add(queryResource); + datasets.add(dataSetResource); + return beacon; } } diff --git a/beacon-adapters/beacon-java/src/main/java/com/dnastack/beacon/util/QueryUtils.java b/beacon-adapters/beacon-java/src/main/java/com/dnastack/beacon/util/QueryUtils.java index 45cf4b8..7bd1823 100644 --- a/beacon-adapters/beacon-java/src/main/java/com/dnastack/beacon/util/QueryUtils.java +++ b/beacon-adapters/beacon-java/src/main/java/com/dnastack/beacon/util/QueryUtils.java @@ -141,14 +141,15 @@ public static Reference normalizeReference(String ref) { * @param pos position * @param allele allele * @param ref genome + * @param dataset dataset * * @return normalized query */ - public static Query getQuery(String chrom, Long pos, String allele, String ref) { + public static Query getQuery(String chrom, Long pos, String allele, String ref, String dataset) { Chromosome c = normalizeChromosome(chrom); Reference r = normalizeReference(ref); - return new Query(c == null ? null : c, pos, normalizeAllele(allele), r == null ? null : r); + return new Query(c == null ? null : c, pos, normalizeAllele(allele), r == null ? null : r, dataset); } } From e012395b35a6915825e9c7653f7155bbf4abea89 Mon Sep 17 00:00:00 2001 From: mcupak Date: Mon, 16 Mar 2015 17:18:23 -0400 Subject: [PATCH 7/8] [fixed #60] using 0-based positions --- .../bob/processor/AmpLabBeaconProcessor.java | 13 +++--- .../processor/BeaconizerBeaconProcessor.java | 13 +++--- .../BroadInstituteBeaconProcessor.java | 11 +++-- .../processor/CafeVariomeBeaconProcessor.java | 13 +++--- .../bob/processor/EbiBeaconProcessor.java | 15 ++++--- .../bob/processor/IcgcBeaconProcessor.java | 16 ++++--- .../bob/processor/KaviarBeaconProcessor.java | 11 ++--- .../bob/processor/NcbiBeaconProcessor.java | 13 +++--- .../bob/processor/UcscBeaconProcessor.java | 12 +++--- .../bob/processor/WtsiBeaconProcessor.java | 16 ++++--- .../com/dnastack/bob/util/QueryUtils.java | 16 +++---- bob-js-client/src/main/webapp/brca.html | 2 +- bob-js-client/src/main/webapp/index.html | 2 +- .../dnastack/bob/rest/AmpLabResponseTest.java | 30 ++++++------- .../bob/rest/BeaconResponsesTest.java | 42 +++++++++---------- .../dnastack/bob/rest/BobResponseTest.java | 28 ++++++------- .../bob/rest/BroadInstituteResponseTest.java | 28 ++++++------- .../bob/rest/CafeVariomeResponseTest.java | 32 +++++++------- .../rest/CuroverseBeaconizerResponseTest.java | 12 +++--- .../dnastack/bob/rest/EbiResponseTest.java | 16 +++---- .../dnastack/bob/rest/GoogleResponseTest.java | 36 ++++++++-------- .../dnastack/bob/rest/IcgcResponseTest.java | 28 ++++++------- .../dnastack/bob/rest/KaviarResponseTest.java | 30 ++++++------- .../dnastack/bob/rest/NcbiResponseTest.java | 30 ++++++------- .../dnastack/bob/rest/UcscResponseTest.java | 32 +++++++------- .../dnastack/bob/rest/WtsiResponseTest.java | 20 ++++----- 26 files changed, 273 insertions(+), 244 deletions(-) diff --git a/bob-data/src/main/java/com/dnastack/bob/processor/AmpLabBeaconProcessor.java b/bob-data/src/main/java/com/dnastack/bob/processor/AmpLabBeaconProcessor.java index 4969fb0..6055ed6 100644 --- a/bob-data/src/main/java/com/dnastack/bob/processor/AmpLabBeaconProcessor.java +++ b/bob-data/src/main/java/com/dnastack/bob/processor/AmpLabBeaconProcessor.java @@ -26,9 +26,6 @@ import com.dnastack.bob.entity.Beacon; import com.dnastack.bob.entity.Query; import com.dnastack.bob.entity.Reference; -import com.dnastack.bob.util.HttpUtils; -import com.dnastack.bob.util.ParsingUtils; -import com.dnastack.bob.util.QueryUtils; import com.google.common.collect.ImmutableSet; import java.io.UnsupportedEncodingException; import java.util.ArrayList; @@ -40,6 +37,12 @@ import org.apache.http.NameValuePair; import org.apache.http.message.BasicNameValuePair; +import static com.dnastack.bob.util.HttpUtils.createRequest; +import static com.dnastack.bob.util.HttpUtils.executeRequest; +import static com.dnastack.bob.util.ParsingUtils.parseContainsStringCaseInsensitive; +import static com.dnastack.bob.util.QueryUtils.denormalizeAllele; +import static com.dnastack.bob.util.QueryUtils.denormalizeChromosome; + /** * AMPLab beacon service. * @@ -72,7 +75,7 @@ private List getQueryData(String ref, String chrom, Long pos, Str public Future getQueryResponse(Beacon beacon, Query query) { String res = null; try { - res = HttpUtils.executeRequest(HttpUtils.createRequest(BASE_URL, true, getQueryData(query.getReference().toString(), QueryUtils.denormalizeChromosome(CHROM_TEMPLATE, query.getChromosome()), QueryUtils.denormalizePosition(query.getPosition()), QueryUtils.denormalizeAllele(query.getAllele())))); + res = executeRequest(createRequest(BASE_URL, true, getQueryData(query.getReference().toString(), denormalizeChromosome(CHROM_TEMPLATE, query.getChromosome()), query.getPosition(), denormalizeAllele(query.getAllele())))); } catch (UnsupportedEncodingException ex) { // ignore, already null } @@ -83,7 +86,7 @@ public Future getQueryResponse(Beacon beacon, Query query) { @Override @Asynchronous public Future parseQueryResponse(Beacon b, String response) { - Boolean res = ParsingUtils.parseContainsStringCaseInsensitive(response, "beacon found", "beacon cannot find"); + Boolean res = parseContainsStringCaseInsensitive(response, "beacon found", "beacon cannot find"); return new AsyncResult<>(res); } diff --git a/bob-data/src/main/java/com/dnastack/bob/processor/BeaconizerBeaconProcessor.java b/bob-data/src/main/java/com/dnastack/bob/processor/BeaconizerBeaconProcessor.java index 4795ab8..b52b0be 100644 --- a/bob-data/src/main/java/com/dnastack/bob/processor/BeaconizerBeaconProcessor.java +++ b/bob-data/src/main/java/com/dnastack/bob/processor/BeaconizerBeaconProcessor.java @@ -26,9 +26,6 @@ import com.dnastack.bob.entity.Beacon; import com.dnastack.bob.entity.Query; import com.dnastack.bob.entity.Reference; -import com.dnastack.bob.util.HttpUtils; -import com.dnastack.bob.util.ParsingUtils; -import com.dnastack.bob.util.QueryUtils; import com.google.common.collect.ImmutableSet; import java.io.UnsupportedEncodingException; import java.net.MalformedURLException; @@ -38,6 +35,10 @@ import javax.ejb.Asynchronous; import org.apache.http.client.methods.HttpRequestBase; +import static com.dnastack.bob.util.HttpUtils.createRequest; +import static com.dnastack.bob.util.HttpUtils.executeRequest; +import static com.dnastack.bob.util.ParsingUtils.parseBooleanFromJson; + /** * Beaconizer beacon service. * @@ -66,9 +67,9 @@ public Future getQueryResponse(Beacon beacon, Query query) { // should be POST, but the server accepts GET as well try { - HttpRequestBase request = HttpUtils.createRequest(getQueryUrl(beacon.getId(), query.getChromosome().toString(), QueryUtils.denormalizePosition(query.getPosition()), query.getAllele()), false, null); + HttpRequestBase request = createRequest(getQueryUrl(beacon.getId(), query.getChromosome().toString(), query.getPosition(), query.getAllele()), false, null); request.setHeader("Accept", "application/json"); - res = HttpUtils.executeRequest(request); + res = executeRequest(request); } catch (MalformedURLException | UnsupportedEncodingException ex) { // ignore, already null } @@ -79,7 +80,7 @@ public Future getQueryResponse(Beacon beacon, Query query) { @Override @Asynchronous public Future parseQueryResponse(Beacon b, String response) { - Boolean res = ParsingUtils.parseBooleanFromJson(response, "exists"); + Boolean res = parseBooleanFromJson(response, "exists"); return new AsyncResult<>(res); } diff --git a/bob-data/src/main/java/com/dnastack/bob/processor/BroadInstituteBeaconProcessor.java b/bob-data/src/main/java/com/dnastack/bob/processor/BroadInstituteBeaconProcessor.java index a6bb5a9..0b5f304 100644 --- a/bob-data/src/main/java/com/dnastack/bob/processor/BroadInstituteBeaconProcessor.java +++ b/bob-data/src/main/java/com/dnastack/bob/processor/BroadInstituteBeaconProcessor.java @@ -26,8 +26,6 @@ import com.dnastack.bob.entity.Beacon; import com.dnastack.bob.entity.Query; import com.dnastack.bob.entity.Reference; -import com.dnastack.bob.util.HttpUtils; -import com.dnastack.bob.util.ParsingUtils; import com.google.common.collect.ImmutableSet; import java.io.UnsupportedEncodingException; import java.net.MalformedURLException; @@ -36,6 +34,11 @@ import javax.ejb.AsyncResult; import javax.ejb.Asynchronous; +import static com.dnastack.bob.util.HttpUtils.createRequest; +import static com.dnastack.bob.util.HttpUtils.executeRequest; +import static com.dnastack.bob.util.ParsingUtils.parseYesNoCaseInsensitive; +import static com.dnastack.bob.util.QueryUtils.denormalizePosition; + /** * A Genomics Alliance beacon service at Broad Institute. * @@ -62,7 +65,7 @@ private String getQueryUrl(String ref, String chrom, Long pos, String allele) th public Future getQueryResponse(Beacon beacon, Query query) { String res = null; try { - res = HttpUtils.executeRequest(HttpUtils.createRequest(getQueryUrl(query.getReference().toString(), query.getChromosome().toString(), query.getPosition(), query.getAllele()), false, null)); + res = executeRequest(createRequest(getQueryUrl(query.getReference().toString(), query.getChromosome().toString(), denormalizePosition(query.getPosition()), query.getAllele()), false, null)); } catch (MalformedURLException | UnsupportedEncodingException ex) { // ignore, already null } @@ -73,7 +76,7 @@ public Future getQueryResponse(Beacon beacon, Query query) { @Override @Asynchronous public Future parseQueryResponse(Beacon b, String response) { - Boolean res = ParsingUtils.parseYesNoCaseInsensitive(response); + Boolean res = parseYesNoCaseInsensitive(response); return new AsyncResult<>(res); } diff --git a/bob-data/src/main/java/com/dnastack/bob/processor/CafeVariomeBeaconProcessor.java b/bob-data/src/main/java/com/dnastack/bob/processor/CafeVariomeBeaconProcessor.java index 0714166..9492b35 100644 --- a/bob-data/src/main/java/com/dnastack/bob/processor/CafeVariomeBeaconProcessor.java +++ b/bob-data/src/main/java/com/dnastack/bob/processor/CafeVariomeBeaconProcessor.java @@ -26,9 +26,6 @@ import com.dnastack.bob.entity.Beacon; import com.dnastack.bob.entity.Query; import com.dnastack.bob.entity.Reference; -import com.dnastack.bob.util.HttpUtils; -import com.dnastack.bob.util.ParsingUtils; -import com.dnastack.bob.util.QueryUtils; import com.google.common.collect.ImmutableSet; import java.io.UnsupportedEncodingException; import java.net.MalformedURLException; @@ -37,6 +34,12 @@ import javax.ejb.AsyncResult; import javax.ejb.Asynchronous; +import static com.dnastack.bob.util.HttpUtils.createRequest; +import static com.dnastack.bob.util.HttpUtils.executeRequest; +import static com.dnastack.bob.util.ParsingUtils.parseBooleanFromJson; +import static com.dnastack.bob.util.QueryUtils.denormalizeChromosome; +import static com.dnastack.bob.util.QueryUtils.denormalizePosition; + /** * Cafe Variome beacon service. * @@ -76,7 +79,7 @@ public Future getQueryResponse(Beacon beacon, Query query) { String res = null; try { - res = HttpUtils.executeRequest(HttpUtils.createRequest(getQueryUrl(QueryUtils.denormalizeChromosome("chr%s", query.getChromosome()).toLowerCase(), query.getPosition(), query.getAllele()), false, null)); + res = executeRequest(createRequest(getQueryUrl(denormalizeChromosome("chr%s", query.getChromosome()).toLowerCase(), denormalizePosition(query.getPosition()), query.getAllele()), false, null)); } catch (MalformedURLException | UnsupportedEncodingException ex) { // ignore, already null } @@ -87,7 +90,7 @@ public Future getQueryResponse(Beacon beacon, Query query) { @Override @Asynchronous public Future parseQueryResponse(Beacon b, String response) { - Boolean res = ParsingUtils.parseBooleanFromJson(response, RESPONSE_FIELD, getJsonFieldName(b)); + Boolean res = parseBooleanFromJson(response, RESPONSE_FIELD, getJsonFieldName(b)); return new AsyncResult<>(res); } diff --git a/bob-data/src/main/java/com/dnastack/bob/processor/EbiBeaconProcessor.java b/bob-data/src/main/java/com/dnastack/bob/processor/EbiBeaconProcessor.java index 26cd211..6d5a88e 100644 --- a/bob-data/src/main/java/com/dnastack/bob/processor/EbiBeaconProcessor.java +++ b/bob-data/src/main/java/com/dnastack/bob/processor/EbiBeaconProcessor.java @@ -26,9 +26,6 @@ import com.dnastack.bob.entity.Beacon; import com.dnastack.bob.entity.Query; import com.dnastack.bob.entity.Reference; -import com.dnastack.bob.util.HttpUtils; -import com.dnastack.bob.util.ParsingUtils; -import com.dnastack.bob.util.QueryUtils; import com.google.common.collect.ImmutableSet; import java.io.UnsupportedEncodingException; import java.net.MalformedURLException; @@ -37,6 +34,14 @@ import javax.ejb.AsyncResult; import javax.ejb.Asynchronous; +import static com.dnastack.bob.util.HttpUtils.createRequest; +import static com.dnastack.bob.util.HttpUtils.executeRequest; +import static com.dnastack.bob.util.ParsingUtils.parseBooleanFromJson; +import static com.dnastack.bob.util.QueryUtils.denormalizeAllele; +import static com.dnastack.bob.util.QueryUtils.denormalizeAlleleToBrackets; +import static com.dnastack.bob.util.QueryUtils.denormalizeChromosomeToNumber; +import static com.dnastack.bob.util.QueryUtils.denormalizePosition; + /** * EBI beacon service. * @@ -63,7 +68,7 @@ private String getQueryUrl(Integer chrom, Long pos, String allele) throws Malfor public Future getQueryResponse(Beacon beacon, Query query) { String res = null; try { - res = HttpUtils.executeRequest(HttpUtils.createRequest(getQueryUrl(QueryUtils.denormalizeChromosomeToNumber(query.getChromosome()), query.getPosition(), QueryUtils.denormalizeAlleleToBrackets(QueryUtils.denormalizeAllele(query.getAllele()))), false, null)); + res = executeRequest(createRequest(getQueryUrl(denormalizeChromosomeToNumber(query.getChromosome()), denormalizePosition(query.getPosition()), denormalizeAlleleToBrackets(denormalizeAllele(query.getAllele()))), false, null)); } catch (MalformedURLException | UnsupportedEncodingException ex) { // ignore, already null } @@ -74,7 +79,7 @@ public Future getQueryResponse(Beacon beacon, Query query) { @Override @Asynchronous public Future parseQueryResponse(Beacon b, String response) { - Boolean res = ParsingUtils.parseBooleanFromJson(response, "exists"); + Boolean res = parseBooleanFromJson(response, "exists"); return new AsyncResult<>(res); } diff --git a/bob-data/src/main/java/com/dnastack/bob/processor/IcgcBeaconProcessor.java b/bob-data/src/main/java/com/dnastack/bob/processor/IcgcBeaconProcessor.java index a0e1829..ebfee68 100644 --- a/bob-data/src/main/java/com/dnastack/bob/processor/IcgcBeaconProcessor.java +++ b/bob-data/src/main/java/com/dnastack/bob/processor/IcgcBeaconProcessor.java @@ -26,9 +26,6 @@ import com.dnastack.bob.entity.Beacon; import com.dnastack.bob.entity.Query; import com.dnastack.bob.entity.Reference; -import com.dnastack.bob.util.HttpUtils; -import com.dnastack.bob.util.ParsingUtils; -import com.dnastack.bob.util.QueryUtils; import com.google.common.collect.ImmutableSet; import java.io.UnsupportedEncodingException; import java.net.MalformedURLException; @@ -37,6 +34,13 @@ import javax.ejb.AsyncResult; import javax.ejb.Asynchronous; +import static com.dnastack.bob.util.HttpUtils.createRequest; +import static com.dnastack.bob.util.HttpUtils.executeRequest; +import static com.dnastack.bob.util.ParsingUtils.parseBooleanFromJson; +import static com.dnastack.bob.util.ParsingUtils.parseStringFromJson; +import static com.dnastack.bob.util.QueryUtils.denormalizePosition; +import static com.dnastack.bob.util.QueryUtils.denormalizeReference; + /** * ICGC beacon service. Preliminary 0.2 spec. * @@ -64,7 +68,7 @@ public Future getQueryResponse(Beacon beacon, Query query) { String res = null; try { - res = HttpUtils.executeRequest(HttpUtils.createRequest(getQueryUrl(QueryUtils.denormalizeReference(query.getReference()), query.getChromosome().toString(), query.getPosition(), query.getAllele()), false, null)); + res = executeRequest(createRequest(getQueryUrl(denormalizeReference(query.getReference()), query.getChromosome().toString(), denormalizePosition(query.getPosition()), query.getAllele()), false, null)); } catch (MalformedURLException | UnsupportedEncodingException ex) { // ignore, already null } @@ -75,11 +79,11 @@ public Future getQueryResponse(Beacon beacon, Query query) { @Override @Asynchronous public Future parseQueryResponse(Beacon b, String response) { - Boolean res = ParsingUtils.parseBooleanFromJson(response, "response", "exists"); + Boolean res = parseBooleanFromJson(response, "response", "exists"); // the beacon uses null as false, convert if (res == null) { - String s = ParsingUtils.parseStringFromJson(response, "response", "exists"); + String s = parseStringFromJson(response, "response", "exists"); if ("null".equals(s)) { res = false; } diff --git a/bob-data/src/main/java/com/dnastack/bob/processor/KaviarBeaconProcessor.java b/bob-data/src/main/java/com/dnastack/bob/processor/KaviarBeaconProcessor.java index 37f4237..0181be7 100644 --- a/bob-data/src/main/java/com/dnastack/bob/processor/KaviarBeaconProcessor.java +++ b/bob-data/src/main/java/com/dnastack/bob/processor/KaviarBeaconProcessor.java @@ -26,9 +26,6 @@ import com.dnastack.bob.entity.Beacon; import com.dnastack.bob.entity.Query; import com.dnastack.bob.entity.Reference; -import com.dnastack.bob.util.HttpUtils; -import com.dnastack.bob.util.ParsingUtils; -import com.dnastack.bob.util.QueryUtils; import com.google.common.collect.ImmutableSet; import java.io.UnsupportedEncodingException; import java.net.MalformedURLException; @@ -37,6 +34,10 @@ import javax.ejb.AsyncResult; import javax.ejb.Asynchronous; +import static com.dnastack.bob.util.HttpUtils.createRequest; +import static com.dnastack.bob.util.HttpUtils.executeRequest; +import static com.dnastack.bob.util.ParsingUtils.parseYesNoCaseInsensitive; + /** * Kaviar beacon service. * @@ -65,7 +66,7 @@ public Future getQueryResponse(Beacon beacon, Query query) { // should be POST, but the server accepts GET as well try { - res = HttpUtils.executeRequest(HttpUtils.createRequest(getQueryUrl(query.getReference().toString(), query.getChromosome().toString(), QueryUtils.denormalizePosition(query.getPosition()), query.getAllele()), false, null)); + res = executeRequest(createRequest(getQueryUrl(query.getReference().toString(), query.getChromosome().toString(), query.getPosition(), query.getAllele()), false, null)); } catch (MalformedURLException | UnsupportedEncodingException ex) { // ignore, already null } @@ -76,7 +77,7 @@ public Future getQueryResponse(Beacon beacon, Query query) { @Override @Asynchronous public Future parseQueryResponse(Beacon b, String response) { - Boolean res = ParsingUtils.parseYesNoCaseInsensitive(response); + Boolean res = parseYesNoCaseInsensitive(response); return new AsyncResult<>(res); } diff --git a/bob-data/src/main/java/com/dnastack/bob/processor/NcbiBeaconProcessor.java b/bob-data/src/main/java/com/dnastack/bob/processor/NcbiBeaconProcessor.java index 6385337..9091a30 100644 --- a/bob-data/src/main/java/com/dnastack/bob/processor/NcbiBeaconProcessor.java +++ b/bob-data/src/main/java/com/dnastack/bob/processor/NcbiBeaconProcessor.java @@ -26,9 +26,6 @@ import com.dnastack.bob.entity.Beacon; import com.dnastack.bob.entity.Query; import com.dnastack.bob.entity.Reference; -import com.dnastack.bob.util.HttpUtils; -import com.dnastack.bob.util.ParsingUtils; -import com.dnastack.bob.util.QueryUtils; import com.google.common.collect.ImmutableSet; import java.io.UnsupportedEncodingException; import java.net.MalformedURLException; @@ -37,6 +34,12 @@ import javax.ejb.AsyncResult; import javax.ejb.Asynchronous; +import static com.dnastack.bob.util.HttpUtils.createRequest; +import static com.dnastack.bob.util.HttpUtils.executeRequest; +import static com.dnastack.bob.util.ParsingUtils.parseBooleanFromJson; +import static com.dnastack.bob.util.QueryUtils.denormalizePosition; +import static com.dnastack.bob.util.QueryUtils.denormalizeReference; + /** * NCBI beacon service. * @@ -65,7 +68,7 @@ public Future getQueryResponse(Beacon beacon, Query query) { // should be POST, but the server accepts GET as well try { - res = HttpUtils.executeRequest(HttpUtils.createRequest(getQueryUrl(QueryUtils.denormalizeReference(query.getReference()), query.getChromosome().toString(), query.getPosition(), query.getAllele()), false, null)); + res = executeRequest(createRequest(getQueryUrl(denormalizeReference(query.getReference()), query.getChromosome().toString(), denormalizePosition(query.getPosition()), query.getAllele()), false, null)); } catch (MalformedURLException | UnsupportedEncodingException ex) { // ignore, already null } @@ -76,7 +79,7 @@ public Future getQueryResponse(Beacon beacon, Query query) { @Override @Asynchronous public Future parseQueryResponse(Beacon b, String response) { - Boolean res = ParsingUtils.parseBooleanFromJson(response, "exist_gt"); + Boolean res = parseBooleanFromJson(response, "exist_gt"); return new AsyncResult<>(res); } diff --git a/bob-data/src/main/java/com/dnastack/bob/processor/UcscBeaconProcessor.java b/bob-data/src/main/java/com/dnastack/bob/processor/UcscBeaconProcessor.java index 76beead..2422551 100644 --- a/bob-data/src/main/java/com/dnastack/bob/processor/UcscBeaconProcessor.java +++ b/bob-data/src/main/java/com/dnastack/bob/processor/UcscBeaconProcessor.java @@ -26,9 +26,6 @@ import com.dnastack.bob.entity.Beacon; import com.dnastack.bob.entity.Query; import com.dnastack.bob.entity.Reference; -import com.dnastack.bob.util.HttpUtils; -import com.dnastack.bob.util.ParsingUtils; -import com.dnastack.bob.util.QueryUtils; import com.google.common.collect.ImmutableSet; import java.io.UnsupportedEncodingException; import java.net.MalformedURLException; @@ -37,6 +34,11 @@ import javax.ejb.AsyncResult; import javax.ejb.Asynchronous; +import static com.dnastack.bob.util.HttpUtils.createRequest; +import static com.dnastack.bob.util.HttpUtils.executeRequest; +import static com.dnastack.bob.util.ParsingUtils.parseYesNoCaseInsensitive; +import static com.dnastack.bob.util.QueryUtils.denormalizeChromosome; + /** * A Genomics Alliance beacon service at UCSC. * @@ -64,7 +66,7 @@ private String getQueryUrl(String track, String chrom, Long pos, String allele) public Future getQueryResponse(Beacon beacon, Query query) { String res = null; try { - res = HttpUtils.executeRequest(HttpUtils.createRequest(getQueryUrl(beacon.getId(), QueryUtils.denormalizeChromosome(CHROM_TEMPLATE, query.getChromosome()), QueryUtils.denormalizePosition(query.getPosition()), query.getAllele()), false, null)); + res = executeRequest(createRequest(getQueryUrl(beacon.getId(), denormalizeChromosome(CHROM_TEMPLATE, query.getChromosome()), query.getPosition(), query.getAllele()), false, null)); } catch (MalformedURLException | UnsupportedEncodingException ex) { // ignore, already null } @@ -75,7 +77,7 @@ public Future getQueryResponse(Beacon beacon, Query query) { @Override @Asynchronous public Future parseQueryResponse(Beacon b, String response) { - Boolean res = ParsingUtils.parseYesNoCaseInsensitive(response); + Boolean res = parseYesNoCaseInsensitive(response); return new AsyncResult<>(res); } diff --git a/bob-data/src/main/java/com/dnastack/bob/processor/WtsiBeaconProcessor.java b/bob-data/src/main/java/com/dnastack/bob/processor/WtsiBeaconProcessor.java index 374f276..fa8f71a 100644 --- a/bob-data/src/main/java/com/dnastack/bob/processor/WtsiBeaconProcessor.java +++ b/bob-data/src/main/java/com/dnastack/bob/processor/WtsiBeaconProcessor.java @@ -26,9 +26,6 @@ import com.dnastack.bob.entity.Beacon; import com.dnastack.bob.entity.Query; import com.dnastack.bob.entity.Reference; -import com.dnastack.bob.util.HttpUtils; -import com.dnastack.bob.util.ParsingUtils; -import com.dnastack.bob.util.QueryUtils; import com.google.common.collect.ImmutableSet; import java.io.UnsupportedEncodingException; import java.net.MalformedURLException; @@ -37,6 +34,13 @@ import javax.ejb.AsyncResult; import javax.ejb.Asynchronous; +import static com.dnastack.bob.util.HttpUtils.createRequest; +import static com.dnastack.bob.util.HttpUtils.executeRequest; +import static com.dnastack.bob.util.ParsingUtils.parseRef; +import static com.dnastack.bob.util.ParsingUtils.parseYesNoCaseInsensitive; +import static com.dnastack.bob.util.QueryUtils.denormalizePosition; +import static com.dnastack.bob.util.QueryUtils.denormalizeReference; + /** * WTSI beacon service. * @@ -69,7 +73,7 @@ private String getQueryUrl(String ref, String chrom, Long pos, String allele) th public Future getQueryResponse(Beacon beacon, Query query) { String res = null; try { - res = HttpUtils.executeRequest(HttpUtils.createRequest(getQueryUrl(QueryUtils.denormalizeReference(query.getReference()), query.getChromosome().toString(), query.getPosition(), query.getAllele()), false, null)); + res = executeRequest(createRequest(getQueryUrl(denormalizeReference(query.getReference()), query.getChromosome().toString(), denormalizePosition(query.getPosition()), query.getAllele()), false, null)); } catch (MalformedURLException | UnsupportedEncodingException ex) { // ignore, already null } @@ -80,10 +84,10 @@ public Future getQueryResponse(Beacon beacon, Query query) { @Override @Asynchronous public Future parseQueryResponse(Beacon b, String response) { - Boolean res = ParsingUtils.parseYesNoCaseInsensitive(response); + Boolean res = parseYesNoCaseInsensitive(response); if (res == null) { // ref response is treated as false - Boolean isRef = ParsingUtils.parseRef(response); + Boolean isRef = parseRef(response); if (isRef != null && isRef) { res = false; } diff --git a/bob-data/src/main/java/com/dnastack/bob/util/QueryUtils.java b/bob-data/src/main/java/com/dnastack/bob/util/QueryUtils.java index a5372ba..ef28acb 100644 --- a/bob-data/src/main/java/com/dnastack/bob/util/QueryUtils.java +++ b/bob-data/src/main/java/com/dnastack/bob/util/QueryUtils.java @@ -118,31 +118,31 @@ public static Integer denormalizeChromosomeToNumber(Chromosome c) { } /** - * Converts 0-based position to 1-based position. + * Converts 1-based position to 0-based position. * - * @param pos 0-based position + * @param pos position * - * @return 1-based position + * @return position */ public static Long normalizePosition(Long pos) { if (pos == null) { return null; } - return ++pos; + return --pos; } /** - * Converts 1-based position to 0-based position. + * Converts 0-based position to 1-based position. * - * @param pos 1-based position + * @param pos position * - * @return 0-based position + * @return position */ public static Long denormalizePosition(Long pos) { if (pos == null) { return null; } - return --pos; + return ++pos; } /** diff --git a/bob-js-client/src/main/webapp/brca.html b/bob-js-client/src/main/webapp/brca.html index 06d80f4..5735162 100644 --- a/bob-js-client/src/main/webapp/brca.html +++ b/bob-js-client/src/main/webapp/brca.html @@ -85,7 +85,7 @@
- 1-based coordinate + 0-based coordinate
diff --git a/bob-js-client/src/main/webapp/index.html b/bob-js-client/src/main/webapp/index.html index 34eee63..9c6dfb3 100644 --- a/bob-js-client/src/main/webapp/index.html +++ b/bob-js-client/src/main/webapp/index.html @@ -76,7 +76,7 @@
- 1-based coordinate + 0-based coordinate
diff --git a/bob-rest/src/test/java/com/dnastack/bob/rest/AmpLabResponseTest.java b/bob-rest/src/test/java/com/dnastack/bob/rest/AmpLabResponseTest.java index ac95b21..19cf85c 100644 --- a/bob-rest/src/test/java/com/dnastack/bob/rest/AmpLabResponseTest.java +++ b/bob-rest/src/test/java/com/dnastack/bob/rest/AmpLabResponseTest.java @@ -58,7 +58,7 @@ public class AmpLabResponseTest extends AbstractResponseTest { @Test @Override public void testAllRefsFound(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"15", "41087870", "A", null}; + String[] query = {"15", "41087869", "A", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -70,7 +70,7 @@ public void testAllRefsFound(@ArquillianResource URL url) throws JAXBException, @Test @Override public void testSpecificRefFound(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"15", "41087870", "A", "hg19"}; + String[] query = {"15", "41087869", "A", "hg19"}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -82,7 +82,7 @@ public void testSpecificRefFound(@ArquillianResource URL url) throws JAXBExcepti @Test @Override public void testSpecificRefNotFound(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"15", "41087870", "A", "hg38"}; + String[] query = {"15", "41087869", "A", "hg38"}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -94,7 +94,7 @@ public void testSpecificRefNotFound(@ArquillianResource URL url) throws JAXBExce @Test @Override public void testInvalidRef(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"15", "41087870", "A", "hg100"}; + String[] query = {"15", "41087869", "A", "hg100"}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -107,7 +107,7 @@ public void testInvalidRef(@ArquillianResource URL url) throws JAXBException, Ma @Test @Override public void testRefConversion(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"15", "41087870", "A", "grch38"}; + String[] query = {"15", "41087869", "A", "grch38"}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -120,7 +120,7 @@ public void testRefConversion(@ArquillianResource URL url) throws JAXBException, @Test @Override public void testDifferentGenome(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"15", "47481777", "G", null}; + String[] query = {"15", "47481776", "G", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -132,7 +132,7 @@ public void testDifferentGenome(@ArquillianResource URL url) throws JAXBExceptio @Test @Override public void testStringAllele(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"22", "17213590", "TGTTA", null}; + String[] query = {"22", "17213589", "TGTTA", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -144,7 +144,7 @@ public void testStringAllele(@ArquillianResource URL url) throws JAXBException, @Test @Override public void testDel(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"14", "106833421", "D", null}; + String[] query = {"14", "106833420", "D", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -161,7 +161,7 @@ public void testIns(URL url) throws JAXBException, MalformedURLException { @Test @Override public void testAllRefsNotFound(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"15", "41087870", "C", null}; + String[] query = {"15", "41087869", "C", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -173,7 +173,7 @@ public void testAllRefsNotFound(@ArquillianResource URL url) throws JAXBExceptio @Test @Override public void testInvalidAllele(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"15", "41087870", "DC", null}; + String[] query = {"15", "41087869", "DC", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -186,7 +186,7 @@ public void testInvalidAllele(@ArquillianResource URL url) throws JAXBException, @Test @Override public void testAlleleConversion(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"14", "106833421", "DEL", null}; + String[] query = {"14", "106833420", "DEL", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -199,7 +199,7 @@ public void testAlleleConversion(@ArquillianResource URL url) throws JAXBExcepti @Test @Override public void testChromConversion(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"chrom14", "106833421", "D", null}; + String[] query = {"chrom14", "106833420", "D", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -211,7 +211,7 @@ public void testChromConversion(@ArquillianResource URL url) throws JAXBExceptio @Test @Override public void testInvalidChrom(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"30", "41087870", "A", null}; + String[] query = {"30", "41087869", "A", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -224,7 +224,7 @@ public void testInvalidChrom(@ArquillianResource URL url) throws JAXBException, @Test @Override public void testChromX(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"X", "41087870", "A", null}; + String[] query = {"X", "41087869", "A", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -236,7 +236,7 @@ public void testChromX(@ArquillianResource URL url) throws JAXBException, Malfor @Test @Override public void testChromMT(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"MT", "41087870", "A", null}; + String[] query = {"MT", "41087869", "A", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); diff --git a/bob-rest/src/test/java/com/dnastack/bob/rest/BeaconResponsesTest.java b/bob-rest/src/test/java/com/dnastack/bob/rest/BeaconResponsesTest.java index e56c0a4..f4fd652 100644 --- a/bob-rest/src/test/java/com/dnastack/bob/rest/BeaconResponsesTest.java +++ b/bob-rest/src/test/java/com/dnastack/bob/rest/BeaconResponsesTest.java @@ -95,7 +95,7 @@ public static List readResponses(String url) throws JAXBExcept @Test public void testAllResponses(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] q = {"13", "32888799", "G", null}; + String[] q = {"13", "32888798", "G", null}; List brs = readResponses(url.toExternalForm() + getUrl(q)); Set ids = new HashSet<>(); @@ -114,7 +114,7 @@ public void testAllResponses(@ArquillianResource URL url) throws JAXBException, @Test public void testAllResponsesWithSpecificRef(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] q = {"13", "32888799", "G", "hg19"}; + String[] q = {"13", "32888798", "G", "hg19"}; List brs = readResponses(url.toExternalForm() + getUrl(q)); Set ids = new HashSet<>(); @@ -134,7 +134,7 @@ public void testAllResponsesWithSpecificRef(@ArquillianResource URL url) throws @Test public void testSpecificResponseWithSpecificRef(@ArquillianResource URL url) throws JAXBException, MalformedURLException { String b = "lovd"; - String[] q = {"1", "808922", "A", "hg19"}; + String[] q = {"1", "808921", "A", "hg19"}; BeaconResponseTo br = readResponses(url.toExternalForm() + getUrl(b, q)).get(0); assertNotNull(br); @@ -146,7 +146,7 @@ public void testSpecificResponseWithSpecificRef(@ArquillianResource URL url) thr @Test public void testResponsesFilteredForClinvar(@ArquillianResource URL url) throws JAXBException, MalformedURLException { String b = "clinvar"; - String[] q = {"1", "10042538", "T", null}; + String[] q = {"1", "10042537", "T", null}; BeaconResponseTo br = readResponses(url.toExternalForm() + getUrl(b, q)).get(0); assertNotNull(br); @@ -158,7 +158,7 @@ public void testResponsesFilteredForClinvar(@ArquillianResource URL url) throws @Test public void testResponsesFilteredForUniprot(@ArquillianResource URL url) throws JAXBException, MalformedURLException { String b = "uniprot"; - String[] q = {"1", "977028", "T", null}; + String[] q = {"1", "977027", "T", null}; BeaconResponseTo br = readResponses(url.toExternalForm() + getUrl(b, q)).get(0); assertNotNull(br); @@ -170,7 +170,7 @@ public void testResponsesFilteredForUniprot(@ArquillianResource URL url) throws @Test public void testResponsesFilteredForLovd(@ArquillianResource URL url) throws JAXBException, MalformedURLException { String b = "lovd"; - String[] q = {"1", "808922", "A", null}; + String[] q = {"1", "808921", "A", null}; BeaconResponseTo br = readResponses(url.toExternalForm() + getUrl(b, q)).get(0); assertNotNull(br); @@ -182,7 +182,7 @@ public void testResponsesFilteredForLovd(@ArquillianResource URL url) throws JAX @Test public void testResponsesFilteredForAmplab(@ArquillianResource URL url) throws JAXBException, MalformedURLException { String b = "amplab"; - String[] q = {"15", "41087870", "A", null}; + String[] q = {"15", "41087869", "A", null}; BeaconResponseTo br = readResponses(url.toExternalForm() + getUrl(b, q)).get(0); assertNotNull(br); @@ -194,7 +194,7 @@ public void testResponsesFilteredForAmplab(@ArquillianResource URL url) throws J @Test public void testResponsesFilteredForKaviar(@ArquillianResource URL url) throws JAXBException, MalformedURLException { String b = "kaviar"; - String[] q = {"1", "808922", "A", null}; + String[] q = {"1", "808921", "A", null}; BeaconResponseTo br = readResponses(url.toExternalForm() + getUrl(b, q)).get(0); assertNotNull(br); @@ -206,7 +206,7 @@ public void testResponsesFilteredForKaviar(@ArquillianResource URL url) throws J @Test public void testResponsesFilteredForNcbi(@ArquillianResource URL url) throws JAXBException, MalformedURLException { String b = "ncbi"; - String[] q = {"22", "17213590", "TGTTA", null}; + String[] q = {"22", "17213589", "TGTTA", null}; BeaconResponseTo br = readResponses(url.toExternalForm() + getUrl(b, q)).get(0); assertNotNull(br); @@ -218,7 +218,7 @@ public void testResponsesFilteredForNcbi(@ArquillianResource URL url) throws JAX @Test public void testResponsesFilteredForEbi(@ArquillianResource URL url) throws JAXBException, MalformedURLException { String b = "ebi"; - String[] q = {"13", "32888799", "G", null}; + String[] q = {"13", "32888798", "G", null}; BeaconResponseTo br = readResponses(url.toExternalForm() + getUrl(b, q)).get(0); assertNotNull(br); @@ -230,7 +230,7 @@ public void testResponsesFilteredForEbi(@ArquillianResource URL url) throws JAXB @Test public void testResponsesFilteredForWtsi(@ArquillianResource URL url) throws JAXBException, MalformedURLException { String b = "wtsi"; - String[] q = {"1", "808922", "A", null}; + String[] q = {"1", "808921", "A", null}; BeaconResponseTo br = readResponses(url.toExternalForm() + getUrl(b, q)).get(0); assertNotNull(br); @@ -242,7 +242,7 @@ public void testResponsesFilteredForWtsi(@ArquillianResource URL url) throws JAX @Test public void testResponsesFilteredForCafeVariome(@ArquillianResource URL url) throws JAXBException, MalformedURLException { String b = "cafe-central"; - String[] q = {"2", "179612321", "T", null}; + String[] q = {"2", "179612320", "T", null}; BeaconResponseTo br = readResponses(url.toExternalForm() + getUrl(b, q)).get(0); assertNotNull(br); @@ -254,7 +254,7 @@ public void testResponsesFilteredForCafeVariome(@ArquillianResource URL url) thr @Test public void testResponsesFilteredForBroad(@ArquillianResource URL url) throws JAXBException, MalformedURLException { String b = "broad"; - String[] q = {"1", "13417", "CGAGA", null}; + String[] q = {"1", "13416", "CGAGA", null}; BeaconResponseTo br = readResponses(url.toExternalForm() + getUrl(b, q)).get(0); assertNotNull(br); @@ -266,7 +266,7 @@ public void testResponsesFilteredForBroad(@ArquillianResource URL url) throws JA @Test public void testResponsesFilteredForIcgc(@ArquillianResource URL url) throws JAXBException, MalformedURLException { String b = "icgc"; - String[] q = {"17", "7577120", "T", null}; + String[] q = {"17", "7577119", "T", null}; BeaconResponseTo br = readResponses(url.toExternalForm() + getUrl(b, q)).get(0); assertNotNull(br); @@ -278,7 +278,7 @@ public void testResponsesFilteredForIcgc(@ArquillianResource URL url) throws JAX @Test public void testResponsesFilteredForBob(@ArquillianResource URL url) throws JAXBException, MalformedURLException { String b = "bob"; - String[] q = {"13", "32888799", "G", null}; + String[] q = {"13", "32888798", "G", null}; BeaconResponseTo br = readResponses(url.toExternalForm() + getUrl(b, q)).get(0); assertNotNull(br); @@ -290,7 +290,7 @@ public void testResponsesFilteredForBob(@ArquillianResource URL url) throws JAXB @Test public void testResponsesFilteredForGoogle(@ArquillianResource URL url) throws JAXBException, MalformedURLException { String b = "google"; - String[] q = {"9", "1795573", "G", null}; + String[] q = {"9", "1795572", "G", null}; BeaconResponseTo br = readResponses(url.toExternalForm() + getUrl(b, q)).get(0); assertNotNull(br); @@ -302,7 +302,7 @@ public void testResponsesFilteredForGoogle(@ArquillianResource URL url) throws J @Test public void testResponsesFilteredForThousandGenomes(@ArquillianResource URL url) throws JAXBException, MalformedURLException { String b = "thousandgenomes"; - String[] q = {"9", "1795573", "G", null}; + String[] q = {"9", "1795572", "G", null}; BeaconResponseTo br = readResponses(url.toExternalForm() + getUrl(b, q)).get(0); assertNotNull(br); @@ -314,7 +314,7 @@ public void testResponsesFilteredForThousandGenomes(@ArquillianResource URL url) @Test public void testResponsesFilteredForThousandGenomesPhase3(@ArquillianResource URL url) throws JAXBException, MalformedURLException { String b = "thousandgenomes-phase3"; - String[] q = {"16", "59180320", "G", null}; + String[] q = {"16", "59180319", "G", null}; BeaconResponseTo br = readResponses(url.toExternalForm() + getUrl(b, q)).get(0); assertNotNull(br); @@ -326,7 +326,7 @@ public void testResponsesFilteredForThousandGenomesPhase3(@ArquillianResource UR @Test public void testResponsesFilteredForPlatinum(@ArquillianResource URL url) throws JAXBException, MalformedURLException { String b = "platinum"; - String[] q = {"5", "145125627", "G", null}; + String[] q = {"5", "145125626", "G", null}; BeaconResponseTo br = readResponses(url.toExternalForm() + getUrl(b, q)).get(0); assertNotNull(br); @@ -339,7 +339,7 @@ public void testResponsesFilteredForPlatinum(@ArquillianResource URL url) throws public void testMultipleResponsesFiltered(@ArquillianResource URL url) throws JAXBException, MalformedURLException { String id1 = "amplab"; String id2 = "clinvar"; - String[] q = {"13", "32888799", "G", null}; + String[] q = {"13", "32888798", "G", null}; List brs = readResponses(url.toExternalForm() + getUrl("[" + id1 + "," + id2 + "]", q)); assertNotNull(brs); @@ -356,7 +356,7 @@ public void testMultipleResponsesFiltered(@ArquillianResource URL url) throws JA public void testMultipleResponsesOfAggregatorsFiltered(@ArquillianResource URL url) throws JAXBException, MalformedURLException { String id1 = "bob"; String id2 = "google"; - String[] q = {"2", "179612321", "T", null}; + String[] q = {"2", "179612320", "T", null}; List brs = readResponses(url.toExternalForm() + getUrl("[" + id1 + "," + id2 + "]", q)); assertNotNull(brs); diff --git a/bob-rest/src/test/java/com/dnastack/bob/rest/BobResponseTest.java b/bob-rest/src/test/java/com/dnastack/bob/rest/BobResponseTest.java index c0b9203..48de4ec 100644 --- a/bob-rest/src/test/java/com/dnastack/bob/rest/BobResponseTest.java +++ b/bob-rest/src/test/java/com/dnastack/bob/rest/BobResponseTest.java @@ -58,7 +58,7 @@ public class BobResponseTest extends AbstractResponseTest { @Test @Override public void testAllRefsFound(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"13", "32888799", "G", null}; + String[] query = {"13", "32888798", "G", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -70,7 +70,7 @@ public void testAllRefsFound(@ArquillianResource URL url) throws JAXBException, @Test @Override public void testSpecificRefFound(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"13", "32888799", "G", "hg19"}; + String[] query = {"13", "32888798", "G", "hg19"}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -82,7 +82,7 @@ public void testSpecificRefFound(@ArquillianResource URL url) throws JAXBExcepti @Test @Override public void testSpecificRefNotFound(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"13", "32888799", "G", "hg38"}; + String[] query = {"13", "32888798", "G", "hg38"}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -94,7 +94,7 @@ public void testSpecificRefNotFound(@ArquillianResource URL url) throws JAXBExce @Test @Override public void testInvalidRef(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"13", "32888799", "G", "hg100"}; + String[] query = {"13", "32888798", "G", "hg100"}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -107,7 +107,7 @@ public void testInvalidRef(@ArquillianResource URL url) throws JAXBException, Ma @Test @Override public void testRefConversion(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"13", "32888799", "G", "grch38"}; + String[] query = {"13", "32888798", "G", "grch38"}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -120,7 +120,7 @@ public void testRefConversion(@ArquillianResource URL url) throws JAXBException, @Test @Override public void testStringAllele(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"1", "46403", "TGT", null}; + String[] query = {"1", "46402", "TGT", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -132,7 +132,7 @@ public void testStringAllele(@ArquillianResource URL url) throws JAXBException, @Test @Override public void testDel(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"1", "73976148", "D", null}; + String[] query = {"1", "73976147", "D", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -144,7 +144,7 @@ public void testDel(@ArquillianResource URL url) throws JAXBException, Malformed @Test @Override public void testIns(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"1", "46403", "I", null}; + String[] query = {"1", "46402", "I", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -156,7 +156,7 @@ public void testIns(@ArquillianResource URL url) throws JAXBException, Malformed @Test @Override public void testAllRefsNotFound(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"15", "41087870", "C", null}; + String[] query = {"15", "41087869", "C", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -168,7 +168,7 @@ public void testAllRefsNotFound(@ArquillianResource URL url) throws JAXBExceptio @Test @Override public void testInvalidAllele(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"15", "41087870", "DC", null}; + String[] query = {"15", "41087869", "DC", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -181,7 +181,7 @@ public void testInvalidAllele(@ArquillianResource URL url) throws JAXBException, @Test @Override public void testAlleleConversion(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"1", "1002922", "DEL", null}; + String[] query = {"1", "1002921", "DEL", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -206,7 +206,7 @@ public void testChromConversion(@ArquillianResource URL url) throws JAXBExceptio @Test @Override public void testInvalidChrom(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"30", "41087870", "A", null}; + String[] query = {"30", "41087869", "A", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -219,7 +219,7 @@ public void testInvalidChrom(@ArquillianResource URL url) throws JAXBException, @Test @Override public void testChromX(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"X", "41087870", "A", null}; + String[] query = {"X", "41087869", "A", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -231,7 +231,7 @@ public void testChromX(@ArquillianResource URL url) throws JAXBException, Malfor @Test @Override public void testChromMT(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"MT", "41087870", "A", null}; + String[] query = {"MT", "41087869", "A", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); diff --git a/bob-rest/src/test/java/com/dnastack/bob/rest/BroadInstituteResponseTest.java b/bob-rest/src/test/java/com/dnastack/bob/rest/BroadInstituteResponseTest.java index fa585fe..8093932 100644 --- a/bob-rest/src/test/java/com/dnastack/bob/rest/BroadInstituteResponseTest.java +++ b/bob-rest/src/test/java/com/dnastack/bob/rest/BroadInstituteResponseTest.java @@ -58,7 +58,7 @@ public class BroadInstituteResponseTest extends AbstractResponseTest { @Test @Override public void testAllRefsFound(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"1", "13417", "CGAGA", null}; + String[] query = {"1", "13416", "CGAGA", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -70,7 +70,7 @@ public void testAllRefsFound(@ArquillianResource URL url) throws JAXBException, @Test @Override public void testSpecificRefFound(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"1", "13417", "CGAGA", "hg19"}; + String[] query = {"1", "13416", "CGAGA", "hg19"}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -82,7 +82,7 @@ public void testSpecificRefFound(@ArquillianResource URL url) throws JAXBExcepti @Test @Override public void testSpecificRefNotFound(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"1", "13417", "CGAGA", "hg38"}; + String[] query = {"1", "13416", "CGAGA", "hg38"}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -94,7 +94,7 @@ public void testSpecificRefNotFound(@ArquillianResource URL url) throws JAXBExce @Test @Override public void testInvalidRef(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"1", "13417", "CGAGA", "hg100"}; + String[] query = {"1", "13416", "CGAGA", "hg100"}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -107,7 +107,7 @@ public void testInvalidRef(@ArquillianResource URL url) throws JAXBException, Ma @Test @Override public void testRefConversion(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"1", "13417", "CGAGA", "grch37"}; + String[] query = {"1", "13416", "CGAGA", "grch37"}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -120,7 +120,7 @@ public void testRefConversion(@ArquillianResource URL url) throws JAXBException, @Test @Override public void testStringAllele(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"1", "13417", "CGAGA", null}; + String[] query = {"1", "13416", "CGAGA", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -133,7 +133,7 @@ public void testStringAllele(@ArquillianResource URL url) throws JAXBException, @Test @Override public void testDel(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"5", "989870", "D", null}; + String[] query = {"5", "989869", "D", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -145,7 +145,7 @@ public void testDel(@ArquillianResource URL url) throws JAXBException, Malformed @Test @Override public void testIns(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"1", "13417", "I", null}; + String[] query = {"1", "13416", "I", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -157,7 +157,7 @@ public void testIns(@ArquillianResource URL url) throws JAXBException, Malformed @Test @Override public void testAllRefsNotFound(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"15", "41087870", "C", null}; + String[] query = {"15", "41087869", "C", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -169,7 +169,7 @@ public void testAllRefsNotFound(@ArquillianResource URL url) throws JAXBExceptio @Test @Override public void testInvalidAllele(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"15", "41087870", "DC", null}; + String[] query = {"15", "41087869", "DC", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -182,7 +182,7 @@ public void testInvalidAllele(@ArquillianResource URL url) throws JAXBException, @Test @Override public void testAlleleConversion(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"5", "989870", "DEL", null}; + String[] query = {"5", "989869", "DEL", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -195,7 +195,7 @@ public void testAlleleConversion(@ArquillianResource URL url) throws JAXBExcepti @Test @Override public void testChromConversion(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"chrom5", "989870", "D", null}; + String[] query = {"chrom5", "989869", "D", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -207,7 +207,7 @@ public void testChromConversion(@ArquillianResource URL url) throws JAXBExceptio @Test @Override public void testInvalidChrom(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"30", "41087870", "A", null}; + String[] query = {"30", "41087869", "A", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -220,7 +220,7 @@ public void testInvalidChrom(@ArquillianResource URL url) throws JAXBException, @Test @Override public void testChromX(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"X", "20038741", "G", null}; + String[] query = {"X", "20038740", "G", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); diff --git a/bob-rest/src/test/java/com/dnastack/bob/rest/CafeVariomeResponseTest.java b/bob-rest/src/test/java/com/dnastack/bob/rest/CafeVariomeResponseTest.java index 1ff0253..a964bce 100644 --- a/bob-rest/src/test/java/com/dnastack/bob/rest/CafeVariomeResponseTest.java +++ b/bob-rest/src/test/java/com/dnastack/bob/rest/CafeVariomeResponseTest.java @@ -58,7 +58,7 @@ public class CafeVariomeResponseTest extends AbstractResponseTest { @Override @Test public void testAllRefsFound(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"2", "179612321", "T", null}; + String[] query = {"2", "179612320", "T", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -70,7 +70,7 @@ public void testAllRefsFound(@ArquillianResource URL url) throws JAXBException, @Test public void testFoundCafeCardioKit(@ArquillianResource URL url) throws JAXBException, MalformedURLException { String b = "cafe-cardiokit"; - String[] query = {"2", "179393691", "T", null}; + String[] query = {"2", "179393690", "T", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(b, query)); assertNotNull(br); @@ -82,7 +82,7 @@ public void testFoundCafeCardioKit(@ArquillianResource URL url) throws JAXBExcep @Test public void testFoundCafeCentral(@ArquillianResource URL url) throws JAXBException, MalformedURLException { String b = "cafe-central"; - String[] query = {"2", "179612321", "T", null}; + String[] query = {"2", "179612320", "T", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(b, query)); assertNotNull(br); @@ -94,7 +94,7 @@ public void testFoundCafeCentral(@ArquillianResource URL url) throws JAXBExcepti @Test @Override public void testSpecificRefFound(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"2", "179612321", "T", "hg19"}; + String[] query = {"2", "179612320", "T", "hg19"}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -106,7 +106,7 @@ public void testSpecificRefFound(@ArquillianResource URL url) throws JAXBExcepti @Test @Override public void testSpecificRefNotFound(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"2", "179612321", "T", "hg38"}; + String[] query = {"2", "179612320", "T", "hg38"}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -118,7 +118,7 @@ public void testSpecificRefNotFound(@ArquillianResource URL url) throws JAXBExce @Test @Override public void testInvalidRef(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"17", "41197712", "G", "hg100"}; + String[] query = {"17", "41197711", "G", "hg100"}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -131,7 +131,7 @@ public void testInvalidRef(@ArquillianResource URL url) throws JAXBException, Ma @Test @Override public void testRefConversion(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"17", "41197712", "G", "grch37"}; + String[] query = {"17", "41197711", "G", "grch37"}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -144,7 +144,7 @@ public void testRefConversion(@ArquillianResource URL url) throws JAXBException, @Test @Override public void testStringAllele(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"17", "41197712", "TGT", null}; + String[] query = {"17", "41197711", "TGT", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -158,7 +158,7 @@ public void testStringAllele(@ArquillianResource URL url) throws JAXBException, @Test @Override public void testDel(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"17", "41197712", "D", null}; + String[] query = {"17", "41197711", "D", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -172,7 +172,7 @@ public void testDel(@ArquillianResource URL url) throws JAXBException, Malformed @Test @Override public void testIns(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"17", "41197712", "I", null}; + String[] query = {"17", "41197711", "I", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -198,7 +198,7 @@ public void testAllRefsNotFound(@ArquillianResource URL url) throws JAXBExceptio @Test @Override public void testInvalidAllele(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"17", "41197712", "DC", null}; + String[] query = {"17", "41197711", "DC", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -211,7 +211,7 @@ public void testInvalidAllele(@ArquillianResource URL url) throws JAXBException, @Test @Override public void testAlleleConversion(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"17", "41197712", "g", null}; + String[] query = {"17", "41197711", "g", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -224,7 +224,7 @@ public void testAlleleConversion(@ArquillianResource URL url) throws JAXBExcepti @Test @Override public void testChromConversion(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"chrom17", "41197712", "G", null}; + String[] query = {"chrom17", "41197711", "G", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -236,7 +236,7 @@ public void testChromConversion(@ArquillianResource URL url) throws JAXBExceptio @Test @Override public void testInvalidChrom(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"30", "41087870", "A", null}; + String[] query = {"30", "41087869", "A", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -249,7 +249,7 @@ public void testInvalidChrom(@ArquillianResource URL url) throws JAXBException, @Test @Override public void testChromX(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"X", "31224684", "C", null}; + String[] query = {"X", "31224683", "C", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -261,7 +261,7 @@ public void testChromX(@ArquillianResource URL url) throws JAXBException, Malfor @Test @Override public void testChromMT(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"MT", "41087870", "A", null}; + String[] query = {"MT", "41087869", "A", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); diff --git a/bob-rest/src/test/java/com/dnastack/bob/rest/CuroverseBeaconizerResponseTest.java b/bob-rest/src/test/java/com/dnastack/bob/rest/CuroverseBeaconizerResponseTest.java index 21136c6..43a36ab 100644 --- a/bob-rest/src/test/java/com/dnastack/bob/rest/CuroverseBeaconizerResponseTest.java +++ b/bob-rest/src/test/java/com/dnastack/bob/rest/CuroverseBeaconizerResponseTest.java @@ -58,7 +58,7 @@ public class CuroverseBeaconizerResponseTest extends AbstractResponseTest { @Override @Test public void testAllRefsFound(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"13", "19020071", "T", null}; + String[] query = {"13", "19020070", "T", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -70,7 +70,7 @@ public void testAllRefsFound(@ArquillianResource URL url) throws JAXBException, @Test public void testFoundCuroverseRef(@ArquillianResource URL url) throws JAXBException, MalformedURLException { String b = "curoverse-ref"; - String[] query = {"1", "14931", "G", null}; + String[] query = {"1", "14930", "G", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(b, query)); assertNotNull(br); @@ -82,7 +82,7 @@ public void testFoundCuroverseRef(@ArquillianResource URL url) throws JAXBExcept @Test @Override public void testSpecificRefFound(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"13", "19020071", "T", "hg19"}; + String[] query = {"13", "19020070", "T", "hg19"}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -186,7 +186,7 @@ public void testAllRefsNotFound(@ArquillianResource URL url) throws JAXBExceptio @Test @Override public void testInvalidAllele(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"17", "41197712", "DC", null}; + String[] query = {"17", "41197711", "DC", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -212,7 +212,7 @@ public void testAlleleConversion(@ArquillianResource URL url) throws JAXBExcepti @Test @Override public void testChromConversion(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"chrom17", "41197712", "G", null}; + String[] query = {"chrom17", "41197711", "G", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -237,7 +237,7 @@ public void testInvalidChrom(@ArquillianResource URL url) throws JAXBException, @Test @Override public void testChromX(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"X", "31224684", "C", null}; + String[] query = {"X", "31224683", "C", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); diff --git a/bob-rest/src/test/java/com/dnastack/bob/rest/EbiResponseTest.java b/bob-rest/src/test/java/com/dnastack/bob/rest/EbiResponseTest.java index f3563e5..109122e 100644 --- a/bob-rest/src/test/java/com/dnastack/bob/rest/EbiResponseTest.java +++ b/bob-rest/src/test/java/com/dnastack/bob/rest/EbiResponseTest.java @@ -58,7 +58,7 @@ public class EbiResponseTest extends AbstractResponseTest { @Test @Override public void testAllRefsFound(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"13", "32888799", "G", null}; + String[] query = {"13", "32888798", "G", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); System.out.println(br); assertNotNull(br); @@ -70,7 +70,7 @@ public void testAllRefsFound(@ArquillianResource URL url) throws JAXBException, @Test @Override public void testSpecificRefFound(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"13", "32888799", "G", "hg19"}; + String[] query = {"13", "32888798", "G", "hg19"}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -82,7 +82,7 @@ public void testSpecificRefFound(@ArquillianResource URL url) throws JAXBExcepti @Test @Override public void testSpecificRefNotFound(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"13", "32888799", "G", "hg38"}; + String[] query = {"13", "32888798", "G", "hg38"}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -94,7 +94,7 @@ public void testSpecificRefNotFound(@ArquillianResource URL url) throws JAXBExce @Test @Override public void testInvalidRef(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"13", "32888799", "G", "hg100"}; + String[] query = {"13", "32888798", "G", "hg100"}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -107,7 +107,7 @@ public void testInvalidRef(@ArquillianResource URL url) throws JAXBException, Ma @Test @Override public void testRefConversion(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"13", "32888799", "G", "grch37"}; + String[] query = {"13", "32888798", "G", "grch37"}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -120,7 +120,7 @@ public void testRefConversion(@ArquillianResource URL url) throws JAXBException, @Test @Override public void testStringAllele(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"1", "46403", "TGT", null}; + String[] query = {"1", "46402", "TGT", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -132,7 +132,7 @@ public void testStringAllele(@ArquillianResource URL url) throws JAXBException, @Test @Override public void testDel(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"1", "73976148", "D", null}; + String[] query = {"1", "73976147", "D", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -144,7 +144,7 @@ public void testDel(@ArquillianResource URL url) throws JAXBException, Malformed @Test @Override public void testIns(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"1", "46403", "I", null}; + String[] query = {"1", "46402", "I", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); diff --git a/bob-rest/src/test/java/com/dnastack/bob/rest/GoogleResponseTest.java b/bob-rest/src/test/java/com/dnastack/bob/rest/GoogleResponseTest.java index 9f1dc11..6231971 100644 --- a/bob-rest/src/test/java/com/dnastack/bob/rest/GoogleResponseTest.java +++ b/bob-rest/src/test/java/com/dnastack/bob/rest/GoogleResponseTest.java @@ -58,7 +58,7 @@ public class GoogleResponseTest extends AbstractResponseTest { @Override @Test public void testAllRefsFound(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"9", "1795573", "G", null}; + String[] query = {"9", "1795572", "G", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -70,7 +70,7 @@ public void testAllRefsFound(@ArquillianResource URL url) throws JAXBException, @Test public void testFoundPlatinum(@ArquillianResource URL url) throws JAXBException, MalformedURLException { String b = "platinum"; - String[] query = {"5", "145125627", "G", null}; + String[] query = {"5", "145125626", "G", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(b, query)); assertNotNull(br); @@ -82,7 +82,7 @@ public void testFoundPlatinum(@ArquillianResource URL url) throws JAXBException, @Test public void testFoundThousandGenomes(@ArquillianResource URL url) throws JAXBException, MalformedURLException { String b = "thousandgenomes"; - String[] query = {"9", "1795573", "G", null}; + String[] query = {"9", "1795572", "G", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(b, query)); assertNotNull(br); @@ -94,7 +94,7 @@ public void testFoundThousandGenomes(@ArquillianResource URL url) throws JAXBExc @Test public void testFoundThousandGenomesPhase3(@ArquillianResource URL url) throws JAXBException, MalformedURLException { String b = "thousandgenomes-phase3"; - String[] query = {"16", "59180320", "G", null}; + String[] query = {"16", "59180319", "G", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(b, query)); assertNotNull(br); @@ -106,7 +106,7 @@ public void testFoundThousandGenomesPhase3(@ArquillianResource URL url) throws J @Test @Override public void testSpecificRefFound(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"16", "59180320", "G", "hg19"}; + String[] query = {"16", "59180319", "G", "hg19"}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -118,7 +118,7 @@ public void testSpecificRefFound(@ArquillianResource URL url) throws JAXBExcepti @Test @Override public void testSpecificRefNotFound(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"16", "59180320", "G", "hg38"}; + String[] query = {"16", "59180319", "G", "hg38"}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -130,7 +130,7 @@ public void testSpecificRefNotFound(@ArquillianResource URL url) throws JAXBExce @Test @Override public void testInvalidRef(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"17", "41197712", "G", "hg100"}; + String[] query = {"17", "41197711", "G", "hg100"}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -143,7 +143,7 @@ public void testInvalidRef(@ArquillianResource URL url) throws JAXBException, Ma @Test @Override public void testRefConversion(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"17", "41197712", "G", "grch37"}; + String[] query = {"17", "41197711", "G", "grch37"}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -156,7 +156,7 @@ public void testRefConversion(@ArquillianResource URL url) throws JAXBException, @Test @Override public void testStringAllele(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"17", "41197712", "TGT", null}; + String[] query = {"17", "41197711", "TGT", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -170,7 +170,7 @@ public void testStringAllele(@ArquillianResource URL url) throws JAXBException, @Test @Override public void testDel(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"17", "41197712", "D", null}; + String[] query = {"17", "41197711", "D", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -184,7 +184,7 @@ public void testDel(@ArquillianResource URL url) throws JAXBException, Malformed @Test @Override public void testIns(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"17", "41197712", "I", null}; + String[] query = {"17", "41197711", "I", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -198,7 +198,7 @@ public void testIns(@ArquillianResource URL url) throws JAXBException, Malformed @Test @Override public void testAllRefsNotFound(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"1", "41197713", "G", null}; + String[] query = {"1", "41197712", "G", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -210,7 +210,7 @@ public void testAllRefsNotFound(@ArquillianResource URL url) throws JAXBExceptio @Test @Override public void testInvalidAllele(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"17", "41197712", "DC", null}; + String[] query = {"17", "41197711", "DC", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -223,7 +223,7 @@ public void testInvalidAllele(@ArquillianResource URL url) throws JAXBException, @Test @Override public void testAlleleConversion(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"17", "41197712", "g", null}; + String[] query = {"17", "41197711", "g", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -236,7 +236,7 @@ public void testAlleleConversion(@ArquillianResource URL url) throws JAXBExcepti @Test @Override public void testChromConversion(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"chrom17", "41197712", "G", null}; + String[] query = {"chrom17", "41197711", "G", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -248,7 +248,7 @@ public void testChromConversion(@ArquillianResource URL url) throws JAXBExceptio @Test @Override public void testInvalidChrom(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"30", "41087870", "A", null}; + String[] query = {"30", "41087869", "A", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -261,7 +261,7 @@ public void testInvalidChrom(@ArquillianResource URL url) throws JAXBException, @Test @Override public void testChromX(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"X", "31224684", "C", null}; + String[] query = {"X", "31224683", "C", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -273,7 +273,7 @@ public void testChromX(@ArquillianResource URL url) throws JAXBException, Malfor @Test @Override public void testChromMT(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"MT", "41087870", "A", null}; + String[] query = {"MT", "41087869", "A", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); diff --git a/bob-rest/src/test/java/com/dnastack/bob/rest/IcgcResponseTest.java b/bob-rest/src/test/java/com/dnastack/bob/rest/IcgcResponseTest.java index c6ac3be..99bad62 100644 --- a/bob-rest/src/test/java/com/dnastack/bob/rest/IcgcResponseTest.java +++ b/bob-rest/src/test/java/com/dnastack/bob/rest/IcgcResponseTest.java @@ -58,7 +58,7 @@ public class IcgcResponseTest extends AbstractResponseTest { @Test @Override public void testAllRefsFound(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"17", "7577120", "T", null}; + String[] query = {"17", "7577119", "T", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -70,7 +70,7 @@ public void testAllRefsFound(@ArquillianResource URL url) throws JAXBException, @Test @Override public void testSpecificRefFound(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"17", "7577120", "T", "hg19"}; + String[] query = {"17", "7577119", "T", "hg19"}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -82,7 +82,7 @@ public void testSpecificRefFound(@ArquillianResource URL url) throws JAXBExcepti @Test @Override public void testSpecificRefNotFound(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"17", "7577120", "T", "hg38"}; + String[] query = {"17", "7577119", "T", "hg38"}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -94,7 +94,7 @@ public void testSpecificRefNotFound(@ArquillianResource URL url) throws JAXBExce @Test @Override public void testInvalidRef(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"17", "7577120", "T", "hg100"}; + String[] query = {"17", "7577119", "T", "hg100"}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -107,7 +107,7 @@ public void testInvalidRef(@ArquillianResource URL url) throws JAXBException, Ma @Test @Override public void testRefConversion(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"17", "7577120", "T", "grch37"}; + String[] query = {"17", "7577119", "T", "grch37"}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -120,7 +120,7 @@ public void testRefConversion(@ArquillianResource URL url) throws JAXBException, @Test @Override public void testStringAllele(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"17", "7577120", "TGT", null}; + String[] query = {"17", "7577119", "TGT", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -133,7 +133,7 @@ public void testStringAllele(@ArquillianResource URL url) throws JAXBException, @Test @Override public void testDel(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"17", "7577120", "D", null}; + String[] query = {"17", "7577119", "D", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -147,7 +147,7 @@ public void testDel(@ArquillianResource URL url) throws JAXBException, Malformed @Test @Override public void testIns(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"17", "7577120", "I", null}; + String[] query = {"17", "7577119", "I", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -161,7 +161,7 @@ public void testIns(@ArquillianResource URL url) throws JAXBException, Malformed @Test @Override public void testAllRefsNotFound(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"17", "7577120", "C", null}; + String[] query = {"17", "7577119", "C", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -184,7 +184,7 @@ public void testAllRefsNotExists(@ArquillianResource URL url) throws JAXBExcepti @Test @Override public void testInvalidAllele(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"15", "41087870", "DC", null}; + String[] query = {"15", "41087869", "DC", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -197,7 +197,7 @@ public void testInvalidAllele(@ArquillianResource URL url) throws JAXBException, @Test @Override public void testAlleleConversion(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"1", "1002922", "DEL", null}; + String[] query = {"1", "1002921", "DEL", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -212,7 +212,7 @@ public void testAlleleConversion(@ArquillianResource URL url) throws JAXBExcepti @Test @Override public void testChromConversion(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"chrom17", "7577120", "T", null}; + String[] query = {"chrom17", "7577119", "T", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -224,7 +224,7 @@ public void testChromConversion(@ArquillianResource URL url) throws JAXBExceptio @Test @Override public void testInvalidChrom(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"30", "41087870", "A", null}; + String[] query = {"30", "41087869", "A", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -237,7 +237,7 @@ public void testInvalidChrom(@ArquillianResource URL url) throws JAXBException, @Test @Override public void testChromX(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"X", "41087870", "C", null}; + String[] query = {"X", "41087869", "C", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); diff --git a/bob-rest/src/test/java/com/dnastack/bob/rest/KaviarResponseTest.java b/bob-rest/src/test/java/com/dnastack/bob/rest/KaviarResponseTest.java index e2b6f9c..6845c94 100644 --- a/bob-rest/src/test/java/com/dnastack/bob/rest/KaviarResponseTest.java +++ b/bob-rest/src/test/java/com/dnastack/bob/rest/KaviarResponseTest.java @@ -58,7 +58,7 @@ public class KaviarResponseTest extends AbstractResponseTest { @Test @Override public void testAllRefsFound(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"1", "808922", "A", null}; + String[] query = {"1", "808921", "A", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -70,7 +70,7 @@ public void testAllRefsFound(@ArquillianResource URL url) throws JAXBException, @Test @Override public void testSpecificRefFound(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"1", "808922", "A", "hg19"}; + String[] query = {"1", "808921", "A", "hg19"}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -82,7 +82,7 @@ public void testSpecificRefFound(@ArquillianResource URL url) throws JAXBExcepti @Test @Override public void testSpecificRefNotFound(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"1", "808922", "A", "hg38"}; + String[] query = {"1", "808921", "A", "hg38"}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -94,7 +94,7 @@ public void testSpecificRefNotFound(@ArquillianResource URL url) throws JAXBExce @Test @Override public void testInvalidRef(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"1", "808922", "A", "hg100"}; + String[] query = {"1", "808921", "A", "hg100"}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -107,7 +107,7 @@ public void testInvalidRef(@ArquillianResource URL url) throws JAXBException, Ma @Test @Override public void testRefConversion(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"1", "808922", "A", "grch37"}; + String[] query = {"1", "808921", "A", "grch37"}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -120,7 +120,7 @@ public void testRefConversion(@ArquillianResource URL url) throws JAXBException, @Test @Override public void testStringAllele(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"22", "17213590", "TGTTA", null}; + String[] query = {"22", "17213589", "TGTTA", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -134,7 +134,7 @@ public void testStringAllele(@ArquillianResource URL url) throws JAXBException, @Test @Override public void testDel(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"14", "106833421", "D", null}; + String[] query = {"14", "106833420", "D", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -146,7 +146,7 @@ public void testDel(@ArquillianResource URL url) throws JAXBException, Malformed @Test @Override public void testIns(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"14", "106833421", "I", null}; + String[] query = {"14", "106833420", "I", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -158,7 +158,7 @@ public void testIns(@ArquillianResource URL url) throws JAXBException, Malformed @Test @Override public void testAllRefsNotFound(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"15", "41087870", "C", null}; + String[] query = {"15", "41087871", "C", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -170,7 +170,7 @@ public void testAllRefsNotFound(@ArquillianResource URL url) throws JAXBExceptio @Test @Override public void testInvalidAllele(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"15", "41087870", "DC", null}; + String[] query = {"15", "41087871", "DC", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -183,7 +183,7 @@ public void testInvalidAllele(@ArquillianResource URL url) throws JAXBException, @Test @Override public void testAlleleConversion(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"14", "106833421", "DEL", null}; + String[] query = {"14", "106833420", "DEL", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -196,7 +196,7 @@ public void testAlleleConversion(@ArquillianResource URL url) throws JAXBExcepti @Test @Override public void testChromConversion(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"chrom14", "106833421", "D", null}; + String[] query = {"chrom14", "106833420", "D", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -208,7 +208,7 @@ public void testChromConversion(@ArquillianResource URL url) throws JAXBExceptio @Test @Override public void testInvalidChrom(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"30", "41087870", "A", null}; + String[] query = {"30", "41087871", "A", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -221,7 +221,7 @@ public void testInvalidChrom(@ArquillianResource URL url) throws JAXBException, @Test @Override public void testChromX(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"X", "41087870", "A", null}; + String[] query = {"X", "41087871", "A", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -233,7 +233,7 @@ public void testChromX(@ArquillianResource URL url) throws JAXBException, Malfor @Test @Override public void testChromMT(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"MT", "41087870", "A", null}; + String[] query = {"MT", "41087871", "A", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); diff --git a/bob-rest/src/test/java/com/dnastack/bob/rest/NcbiResponseTest.java b/bob-rest/src/test/java/com/dnastack/bob/rest/NcbiResponseTest.java index 22c24ff..35c01e5 100644 --- a/bob-rest/src/test/java/com/dnastack/bob/rest/NcbiResponseTest.java +++ b/bob-rest/src/test/java/com/dnastack/bob/rest/NcbiResponseTest.java @@ -58,7 +58,7 @@ public class NcbiResponseTest extends AbstractResponseTest { @Test @Override public void testAllRefsFound(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"2", "41404", "A", null}; + String[] query = {"2", "41403", "A", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -70,7 +70,7 @@ public void testAllRefsFound(@ArquillianResource URL url) throws JAXBException, @Test @Override public void testSpecificRefFound(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"2", "41404", "A", "hg19"}; + String[] query = {"2", "41403", "A", "hg19"}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -82,7 +82,7 @@ public void testSpecificRefFound(@ArquillianResource URL url) throws JAXBExcepti @Test @Override public void testSpecificRefNotFound(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"2", "41404", "A", "hg38"}; + String[] query = {"2", "41403", "A", "hg38"}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -94,7 +94,7 @@ public void testSpecificRefNotFound(@ArquillianResource URL url) throws JAXBExce @Test @Override public void testInvalidRef(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"2", "41404", "A", "hg100"}; + String[] query = {"2", "41403", "A", "hg100"}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -107,7 +107,7 @@ public void testInvalidRef(@ArquillianResource URL url) throws JAXBException, Ma @Test @Override public void testRefConversion(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"2", "41404", "A", "grch37"}; + String[] query = {"2", "41403", "A", "grch37"}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -120,7 +120,7 @@ public void testRefConversion(@ArquillianResource URL url) throws JAXBException, @Test @Override public void testStringAllele(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"22", "17213590", "TGTTA", null}; + String[] query = {"22", "17213589", "TGTTA", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -132,7 +132,7 @@ public void testStringAllele(@ArquillianResource URL url) throws JAXBException, @Test @Override public void testDel(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"14", "106833421", "D", null}; + String[] query = {"14", "106833420", "D", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -144,7 +144,7 @@ public void testDel(@ArquillianResource URL url) throws JAXBException, Malformed @Test @Override public void testIns(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"14", "106833421", "I", null}; + String[] query = {"14", "106833420", "I", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -156,7 +156,7 @@ public void testIns(@ArquillianResource URL url) throws JAXBException, Malformed @Test @Override public void testAllRefsNotFound(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"15", "41087870", "C", null}; + String[] query = {"15", "41087869", "C", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -168,7 +168,7 @@ public void testAllRefsNotFound(@ArquillianResource URL url) throws JAXBExceptio @Test @Override public void testInvalidAllele(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"15", "41087870", "DC", null}; + String[] query = {"15", "41087869", "DC", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -181,7 +181,7 @@ public void testInvalidAllele(@ArquillianResource URL url) throws JAXBException, @Test @Override public void testAlleleConversion(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"14", "106833421", "DEL", null}; + String[] query = {"14", "106833420", "DEL", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -194,7 +194,7 @@ public void testAlleleConversion(@ArquillianResource URL url) throws JAXBExcepti @Test @Override public void testChromConversion(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"chrom14", "106833421", "D", null}; + String[] query = {"chrom14", "106833420", "D", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -206,7 +206,7 @@ public void testChromConversion(@ArquillianResource URL url) throws JAXBExceptio @Test @Override public void testInvalidChrom(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"30", "41087870", "A", null}; + String[] query = {"30", "41087869", "A", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -219,7 +219,7 @@ public void testInvalidChrom(@ArquillianResource URL url) throws JAXBException, @Test @Override public void testChromX(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"X", "41087870", "A", null}; + String[] query = {"X", "41087869", "A", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -231,7 +231,7 @@ public void testChromX(@ArquillianResource URL url) throws JAXBException, Malfor @Test @Override public void testChromMT(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"MT", "41087870", "A", null}; + String[] query = {"MT", "41087869", "A", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); diff --git a/bob-rest/src/test/java/com/dnastack/bob/rest/UcscResponseTest.java b/bob-rest/src/test/java/com/dnastack/bob/rest/UcscResponseTest.java index d9e4301..749e16a 100644 --- a/bob-rest/src/test/java/com/dnastack/bob/rest/UcscResponseTest.java +++ b/bob-rest/src/test/java/com/dnastack/bob/rest/UcscResponseTest.java @@ -63,7 +63,7 @@ public void testAllRefsFound(URL url) throws JAXBException, MalformedURLExceptio @Test public void testClinvar(@ArquillianResource URL url) throws JAXBException, MalformedURLException { String b = "clinvar"; - String[] query = {"1", "10042538", "T", null}; + String[] query = {"1", "10042537", "T", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(b, query)); assertNotNull(br); @@ -75,7 +75,7 @@ public void testClinvar(@ArquillianResource URL url) throws JAXBException, Malfo @Test public void testUniprot(@ArquillianResource URL url) throws JAXBException, MalformedURLException { String b = "uniprot"; - String[] query = {"1", "977028", "T", null}; + String[] query = {"1", "977027", "T", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(b, query)); assertNotNull(br); @@ -87,7 +87,7 @@ public void testUniprot(@ArquillianResource URL url) throws JAXBException, Malfo @Test public void testLovd(@ArquillianResource URL url) throws JAXBException, MalformedURLException { String b = "lovd"; - String[] query = {"1", "808922", "A", null}; + String[] query = {"1", "808921", "A", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(b, query)); assertNotNull(br); @@ -100,7 +100,7 @@ public void testLovd(@ArquillianResource URL url) throws JAXBException, Malforme @Override public void testSpecificRefFound(@ArquillianResource URL url) throws JAXBException, MalformedURLException { String b = "lovd"; - String[] query = {"1", "808922", "A", "hg19"}; + String[] query = {"1", "808921", "A", "hg19"}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(b, query)); assertNotNull(br); @@ -112,7 +112,7 @@ public void testSpecificRefFound(@ArquillianResource URL url) throws JAXBExcepti @Test @Override public void testSpecificRefNotFound(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"1", "10042538", "T", "hg38"}; + String[] query = {"1", "10042537", "T", "hg38"}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -124,7 +124,7 @@ public void testSpecificRefNotFound(@ArquillianResource URL url) throws JAXBExce @Test @Override public void testInvalidRef(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"1", "10042538", "T", "hg100"}; + String[] query = {"1", "10042537", "T", "hg100"}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -137,7 +137,7 @@ public void testInvalidRef(@ArquillianResource URL url) throws JAXBException, Ma @Test @Override public void testRefConversion(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"1", "10042538", "T", "grch37"}; + String[] query = {"1", "10042537", "T", "grch37"}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -150,7 +150,7 @@ public void testRefConversion(@ArquillianResource URL url) throws JAXBException, @Test @Override public void testStringAllele(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"1", "46403", "TGT", null}; + String[] query = {"1", "46402", "TGT", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -164,7 +164,7 @@ public void testStringAllele(@ArquillianResource URL url) throws JAXBException, @Test @Override public void testDel(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"1", "1002921", "D", null}; + String[] query = {"1", "1002920", "D", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -178,7 +178,7 @@ public void testDel(@ArquillianResource URL url) throws JAXBException, Malformed @Test @Override public void testIns(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"1", "46403", "I", null}; + String[] query = {"1", "46402", "I", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -192,7 +192,7 @@ public void testIns(@ArquillianResource URL url) throws JAXBException, Malformed @Test @Override public void testAllRefsNotFound(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"15", "41087870", "C", null}; + String[] query = {"15", "41087869", "C", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -204,7 +204,7 @@ public void testAllRefsNotFound(@ArquillianResource URL url) throws JAXBExceptio @Test @Override public void testInvalidAllele(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"15", "41087870", "DC", null}; + String[] query = {"15", "41087869", "DC", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -217,7 +217,7 @@ public void testInvalidAllele(@ArquillianResource URL url) throws JAXBException, @Test @Override public void testAlleleConversion(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"1", "1002922", "g", null}; + String[] query = {"1", "1002921", "g", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -242,7 +242,7 @@ public void testChromConversion(@ArquillianResource URL url) throws JAXBExceptio @Test @Override public void testInvalidChrom(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"30", "41087870", "A", null}; + String[] query = {"30", "41087869", "A", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -255,7 +255,7 @@ public void testInvalidChrom(@ArquillianResource URL url) throws JAXBException, @Test @Override public void testChromX(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"X", "41087870", "A", null}; + String[] query = {"X", "41087869", "A", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -267,7 +267,7 @@ public void testChromX(@ArquillianResource URL url) throws JAXBException, Malfor @Test @Override public void testChromMT(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"MT", "41087870", "A", null}; + String[] query = {"MT", "41087869", "A", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); diff --git a/bob-rest/src/test/java/com/dnastack/bob/rest/WtsiResponseTest.java b/bob-rest/src/test/java/com/dnastack/bob/rest/WtsiResponseTest.java index f235b7d..2346f8a 100644 --- a/bob-rest/src/test/java/com/dnastack/bob/rest/WtsiResponseTest.java +++ b/bob-rest/src/test/java/com/dnastack/bob/rest/WtsiResponseTest.java @@ -58,7 +58,7 @@ public class WtsiResponseTest extends AbstractResponseTest { @Test @Override public void testAllRefsFound(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"1", "808922", "A", null}; + String[] query = {"1", "808921", "A", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -70,7 +70,7 @@ public void testAllRefsFound(@ArquillianResource URL url) throws JAXBException, @Test @Override public void testSpecificRefFound(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"1", "808922", "A", "hg19"}; + String[] query = {"1", "808921", "A", "hg19"}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -82,7 +82,7 @@ public void testSpecificRefFound(@ArquillianResource URL url) throws JAXBExcepti @Test @Override public void testSpecificRefNotFound(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"1", "808922", "A", "hg38"}; + String[] query = {"1", "808921", "A", "hg38"}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -94,7 +94,7 @@ public void testSpecificRefNotFound(@ArquillianResource URL url) throws JAXBExce @Test @Override public void testInvalidRef(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"1", "808922", "A", "hg100"}; + String[] query = {"1", "808921", "A", "hg100"}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -107,7 +107,7 @@ public void testInvalidRef(@ArquillianResource URL url) throws JAXBException, Ma @Test @Override public void testRefConversion(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"1", "808922", "A", "grch37"}; + String[] query = {"1", "808921", "A", "grch37"}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -119,7 +119,7 @@ public void testRefConversion(@ArquillianResource URL url) throws JAXBException, @Test public void testFoundRef(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"13", "32888798", "A", null}; + String[] query = {"13", "32888797", "A", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -133,7 +133,7 @@ public void testFoundRef(@ArquillianResource URL url) throws JAXBException, Malf @Test @Override public void testStringAllele(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"1", "46403", "TGT", null}; + String[] query = {"1", "46402", "TGT", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -147,7 +147,7 @@ public void testStringAllele(@ArquillianResource URL url) throws JAXBException, @Test @Override public void testDel(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"1", "1002921", "D", null}; + String[] query = {"1", "1002920", "D", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -161,7 +161,7 @@ public void testDel(@ArquillianResource URL url) throws JAXBException, Malformed @Test @Override public void testIns(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"1", "46403", "I", null}; + String[] query = {"1", "46402", "I", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); @@ -252,7 +252,7 @@ public void testChromX(@ArquillianResource URL url) throws JAXBException, Malfor @Test @Override public void testChromMT(@ArquillianResource URL url) throws JAXBException, MalformedURLException { - String[] query = {"MT", "2", "A", null}; + String[] query = {"MT", "1", "A", null}; BeaconResponseTo br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); From 148dd14b0431de2b9756178188a01899fd0a4c26 Mon Sep 17 00:00:00 2001 From: rohan katyal Date: Tue, 17 Mar 2015 23:01:58 +0530 Subject: [PATCH 8/8] minor changes & bug fixes exists is a boolean parameter context update in README.md error parameter only returned when required parameters are missing --- beacon-adapters/beacon-java/README.md | 8 ++-- .../entity/resources/ResponseResource.java | 8 ++-- .../dnastack/beacon/rest/BeaconResource.java | 6 ++- .../beacon/service/SampleBeaconService.java | 13 ++++- .../beacon/rest/BeaconResourceTest.java | 10 +++- beacon-adapters/beacon-nodejs/README.md | 4 +- beacon-adapters/beacon-nodejs/beacon.js | 27 +++++++++-- beacon-adapters/beacon-python/README.md | 6 +-- beacon-adapters/beacon-python/beacon.py | 47 +++++++++++++++++-- .../java/com/dnastack/bob/dao/BeaconDao.java | 1 + 10 files changed, 104 insertions(+), 26 deletions(-) diff --git a/beacon-adapters/beacon-java/README.md b/beacon-adapters/beacon-java/README.md index 5479f4e..84067ab 100644 --- a/beacon-adapters/beacon-java/README.md +++ b/beacon-adapters/beacon-java/README.md @@ -17,8 +17,8 @@ All you need to build this project is Java 7.0 (Java SDK 1.7) or later, Maven 3. ##How to run it Start the JBoss server: - For Linux: JBOSS_HOME/bin/standalone.sh - For Windows: JBOSS_HOME\bin\standalone.bat + For Linux/Unix: JBOSS_HOME/bin/standalone.sh + For Windows: JBOSS_HOME\bin\standalone.bat Build and deploy the archive: @@ -45,8 +45,8 @@ In order to create your own beacon, we suggest you do the following: The API takes care of the rest and provides the following endpoints upon deployment of your beacon: - http://localhost:8080/beacon-java/rest/info - information about your beacon - http://localhost:8080/beacon-java/rest/query - access to query service + http://localhost:8080/beacon-java/info - information about your beacon + http://localhost:8080/beacon-java/query - access to query service ##Technologies Java EE. CDI, JAX-RS, JAXB. Tested with Arquillian/ShrinkWrap. diff --git a/beacon-adapters/beacon-java/src/main/java/com/dnastack/beacon/entity/resources/ResponseResource.java b/beacon-adapters/beacon-java/src/main/java/com/dnastack/beacon/entity/resources/ResponseResource.java index 34f266d..6a43380 100644 --- a/beacon-adapters/beacon-java/src/main/java/com/dnastack/beacon/entity/resources/ResponseResource.java +++ b/beacon-adapters/beacon-java/src/main/java/com/dnastack/beacon/entity/resources/ResponseResource.java @@ -4,7 +4,7 @@ public class ResponseResource { - private String exists; + private Boolean exists; private Integer observed; private List alleles; private String info; @@ -14,7 +14,7 @@ public class ResponseResource { * required field(s): exists * observed is an Integer with min value 0 */ - public ResponseResource(String exists, Integer observed, List alleles, String info, ErrorResource error) { + public ResponseResource(Boolean exists, Integer observed, List alleles, String info, ErrorResource error) { this.exists = exists; this.observed = observed; this.alleles = alleles; @@ -26,11 +26,11 @@ public ResponseResource() { // needed for JAXB } - public String getExists() { + public Boolean getExists() { return exists; } - public void setExists(String exists) { + public void setExists(Boolean exists) { this.exists = exists; } diff --git a/beacon-adapters/beacon-java/src/main/java/com/dnastack/beacon/rest/BeaconResource.java b/beacon-adapters/beacon-java/src/main/java/com/dnastack/beacon/rest/BeaconResource.java index 28ff820..84bd1ea 100644 --- a/beacon-adapters/beacon-java/src/main/java/com/dnastack/beacon/rest/BeaconResource.java +++ b/beacon-adapters/beacon-java/src/main/java/com/dnastack/beacon/rest/BeaconResource.java @@ -24,7 +24,9 @@ package com.dnastack.beacon.rest; import com.dnastack.beacon.entity.BeaconResponse; +import com.dnastack.beacon.entity.resources.ResponseResource; import com.dnastack.beacon.service.BeaconService; + import javax.inject.Inject; import javax.ws.rs.GET; import javax.ws.rs.Path; @@ -47,6 +49,8 @@ public class BeaconResource { @GET public BeaconResponse query(@QueryParam("chrom") String chrom, @QueryParam("pos") Long pos, @QueryParam("allele") String allele, @QueryParam("ref") String ref, @QueryParam("dataset") String dataset) { - return service.query(chrom, pos, allele, ref, dataset); + + return service.query(chrom, pos, allele, ref, dataset); + } } diff --git a/beacon-adapters/beacon-java/src/main/java/com/dnastack/beacon/service/SampleBeaconService.java b/beacon-adapters/beacon-java/src/main/java/com/dnastack/beacon/service/SampleBeaconService.java index 4d4508e..14d95a9 100644 --- a/beacon-adapters/beacon-java/src/main/java/com/dnastack/beacon/service/SampleBeaconService.java +++ b/beacon-adapters/beacon-java/src/main/java/com/dnastack/beacon/service/SampleBeaconService.java @@ -29,6 +29,7 @@ import com.dnastack.beacon.entity.Beacon; import com.dnastack.beacon.entity.BeaconResponse; import com.dnastack.beacon.entity.resources.DataSetResource; +import com.dnastack.beacon.entity.resources.ErrorResource; import com.dnastack.beacon.entity.resources.QueryResource; import com.dnastack.beacon.entity.resources.ResponseResource; import com.dnastack.beacon.util.QueryUtils; @@ -53,8 +54,18 @@ public class SampleBeaconService implements BeaconService { @Override public BeaconResponse query(String chrom, Long pos, String allele, String ref, String dataset) { + + // required parameters are missing + if (chrom == null || pos == null || allele == null || ref == null) { + ErrorResource errorResource = new ErrorResource("Incomplete Query", "Required parameters are missing"); + ResponseResource responseResource = new ResponseResource(null, null, null, null, errorResource); + BeaconResponse response = new BeaconResponse(beacon.getId(), QueryUtils.getQuery(chrom, pos, allele, ref, dataset), responseResource); + return response; + } + BeaconResponse response = new BeaconResponse(beacon.getId(), QueryUtils.getQuery(chrom, pos, allele, ref, dataset), null); - ResponseResource responseResource = new ResponseResource("true", 0, null, "bla", null); + ResponseResource responseResource = new ResponseResource(true, 0, null, "bla", null); + // generate a sample response if (pos % 2 == 0) { response.setResponse(responseResource); diff --git a/beacon-adapters/beacon-java/src/test/java/com/dnastack/beacon/rest/BeaconResourceTest.java b/beacon-adapters/beacon-java/src/test/java/com/dnastack/beacon/rest/BeaconResourceTest.java index bee37d6..f9acb1d 100644 --- a/beacon-adapters/beacon-java/src/test/java/com/dnastack/beacon/rest/BeaconResourceTest.java +++ b/beacon-adapters/beacon-java/src/test/java/com/dnastack/beacon/rest/BeaconResourceTest.java @@ -24,13 +24,17 @@ package com.dnastack.beacon.rest; import com.dnastack.beacon.entity.BeaconResponse; +import com.dnastack.beacon.entity.resources.ResponseResource; + import java.net.MalformedURLException; import java.net.URL; + import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBElement; import javax.xml.bind.JAXBException; import javax.xml.bind.Unmarshaller; import javax.xml.transform.stream.StreamSource; + import org.eclipse.persistence.jaxb.JAXBContextProperties; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.container.test.api.RunAsClient; @@ -110,7 +114,8 @@ public void testTrueQuery(@ArquillianResource URL url) throws JAXBException, Mal BeaconResponse br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); - assertTrue(br.getResponse()); + ResponseResource response = br.getResponse(); + assertTrue(response.getExists()); } @Test @@ -119,7 +124,8 @@ public void testFalseQuery(@ArquillianResource URL url) throws JAXBException, Ma BeaconResponse br = readBeaconResponse(url.toExternalForm() + getUrl(BEACON, query)); assertNotNull(br); - assertFalse(br.getResponse()); + ResponseResource response = br.getResponse(); + assertTrue(response.getExists()); } } diff --git a/beacon-adapters/beacon-nodejs/README.md b/beacon-adapters/beacon-nodejs/README.md index b259f5f..0e0ed49 100644 --- a/beacon-adapters/beacon-nodejs/README.md +++ b/beacon-adapters/beacon-nodejs/README.md @@ -28,8 +28,8 @@ In order to implement a beacon, simply override beacon details and query functio The API takes care of the rest and provides the following endpoints when you start your beacon: - http://localhost:8080/beacon-nodejs/rest/info - information about your beacon - http://localhost:8080/beacon-nodejs/rest/query - access to query service + http://localhost:8080/beacon-nodejs/info - information about your beacon + http://localhost:8080/beacon-nodejs/query - access to query service Query example: diff --git a/beacon-adapters/beacon-nodejs/beacon.js b/beacon-adapters/beacon-nodejs/beacon.js index 43c8e1b..5a46005 100644 --- a/beacon-adapters/beacon-nodejs/beacon.js +++ b/beacon-adapters/beacon-nodejs/beacon.js @@ -138,20 +138,37 @@ function query(req, res, next) { // generate response // required field(s): exists var response = { - 'exists': 'True', + 'exists': true, 'observed': 0, // integer, min 0 'alleles': [ AlleleResource ], 'info': 'response information', - 'error': ErrorResource }; //--------------------------------------------------------------// - var query = {'chromosome': chromosome, 'position': position, 'allele': allele, 'reference': reference, 'dataset': dataset}; + var query = { + 'chromosome': chromosome, + 'position': position, + 'allele': allele, + 'reference': reference, + 'dataset': dataset + }; + + if (query['chromosome'] == undefined || query['position'] == undefined || query['allele'] == undefined || query['reference'] == undefined) { + + ErrorResource['name'] = 'Incomplete Query'; + ErrorResource['description'] = 'Required parameters are misssing'; + + response = { + 'exists': null, + 'error': ErrorResource + }; + + } - res.send({"beacon": beacon, "query": query, 'response': response}); + res.send({"beacon": beacon["id"], "query": query, 'response': response}); next(); } @@ -167,7 +184,7 @@ server.get('/beacon-nodejs/info', info); server.head('/beacon-nodejs/info', info); server.get('/beacon-nodejs/query', query); server.head('/beacon-nodejs/query', query); -server.get('/beacon-nodejs', welcome); +server.get('/beacon-nodejs/', welcome); server.listen(8080, function () { console.log('%s listening at %s', server.name, server.url); diff --git a/beacon-adapters/beacon-python/README.md b/beacon-adapters/beacon-python/README.md index 3fd66fa..70b77d8 100644 --- a/beacon-adapters/beacon-python/README.md +++ b/beacon-adapters/beacon-python/README.md @@ -31,12 +31,12 @@ In order to implement a beacon, simply override beacon details and query functio The API takes care of the rest and provides the following endpoints when you start your beacon: - http://127.0.0.1:5000/beacon-python/rest/info - information about your beacon - http://127.0.0.1:5000/beacon-python/rest/query - access to query service + http://127.0.0.1:5000/beacon-python/info - information about your beacon + http://127.0.0.1:5000/beacon-python/query - access to query service Query example: - GET http://127.0.0.1:5000/beacon-python/rest/query?chrom=15&pos=41087870&allele=A&ref=hg19 + GET http://127.0.0.1:5000/beacon-python/query?chrom=15&pos=41087870&allele=A&ref=hg19 ##Technologies Python, Flask. diff --git a/beacon-adapters/beacon-python/beacon.py b/beacon-adapters/beacon-python/beacon.py index f3e948c..16410e2 100755 --- a/beacon-adapters/beacon-python/beacon.py +++ b/beacon-adapters/beacon-python/beacon.py @@ -26,8 +26,29 @@ from flask import Flask, jsonify, request +class IncompleteQuery(Exception): + status_code = 400 + + def __init__(self, message, status_code=None, payload=None, ErrorResource=None, query=None, beacon_id=None): + Exception.__init__(self) + self.message = message + if status_code is not None: + self.status_code = status_code + self.payload = payload + self.ErrorResource = ErrorResource + self.query = query + self.beacon_id = beacon_id + + def to_dict(self): + rv = dict(self.payload or ()) + rv["beacon"] = self.beacon_id + rv["query"] = self.query + rv['error'] = self.ErrorResource + return rv + app = Flask(__name__) + #--------------- Information endpont (start) --------------------# # TODO: override with the details of your beacon @@ -145,18 +166,37 @@ def query(): AlleleResource ], 'info': u'response information', - 'error': ErrorResource } + query = { + 'chromosome' : chromosome, + 'position' : position, + 'allele' : allele, + 'reference' : reference, + 'dataset_id': dataset + } + + if query['chromosome'] is None or query['position'] is None or query['allele'] is None or query['reference'] is None: + ErrorResource['description'] = 'Required parameters are missing' + ErrorResource['name'] = 'Incomplete Query' + raise IncompleteQuery('IncompleteQuery', status_code=410, ErrorResource=ErrorResource, query=query, beacon_id=beacon["id"]) + + #--------------------------------------------------------------# - return jsonify({ "beacon" : beacon['id'], "query" : { 'chromosome' : chromosome, 'position' : position, 'allele' : allele, 'reference' : reference, 'dataset_id': dataset }, 'response' : response }) + return jsonify({ "beacon" : beacon['id'], "query" : query, "response" : response }) # info function -@app.route('/beacon-python', methods=['GET']) +@app.route('/beacon-python/', methods=['GET']) def welcome(): return 'WELCOME!!! Beacon of Beacons Project (BoB) provides a unified REST API to publicly available GA4GH Beacons. BoB standardizes the way beacons are accessed and aggregates their results, thus addressing one of the missing parts of the Beacon project itself. BoB was designed with ease of programmatic access in mind. It provides XML, JSON and plaintext responses to accommodate needs of all the clients across all the programming languages. The API to use is determined using the header supplied by the client in its GET request, e.g.: "Accept: application/json".' +# required parameters missing +@app.errorhandler(IncompleteQuery) +def handle_invalid_usage(error): + response = jsonify(error.to_dict()) + return response + # page not found @app.errorhandler(404) def not_found(error): @@ -164,4 +204,3 @@ def not_found(error): if __name__ == '__main__': app.run() - diff --git a/bob-data/src/main/java/com/dnastack/bob/dao/BeaconDao.java b/bob-data/src/main/java/com/dnastack/bob/dao/BeaconDao.java index 4b1a65f..7352f04 100644 --- a/bob-data/src/main/java/com/dnastack/bob/dao/BeaconDao.java +++ b/bob-data/src/main/java/com/dnastack/bob/dao/BeaconDao.java @@ -21,6 +21,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.dnastack.bob.dao; import com.dnastack.bob.entity.Beacon;