From: Charles Ofoegbu Date: Tue, 21 Oct 2014 14:07:43 +0000 (+0100) Subject: Modified example query string for different Intermine descendants X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=d711cefe41664274ff4c9c39c13a10c5d889284e;p=jalview.git Modified example query string for different Intermine descendants --- diff --git a/src/jalview/ws/HttpClientUtils.java b/src/jalview/ws/HttpClientUtils.java index 4b6129f..dccf19b 100644 --- a/src/jalview/ws/HttpClientUtils.java +++ b/src/jalview/ws/HttpClientUtils.java @@ -89,11 +89,10 @@ public class HttpClientUtils { HttpClient httpclient = new DefaultHttpClient(); HttpGet httpget = new HttpGet(getUrl); - // httpget.setParams(params); + String responseString = ""; HttpResponse response = httpclient.execute(httpget); HttpEntity resEntity = response.getEntity(); - if (resEntity != null) { BufferedReader r = new BufferedReader(new InputStreamReader( @@ -105,12 +104,9 @@ public class HttpClientUtils { responseBuilder.append(aux); } - return responseBuilder.toString(); - } - else - { - return null; + responseString = responseBuilder.toString(); } + return responseString; } public static BufferedReader doHttpMpartFilePost(String postUrl, diff --git a/src/jalview/ws/dbsources/FlyMine.java b/src/jalview/ws/dbsources/FlyMine.java index d597608..99bf4fb 100644 --- a/src/jalview/ws/dbsources/FlyMine.java +++ b/src/jalview/ws/dbsources/FlyMine.java @@ -9,14 +9,13 @@ public class FlyMine extends Intermine this.name = "FlyMine"; this.baseUrl = "http://www.flymine.org/query"; this.domain = "7227"; - this.testQuery = "2L"; + this.testQuery = "2L:1-500"; } @Override public AlignmentI getSequenceRecords(String queries) throws Exception { - return getAlignmentData(baseUrl, queries, domain, seqStart, - seqEnd); + return getAlignmentData(baseUrl, queries, domain); } } diff --git a/src/jalview/ws/dbsources/Intermine.java b/src/jalview/ws/dbsources/Intermine.java index d319c50..7863409 100644 --- a/src/jalview/ws/dbsources/Intermine.java +++ b/src/jalview/ws/dbsources/Intermine.java @@ -29,7 +29,7 @@ public abstract class Intermine extends DbSourceProxyImpl protected String baseUrl = ""; - protected String testQuery = ""; + protected String testQuery = "seqRef:start-end"; @Override public String getDbSource() @@ -76,7 +76,7 @@ public abstract class Intermine extends DbSourceProxyImpl @SuppressWarnings("unchecked") public Alignment getAlignmentData(String baseUrl, String query, - String domain, int seqStart, int seqEnd) + String domain) { StringTokenizer queries = new StringTokenizer(query, ";"); @@ -89,7 +89,6 @@ public abstract class Intermine extends DbSourceProxyImpl { String uniquequery = queries.nextToken(); String seqRef = uniquequery; - // StringTokenizer queryParam = new StringTokenizer(uniquequery, ":"); String[] queryParam = uniquequery.split(":"); if (queryParam.length > 1) { @@ -107,13 +106,14 @@ public abstract class Intermine extends DbSourceProxyImpl seqRef, domain, seqStart, seqEnd, true); String rawAnnotationData = fetchData(baseUrl, - uniquequery, domain, seqStart, seqEnd, false); + seqRef, domain, + seqStart, seqEnd, false); stopQuery(); String sequenceString = ""; - // System.out.println("Sequence data: " + rawSequenceData); - // System.out.println("Annotation data : " + rawAnnotationData); + System.out.println("Sequence data: " + rawSequenceData); + System.out.println("Annotation data : " + rawAnnotationData); JSONParser jsonParser = new JSONParser(); JSONObject rawSeqJson = (JSONObject) jsonParser .parse(rawSequenceData); @@ -129,7 +129,7 @@ public abstract class Intermine extends DbSourceProxyImpl int start = Integer.valueOf(feature.get("start").toString()); int end = Integer.valueOf(feature.get("end").toString()); - retrievedSeq[count++] = new Sequence(uniquequery, sequenceString, + retrievedSeq[count++] = new Sequence(seqRef, sequenceString, start, end); } @@ -148,7 +148,8 @@ public abstract class Intermine extends DbSourceProxyImpl { String resourceUrl = baseUrl + "/service/jbrowse/" + domain + "/features/" + seqRef + "?start=" + start + "&end=" + end - + "&reference=" + fetchRef; + + ((fetchRef) ? "&reference=true" : ""); + System.out.println("resource url : " + resourceUrl); return HttpClientUtils.doHttpUrlGet(resourceUrl); } diff --git a/src/jalview/ws/dbsources/ModMine.java b/src/jalview/ws/dbsources/ModMine.java index c8c0d0d..d521f16 100644 --- a/src/jalview/ws/dbsources/ModMine.java +++ b/src/jalview/ws/dbsources/ModMine.java @@ -9,13 +9,13 @@ public class ModMine extends Intermine this.name = "ModMine"; this.baseUrl = "http://intermine.modencode.org/modminetest"; this.domain = "7227"; - this.testQuery = "2L"; + this.testQuery = "2L:1-500"; } @Override public AlignmentI getSequenceRecords(String queries) throws Exception { - return getAlignmentData(baseUrl, queries, domain, seqStart, seqEnd); + return getAlignmentData(baseUrl, queries, domain); } } diff --git a/src/jalview/ws/dbsources/MouseMine.java b/src/jalview/ws/dbsources/MouseMine.java index 15306c11..409ec17 100644 --- a/src/jalview/ws/dbsources/MouseMine.java +++ b/src/jalview/ws/dbsources/MouseMine.java @@ -15,7 +15,7 @@ public class MouseMine extends Intermine @Override public AlignmentI getSequenceRecords(String queries) throws Exception { - return getAlignmentData(baseUrl, queries, domain, seqStart, seqEnd); + return getAlignmentData(baseUrl, queries, domain); } } diff --git a/src/jalview/ws/dbsources/RatMine.java b/src/jalview/ws/dbsources/RatMine.java index 25dfb46..0fcfd3a 100644 --- a/src/jalview/ws/dbsources/RatMine.java +++ b/src/jalview/ws/dbsources/RatMine.java @@ -16,7 +16,7 @@ public class RatMine extends Intermine @Override public AlignmentI getSequenceRecords(String queries) throws Exception { - return getAlignmentData(baseUrl, queries, domain, seqStart, seqEnd); + return getAlignmentData(baseUrl, queries, domain); } } diff --git a/src/jalview/ws/dbsources/YeastMine.java b/src/jalview/ws/dbsources/YeastMine.java index 15fa8fe..a01fa72 100644 --- a/src/jalview/ws/dbsources/YeastMine.java +++ b/src/jalview/ws/dbsources/YeastMine.java @@ -9,13 +9,13 @@ public class YeastMine extends Intermine this.name = "YeastMine"; this.baseUrl = "http://yeastmine.yeastgenome.org/yeastmine"; this.domain = "4932"; - this.testQuery = "chrI"; + this.testQuery = "chrI:1-500"; } @Override public AlignmentI getSequenceRecords(String queries) throws Exception { - return getAlignmentData(baseUrl, queries, domain, seqStart, seqEnd); + return getAlignmentData(baseUrl, queries, domain); }