void setSequenceInformationHash(ProfilesI info, int index);
+ void initInformation();
+
+ void updateInformation(AlignmentViewPanel ap);
+
}
* The length of the longest sequence in the existing alignment.
* @return
*/
- public Sequence getConsensusSequence(int length)
+ public Sequence getConsensusSequence()
{
int start;
int end;
start = getNodeAlignmentColumn(1);
modelLength = getLength();
end = getNodeAlignmentColumn(modelLength);
- char[] sequence = new char[length];
- for (int index = 0; index < length; index++)
+ char[] sequence = new char[end];
+ for (int index = 0; index < end; index++)
{
Character character;
}
- public SequenceI initHMMSequence(AlignFrame af, int position)
+ public SequenceI initHMMSequence()
{
- AlignmentI alignment = af.getViewport().getAlignment();
- int length = alignment.getWidth();
- Sequence consensus = getConsensusSequence(length);
+ Sequence consensus = getConsensusSequence();
consensus.setIsHMMConsensusSequence(true);
consensus.setHMM(this);
- SequenceI[] consensusArr = new Sequence[] { consensus };
- alignment.getSequences().add(position, consensus);
return consensus;
}
import jalview.datamodel.AlignmentView;
import jalview.datamodel.ColumnSelection;
import jalview.datamodel.HiddenColumns;
-import jalview.datamodel.HiddenMarkovModel;
import jalview.datamodel.HiddenSequences;
import jalview.datamodel.PDBEntry;
import jalview.datamodel.SeqCigar;
import jalview.io.FileLoader;
import jalview.io.FileParse;
import jalview.io.FormatAdapter;
-import jalview.io.HMMFile;
import jalview.io.HtmlSvgOutput;
import jalview.io.IdentifyFile;
import jalview.io.JPredFile;
"label.successfully_loaded_matrix",
sm.getMatrixName()));
}
- else if (FileFormat.HMMER3.equals(format))
- {
- HMMFile hmmFile = new HMMFile(new FileParse(file, sourceType));
- HiddenMarkovModel hmm = hmmFile.getHMM();
- SequenceI hmmSeq = hmm.initHMMSequence(this, 0);
- getViewport().initInformation();
- getViewport().updateInformation(alignPanel);
- getViewport().alignmentChanged(alignPanel);
- isAnnotation = true;
-
- }
else if (FileFormat.Jnet.equals(format))
{
JPredFile predictions = new JPredFile(file, sourceType);
import jalview.datamodel.AlignmentI;
import jalview.datamodel.HiddenColumns;
import jalview.datamodel.PDBEntry;
+import jalview.datamodel.SequenceGroup;
import jalview.datamodel.SequenceI;
import jalview.gui.AlignFrame;
import jalview.gui.AlignViewport;
}
// append to existing alignment
viewport.addAlignment(al, title);
+ if (source instanceof HMMFile)
+ {
+ AlignmentI alignment = viewport.getAlignment();
+ SequenceI seq = alignment
+ .getSequenceAt(alignment.getAbsoluteHeight() - 1);
+ alignment.deleteSequence(alignment.getAbsoluteHeight() - 1);
+ SequenceGroup sg = viewport.getSelectionGroup();
+ if (sg != null)
+ {
+ seq.insertCharAt(0, sg.getStartRes(), '-');
+ seq.insertCharAt(sg.getEndRes(), alignment.getWidth(), '-');
+ SequenceI topSeq = sg.getSequencesInOrder(alignment)[0];
+ int topIndex = alignment.findIndex(topSeq);
+ alignment.getSequences().add(topIndex, seq);
+ sg.setSeqrep(seq);
+ viewport.getSelectionGroup().addSequence(seq, false);
+ }
+ else
+ {
+ for (int i = 0; i < alignment.getAbsoluteHeight(); i++)
+ {
+ if (!alignment.getSequenceAt(i).isHMMConsensusSequence())
+ {
+ alignment.getSequences().add(i, seq);
+ break;
+ }
+
+ }
+ }
+ viewport.setAlignment(alignment);
+ viewport.initInformation();
+ viewport.updateInformation(viewport.getAlignPanel());
+ viewport.getAlignPanel().adjustAnnotationHeight();
+ viewport.updateSequenceIdColours();
+ viewport.getAlignPanel().paintAlignment(true);
+ viewport.alignmentChanged(viewport.getAlignPanel());
+ }
}
else
{
}
+
+ @Override
+ public SequenceI[] getSeqsAsArray()
+ {
+ SequenceI hmmSeq = hmm.initHMMSequence();
+ SequenceI[] seq = new SequenceI[1];
+ seq[0] = hmmSeq;
+ // view.initInformation();
+ // view.updateInformation(view.panel);
+ // getViewport().alignmentChanged(alignPanel);
+ return seq;
+
+ }
+
}