From d9ebab4c0101cfe41617856b5ffe7f876f0a92e9 Mon Sep 17 00:00:00 2001 From: gmungoc Date: Fri, 30 Mar 2018 15:32:02 +0100 Subject: [PATCH] JAL-2941 'map hmm to RF' removed pending clarifications --- src/jalview/datamodel/Sequence.java | 44 ---------------------------------- src/jalview/datamodel/SequenceI.java | 10 -------- src/jalview/io/FileLoader.java | 21 ++++++---------- 3 files changed, 7 insertions(+), 68 deletions(-) diff --git a/src/jalview/datamodel/Sequence.java b/src/jalview/datamodel/Sequence.java index dc0fe88..755abbb 100755 --- a/src/jalview/datamodel/Sequence.java +++ b/src/jalview/datamodel/Sequence.java @@ -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; diff --git a/src/jalview/datamodel/SequenceI.java b/src/jalview/datamodel/SequenceI.java index 9045735..5b3d782 100755 --- a/src/jalview/datamodel/SequenceI.java +++ b/src/jalview/datamodel/SequenceI.java @@ -499,14 +499,6 @@ public interface SequenceI extends ASequenceI */ public List 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 diff --git a/src/jalview/io/FileLoader.java b/src/jalview/io/FileLoader.java index cabba00..2d753c1 100755 --- a/src/jalview/io/FileLoader.java +++ b/src/jalview/io/FileLoader.java @@ -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 -- 1.7.10.2