import jalview.datamodel.AlignmentI;
import jalview.datamodel.DBRefSource;
import jalview.datamodel.GeneLociI;
+import jalview.datamodel.GeneLocus;
+import jalview.datamodel.Mapping;
import jalview.util.MapList;
import java.io.IOException;
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";
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);
final String chr = chromosome;
List<int[]> fromRange = Collections.singletonList(new int[] { 1,
fromEnd });
- final MapList map = new MapList(fromRange, regions, 1, 1);
- return new GeneLociI()
- {
-
- @Override
- public String getSpeciesId()
- {
- return species == null ? "" : species;
- }
-
- @Override
- public String getAssemblyId()
- {
- return as;
- }
-
- @Override
- public String getChromosomeId()
- {
- return chr;
- }
-
- @Override
- public MapList getMap()
- {
- return map;
- }
- };
+ Mapping mapping = new Mapping(new MapList(fromRange, regions, 1, 1));
+ return new GeneLocus(species == null ? "" : species, as, chr,
+ mapping);
} catch (IOException | ParseException | NumberFormatException e)
{
// ignore