JAL-1479 Refactored Sifts configuration preference in order to rectify applet build
[jalview.git] / src / jalview / structure / StructureSelectionManager.java
index 1541a6a..678bf3b 100644 (file)
@@ -37,6 +37,7 @@ import jalview.util.MappingUtils;
 import jalview.util.MessageManager;
 import jalview.ws.sifts.SiftsClient;
 import jalview.ws.sifts.SiftsException;
+import jalview.ws.sifts.SiftsSettings;
 
 import java.io.PrintStream;
 import java.util.ArrayList;
@@ -373,8 +374,7 @@ public class StructureSelectionManager
       }
     }
     PDBfile pdb = null;
-    boolean isMapUsingSIFTs = Boolean.valueOf(jalview.bin.Cache.getDefault(
-            "MAP_WITH_SIFTS", "false"));
+    boolean isMapUsingSIFTs = SiftsSettings.isMapWithSifts();
     SiftsClient siftsClient = null;
     try
     {
@@ -588,9 +588,7 @@ public class StructureSelectionManager
             .getMappingFromS1(false);
     maxChain.transferRESNUMFeatures(seq, null);
 
-    // allocate enough slots to store the mapping from positions in
-    // sequence[s] to the associated chain
-    int[][] mapping = new int[seq.findPosition(seq.getLength()) + 2][2];
+    HashMap<Integer, int[]> mapping = new HashMap<Integer, int[]>();
     int resNum = -10000;
     int index = 0;
 
@@ -604,8 +602,8 @@ public class StructureSelectionManager
         {
           // TODO (JAL-1836) address root cause: negative residue no in PDB
           // file
-          mapping[tmp.alignmentMapping + 1][0] = tmp.resNumber;
-          mapping[tmp.alignmentMapping + 1][1] = tmp.atomIndex;
+          mapping.put(tmp.alignmentMapping + 1, new int[] { tmp.resNumber,
+              tmp.atomIndex });
         }
       }