JAL-2941 'map hmm to RF' removed pending clarifications
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Fri, 30 Mar 2018 14:32:02 +0000 (15:32 +0100)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Fri, 30 Mar 2018 14:32:02 +0000 (15:32 +0100)
src/jalview/datamodel/Sequence.java
src/jalview/datamodel/SequenceI.java
src/jalview/io/FileLoader.java

index dc0fe88..755abbb 100755 (executable)
@@ -1916,50 +1916,6 @@ public class Sequence extends ASequence implements SequenceI
   }
 
   @Override
-  public void updateHMMMapping()
-  {
-    if (hmm == null)
-    {
-      return;
-    }
-    hmm.updateMapping(sequence);
-  }
-
-  /**
-   * Maps the HMM sequence to the reference annotation.
-   * 
-   * @param rf
-   */
-  @Override
-  public void mapToReference(AlignmentAnnotation rf)
-  {
-    if (this.isHMMConsensusSequence)
-    {
-      int node = 1;
-      hmm.clearNodeLookup();
-      for (int i = 0; i < getLength(); i++)
-      {
-        if (rf.annotations[i].displayCharacter.equalsIgnoreCase("x"))
-        {
-          if (i < hmm.getNodeAlignmentColumn(node))
-          {
-            this.deleteChars(i, hmm.getNodeAlignmentColumn(node));
-            updateHMMMapping();
-          }
-          else if (i > hmm.getNodeAlignmentColumn(node))
-          {
-            int length = i - hmm.getNodeAlignmentColumn(node);
-            this.insertCharAt(hmm.getNodeAlignmentColumn(node), length,
-                    '-');
-            updateHMMMapping();
-          }
-          node++;
-        }
-      }
-    }
-  }
-
-  @Override
   public boolean isHMMConsensusSequence()
   {
     return isHMMConsensusSequence;
index 9045735..5b3d782 100755 (executable)
@@ -499,14 +499,6 @@ public interface SequenceI extends ASequenceI
    */
   public List<DBRefEntry> getPrimaryDBRefs();
 
-  /**
-   * Updates mapping of Hidden Markov Model nodes to aligned sequence positions
-   * (e.g. after an alignment edit). The nodes of the HMM (excluding the first
-   * node, with model average values), are associated in turn with non-gapped
-   * sequence positions.
-   */
-  public void updateHMMMapping();
-
   boolean isHMMConsensusSequence();
 
   void setIsHMMConsensusSequence(boolean isHMMConsensusSequence);
@@ -547,8 +539,6 @@ public interface SequenceI extends ASequenceI
    */
   BitSet getInsertionsAsBits();
 
-  void mapToReference(AlignmentAnnotation rf);
-
   /**
    * Replaces every occurrence of c1 in the sequence with c2 and returns the
    * number of characters changed
index cabba00..2d753c1 100755 (executable)
@@ -26,7 +26,6 @@ import jalview.api.FeaturesDisplayedI;
 import jalview.api.FeaturesSourceI;
 import jalview.bin.Cache;
 import jalview.bin.Jalview;
-import jalview.datamodel.AlignmentAnnotation;
 import jalview.datamodel.AlignmentI;
 import jalview.datamodel.HiddenColumns;
 import jalview.datamodel.PDBEntry;
@@ -426,23 +425,17 @@ public class FileLoader implements Runnable
               AlignmentI alignment = viewport.getAlignment();
               SequenceI seq = alignment
                       .getSequenceAt(alignment.getAbsoluteHeight() - 1);
-              seq.setIsHMMConsensusSequence(true);
-              AlignmentAnnotation[] annots = viewport.getAlignment()
-                      .getAlignmentAnnotation();
-              for (AlignmentAnnotation annot : annots)
+              if (seq.isHMMConsensusSequence())
               {
-                if ("RF".equals(annot.label)
-                        || annot.label.contains("Reference"))
-                {
-                  seq.mapToReference(annot);
-                  break;
-                }
+                /* 
+                 * fudge: move HMM consensus sequence from last to first
+                 */
+                alignment.deleteSequence(alignment.getAbsoluteHeight() - 1);
+                alignment.insertSequenceAt(0, seq);
+                alignment.setHmmConsensus(seq);
               }
-              alignment.deleteSequence(alignment.getAbsoluteHeight() - 1);
-              alignment.insertSequenceAt(0, seq);
               viewport.getAlignPanel().adjustAnnotationHeight();
               viewport.updateSequenceIdColours();
-
             }
           }
           else