JAL-3210 Barebones gradle/buildship/eclipse. See README
[jalview.git] / src / jalview / ext / ensembl / EnsemblMap.java
index 9789819..e9f1af1 100644 (file)
@@ -3,8 +3,10 @@ package jalview.ext.ensembl;
 import jalview.datamodel.AlignmentI;
 import jalview.datamodel.DBRefSource;
 import jalview.datamodel.GeneLociI;
+import jalview.util.JSONUtils;
 import jalview.util.MapList;
 
+import java.io.BufferedReader;
 import java.io.IOException;
 import java.net.MalformedURLException;
 import java.net.URL;
@@ -16,6 +18,18 @@ import java.util.Map;
 
 import org.json.simple.parser.ParseException;
 
+/**
+ * A client for the Ensembl REST service /map endpoint, to convert from
+ * coordinates of one genome assembly to another.
+ * <p>
+ * Note that species and assembly identifiers passed to this class must be valid
+ * in Ensembl. They are not case sensitive.
+ * 
+ * @author gmcarstairs
+ * @see https://rest.ensembl.org/documentation/info/assembly_map
+ * @see https://rest.ensembl.org/info/assembly/human?content-type=text/xml
+ * @see https://rest.ensembl.org/info/species?content-type=text/xml
+ */
 public class EnsemblMap extends EnsemblRestClient
 {
   private static final String MAPPED = "mapped";
@@ -152,9 +166,7 @@ public class EnsemblMap extends EnsemblRestClient
     {
       Iterator<Object> rvals = (Iterator<Object>) getJSON(url, null, -1, MODE_ITERATOR, MAPPINGS);
       if (rvals == null)
-      {
-        return null;
-      }
+         return null;
       while (rvals.hasNext())
       {
         // todo check for "mapped"
@@ -221,7 +233,7 @@ public class EnsemblMap extends EnsemblRestClient
     URL url = null;
     try
     {
-      String domain = EnsemblInfo.getDomain(division);
+      String domain = new EnsemblInfo().getDomain(division);
       if (domain != null)
       {
         url = getIdMapUrl(domain, accession, start, end, cdsOrCdna);
@@ -286,9 +298,7 @@ GeneLociI parseIdMappingResponse(URL url, String accession,
     {
       Iterator<Object> rvals = (Iterator<Object>) getJSON(url, null, -1, MODE_ITERATOR, MAPPINGS);
       if (rvals == null)
-      {
-        return null;
-      }
+         return null;
       String assembly = null;
       String chromosome = null;
       int fromEnd = 0;