JAL-845 applet colour by tree; translate as cDNA; pull up history list
[jalview.git] / src / jalview / util / MappingUtils.java
index 6dfebfe..1f2e8db 100644 (file)
@@ -16,7 +16,6 @@ import jalview.datamodel.SearchResults.Match;
 import jalview.datamodel.Sequence;
 import jalview.datamodel.SequenceGroup;
 import jalview.datamodel.SequenceI;
-import jalview.gui.AlignViewport;
 
 import java.util.ArrayList;
 import java.util.HashMap;
@@ -384,8 +383,8 @@ public final class MappingUtils
     }
 
     /*
-     * Have to align the sequences before constructing the OrderCommand - which
-     * then realigns them?!?
+     * Have to sort the sequences before constructing the OrderCommand - which
+     * then resorts them?!?
      */
     final SequenceI[] mappedOrderArray = mappedOrder
             .toArray(new SequenceI[mappedOrder.size()]);
@@ -407,7 +406,7 @@ public final class MappingUtils
    * @return
    */
   public static ColumnSelection mapColumnSelection(ColumnSelection colsel,
-          AlignViewportI mapFrom, AlignViewport mapTo)
+          AlignViewportI mapFrom, AlignViewportI mapTo)
   {
     boolean targetIsNucleotide = mapTo.isNucleotide();
     AlignViewportI protein = targetIsNucleotide ? mapFrom : mapTo;
@@ -416,6 +415,12 @@ public final class MappingUtils
     ColumnSelection mappedColumns = new ColumnSelection();
     char fromGapChar = mapFrom.getAlignment().getGapCharacter();
 
+    // FIXME allow for hidden columns
+
+    /*
+     * For each mapped column, find the range of columns that residues in that
+     * column map to.
+     */
     for (Object obj : colsel.getSelected())
     {
       int col = ((Integer) obj).intValue();
@@ -462,13 +467,15 @@ public final class MappingUtils
               // System.out.println(fromSeq.getName() + " mapped to cols "
               // + mappedStartCol + ":" + mappedEndCol);
               break;
-              // TODO remove break if we ever want to map one to many sequences
+              // note: remove break if we ever want to map one to many sequences
             }
           }
         }
       }
       /*
-       * Add mapped columns to mapped selection (converting base 1 to base 0)
+       * Add the range of mapped columns to the mapped selection (converting
+       * base 1 to base 0). Note that this may include intron-only regions which
+       * lie between the start and end ranges of the selection.
        */
       for (int i = mappedToMin; i <= mappedToMax; i++)
       {