JAL-1807 explicit imports (jalview.io.*)
[jalview.git] / src / jalview / io / vamsas / Sequencemapping.java
index 4929a06..9bdd6b3 100644 (file)
  */
 package jalview.io.vamsas;
 
+import jalview.bin.Cache;
 import jalview.datamodel.AlignedCodonFrame;
 import jalview.datamodel.AlignmentI;
+import jalview.datamodel.DBRefEntry;
 import jalview.datamodel.Mapping;
 import jalview.datamodel.SequenceI;
 import jalview.gui.Desktop;
 import jalview.io.VamsasAppDatastore;
+import jalview.structure.StructureSelectionManager;
+import jalview.util.MapList;
 
 import java.util.Vector;
 
@@ -34,14 +38,15 @@ import uk.ac.vamsas.objects.core.DataSet;
 import uk.ac.vamsas.objects.core.Sequence;
 import uk.ac.vamsas.objects.core.SequenceMapping;
 import uk.ac.vamsas.objects.core.SequenceType;
+import uk.ac.vamsas.objects.utils.SymbolDictionary;
 
 /**
  * binds a vamsas sequence mapping object from the vamsas document to a maplist
  * object associated with a mapping in the Jalview model. We use the maplist
  * object because these are referred to both in the Mapping object associated
- * with a jalview.datamodel.DBRefEntry and in the array of
- * jalview.datamodel.AlCodonFrame objects that Jalview uses to propagate
- * sequence mapping position highlighting across the views.
+ * with a DBRefEntry and in the array of jalview.datamodel.AlCodonFrame objects
+ * that Jalview uses to propagate sequence mapping position highlighting across
+ * the views.
  * 
  * @author JimP
  * 
@@ -51,7 +56,7 @@ public class Sequencemapping extends Rangetype
   public Sequencemapping(VamsasAppDatastore datastore,
           SequenceMapping sequenceMapping)
   {
-    super(datastore, sequenceMapping, jalview.util.MapList.class);
+    super(datastore, sequenceMapping, MapList.class);
     doJvUpdate();
   }
 
@@ -71,7 +76,7 @@ public class Sequencemapping extends Rangetype
    * @param ds
    */
   public Sequencemapping(VamsasAppDatastore datastore,
-          jalview.datamodel.Mapping mjvmapping,
+ Mapping mjvmapping,
           uk.ac.vamsas.objects.core.SequenceType from,
           uk.ac.vamsas.objects.core.DataSet ds)
   {
@@ -96,13 +101,13 @@ public class Sequencemapping extends Rangetype
     }
     if (from != null && sequenceMapping.getLoc() != from)
     {
-      jalview.bin.Cache.log.warn("Probable IMPLEMENTATION ERROR: " + from
+      Cache.log.warn("Probable IMPLEMENTATION ERROR: " + from
               + " doesn't match the local mapping sequence.");
     }
     if (ds != null && sequenceMapping.is__stored_in_document()
             && sequenceMapping.getV_parent() != ds)
     {
-      jalview.bin.Cache.log
+      Cache.log
               .warn("Probable IMPLEMENTATION ERROR: "
                       + ds
                       + " doesn't match the parent of the bound sequence mapping object.");
@@ -132,7 +137,7 @@ public class Sequencemapping extends Rangetype
 
   public void updateFromDoc()
   {
-    update((SequenceMapping) vobj, (jalview.datamodel.Mapping) jvobj);
+    update((SequenceMapping) vobj, (Mapping) jvobj);
   }
 
   private void conflict(Mapping mjvmapping, SequenceMapping sequenceMapping)
@@ -152,7 +157,7 @@ public class Sequencemapping extends Rangetype
     SequenceType to = (SequenceType) getjv2vObj(jvto);
     if (to == null)
     {
-      jalview.bin.Cache.log
+      Cache.log
               .warn("FIXME NONFATAL - do a second update: Ignoring Forward Reference to seuqence not yet bound to vamsas seuqence object");
       return;
     }
@@ -162,10 +167,10 @@ public class Sequencemapping extends Rangetype
     boolean dnaToProt = false, sense = false;
     // ensure that we create a mapping with the correct sense
     if (((Sequence) sequenceMapping.getLoc()).getDictionary().equals(
-            uk.ac.vamsas.objects.utils.SymbolDictionary.STANDARD_NA))
+            SymbolDictionary.STANDARD_NA))
     {
       if (((Sequence) sequenceMapping.getMap()).getDictionary().equals(
-              uk.ac.vamsas.objects.utils.SymbolDictionary.STANDARD_AA))
+              SymbolDictionary.STANDARD_AA))
       {
         dnaToProt = true;
         sense = true;
@@ -174,7 +179,7 @@ public class Sequencemapping extends Rangetype
     else
     {
       if (((Sequence) sequenceMapping.getMap()).getDictionary().equals(
-              uk.ac.vamsas.objects.utils.SymbolDictionary.STANDARD_NA))
+              SymbolDictionary.STANDARD_NA))
       {
         dnaToProt = true;
         sense = false;
@@ -183,7 +188,7 @@ public class Sequencemapping extends Rangetype
 
     if (!dnaToProt)
     {
-      jalview.bin.Cache.log
+      Cache.log
               .warn("Ignoring Mapping - don't support protein to protein mapping in vamsas document yet.");
       return;
     }
@@ -223,28 +228,28 @@ public class Sequencemapping extends Rangetype
     // mapping
     bindjvvobj(mjvmapping.getMap(), sequenceMapping);
 
-    jalview.bin.Cache.log.debug("Successfully created mapping "
+    Cache.log.debug("Successfully created mapping "
             + sequenceMapping.getVorbaId());
   }
 
-  // private void update(jalview.util.MapList mjvmapping,
+  // private void update(MapList mjvmapping,
   // SequenceMapping sequenceMapping)
   {
-    jalview.bin.Cache.log
+    Cache.log
             .error("Not implemented: Jalview Update Alcodon Mapping:TODO!");
   }
 
   private void update(SequenceMapping sequenceMapping,
-          jalview.datamodel.Mapping mjvmapping)
+ Mapping mjvmapping)
   {
-    jalview.bin.Cache.log
+    Cache.log
             .error("Not implemented: Update DBRef Mapping from Jalview");
   }
 
-  private void update(jalview.datamodel.Mapping mjvmapping,
+  private void update(Mapping mjvmapping,
           SequenceMapping sequenceMapping)
   {
-    jalview.bin.Cache.log
+    Cache.log
             .error("Not implemented: Jalview Update Sequence DBRef Mapping");
   }
 
@@ -281,7 +286,7 @@ public class Sequencemapping extends Rangetype
     }
     if (sdloc == null || sdmap == null)
     {
-      jalview.bin.Cache.log.info("Ignoring non sequence-sequence mapping");
+      Cache.log.info("Ignoring non sequence-sequence mapping");
       return;
     }
     mobj = this.getvObj2jv(sdloc);
@@ -297,16 +302,16 @@ public class Sequencemapping extends Rangetype
     if (from == null || to == null)
     {
 
-      jalview.bin.Cache.log
+      Cache.log
               .error("Probable Vamsas implementation error : unbound dataset sequences involved in a mapping are being parsed!");
       return;
     }
 
     if (sdloc.getDictionary().equals(
-            uk.ac.vamsas.objects.utils.SymbolDictionary.STANDARD_NA))
+SymbolDictionary.STANDARD_NA))
     {
       if (sdmap.getDictionary().equals(
-              uk.ac.vamsas.objects.utils.SymbolDictionary.STANDARD_AA))
+SymbolDictionary.STANDARD_AA))
       {
         dnaToProt = true;
         sense = true;
@@ -318,7 +323,7 @@ public class Sequencemapping extends Rangetype
     else
     {
       if (sdmap.getDictionary().equals(
-              uk.ac.vamsas.objects.utils.SymbolDictionary.STANDARD_NA))
+SymbolDictionary.STANDARD_NA))
       {
         dnaToProt = true;
         sense = false;
@@ -340,13 +345,13 @@ public class Sequencemapping extends Rangetype
     }
     // create and add the new mapping to (each) dataset's codonFrame
 
-    jalview.util.MapList mapping = null;
+    MapList mapping = null;
     if (dnaToProt)
     {
       if (!sense)
       {
         mapping = this.parsemapType(sequenceMapping, 1, 3); // invert sense
-        mapping = new jalview.util.MapList(mapping.getToRanges(),
+        mapping = new MapList(mapping.getToRanges(),
                 mapping.getFromRanges(), mapping.getToRatio(),
                 mapping.getFromRatio());
         acf.addMap(to, from, mapping);
@@ -363,7 +368,7 @@ public class Sequencemapping extends Rangetype
       acf.addMap(from, to, mapping);
     }
     bindjvvobj(mapping, sequenceMapping);
-    jalview.structure.StructureSelectionManager
+    StructureSelectionManager
             .getStructureSelectionManager(Desktop.instance).addMapping(acf);
     // Try to link up any conjugate database references in the two sequences
     // matchConjugateDBRefs(from, to, mapping);
@@ -372,8 +377,8 @@ public class Sequencemapping extends Rangetype
   }
 
   /**
-   * Complete any 'to' references in jalview.datamodel.Mapping objects
-   * associated with conjugate DBRefEntry under given mapping
+   * Complete any 'to' references in Mapping objects associated with conjugate
+   * DBRefEntry under given mapping
    * 
    * @param from
    *          sequence corresponding to from reference for sequence mapping
@@ -383,37 +388,37 @@ public class Sequencemapping extends Rangetype
    *          maplist parsed in same sense as from and to
    */
   private void matchConjugateDBRefs(SequenceI from, SequenceI to,
-          jalview.util.MapList smap)
+          MapList smap)
   {
     if (from.getDBRef() == null && to.getDBRef() == null)
     {
-      if (jalview.bin.Cache.log.isDebugEnabled())
+      if (Cache.log.isDebugEnabled())
       {
-        jalview.bin.Cache.log.debug("Not matching conjugate refs for "
+        Cache.log.debug("Not matching conjugate refs for "
                 + from.getName() + " and " + to.getName());
       }
       return;
     }
-    if (jalview.bin.Cache.log.isDebugEnabled())
+    if (Cache.log.isDebugEnabled())
     {
-      jalview.bin.Cache.log.debug("Matching conjugate refs for "
+      Cache.log.debug("Matching conjugate refs for "
               + from.getName() + " and " + to.getName());
     }
-    jalview.datamodel.DBRefEntry[] fdb = from.getDBRef();
-    jalview.datamodel.DBRefEntry[] tdb = new jalview.datamodel.DBRefEntry[to
+    DBRefEntry[] fdb = from.getDBRef();
+    DBRefEntry[] tdb = new DBRefEntry[to
             .getDBRef().length];
     int tdblen = to.getDBRef().length;
     System.arraycopy(to.getDBRef(), 0, tdb, 0, tdblen);
     Vector matched = new Vector();
-    jalview.util.MapList smapI = smap.getInverse();
+    MapList smapI = smap.getInverse();
     for (int f = 0; f < fdb.length; f++)
     {
-      jalview.datamodel.DBRefEntry fe = fdb[f];
-      jalview.datamodel.Mapping fmp = fe.getMap();
+      DBRefEntry fe = fdb[f];
+      Mapping fmp = fe.getMap();
       boolean fmpnnl = fmp != null;
       // if (fmpnnl && fmp.getTo()!=null)
       // {
-      // jalview.bin.Cache.log.debug("Not overwriting existing To reference in
+      // Cache.log.debug("Not overwriting existing To reference in
       // "+fe);
       // continue;
       // }
@@ -425,13 +430,13 @@ public class Sequencemapping extends Rangetype
               : false;
       for (int t = 0; t < tdblen; t++)
       {
-        jalview.datamodel.DBRefEntry te = tdb[t];
+        DBRefEntry te = tdb[t];
         if (te != null)
         {
           if (fe.getSource().equals(te.getSource())
                   && fe.getAccessionId().equals(te.getAccessionId()))
           {
-            jalview.datamodel.Mapping tmp = te.getMap();
+            Mapping tmp = te.getMap();
             boolean tmpnnl = tmp != null;
             if (tmpnnl && tmp.getTo() != null)
             {