}
@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;
*/
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);
*/
BitSet getInsertionsAsBits();
- void mapToReference(AlignmentAnnotation rf);
-
/**
* Replaces every occurrence of c1 in the sequence with c2 and returns the
* number of characters changed
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;
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