*/
package jalview.ext.ensembl;
-import jalview.datamodel.AlignmentI;
-import jalview.datamodel.DBRefEntry;
-import jalview.util.DBRefUtils;
-import jalview.util.JSONUtils;
-
-import java.io.BufferedReader;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import org.json.simple.parser.ParseException;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.DBRefEntry;
+import jalview.util.DBRefUtils;
+
/**
* A class to fetch cross-references from Ensembl by calling the /xrefs REST
* service
try
{
- Iterator<Object> rvals = (Iterator<Object>) getJSON(getUrl(identifier), ids, -1, MODE_ITERATOR, null);
+ Iterator<Object> rvals = (Iterator<Object>) getJSON(
+ getUrl(identifier), ids, -1, MODE_ITERATOR, null);
while (rvals.hasNext())
{
Map<String, Object> val = (Map<String, Object>) rvals.next();
String db = val.get("dbname").toString();
String id = val.get("primary_id").toString();
- if (db != null && id != null
- && !GO_GENE_ONTOLOGY.equals(db))
+ if (db != null && id != null && !GO_GENE_ONTOLOGY.equals(db))
{
db = DBRefUtils.getCanonicalName(db);
DBRefEntry dbref = new DBRefEntry(db, getXRefVersion(), id);
return result;
}
-// /**
-// * Parses "primary_id" and "dbname" values from the JSON response and
-// * constructs a DBRefEntry. Returns a list of the DBRefEntry created. Note we
-// * don't parse "synonyms" as they appear to be either redirected or obsolete
-// * in Uniprot.
-// *
-// * @param br
-// * @return
-// * @throws IOException
-// */
-// @SuppressWarnings("unchecked")
-//protected List<DBRefEntry> parseResponse(BufferedReader br)
-// throws IOException
-// {
-// return result;
-// }
-//
+ // /**
+ // * Parses "primary_id" and "dbname" values from the JSON response and
+ // * constructs a DBRefEntry. Returns a list of the DBRefEntry created. Note
+ // we
+ // * don't parse "synonyms" as they appear to be either redirected or obsolete
+ // * in Uniprot.
+ // *
+ // * @param br
+ // * @return
+ // * @throws IOException
+ // */
+ // @SuppressWarnings("unchecked")
+ // protected List<DBRefEntry> parseResponse(BufferedReader br)
+ // throws IOException
+ // {
+ // return result;
+ // }
+ //
private String xrefVersion = "ENSEMBL:0";
/**
*/
protected URL getUrl(String identifier)
{
- String url = getDomain() + "/xrefs/id/" + identifier
- + CONTENT_TYPE_JSON + "&all_levels=1";
+ String url = getDomain() + "/xrefs/id/" + identifier + CONTENT_TYPE_JSON
+ + "&all_levels=1";
try
{
return new URL(url);