sqinfo.put("Description", seq.getDescription());
}
- Vector<SequenceFeature> sfeat = new Vector<SequenceFeature>();
+ Vector<SequenceFeature> sfeat = new Vector<>();
List<SequenceFeature> sfs = seq.getFeatures().getAllFeatures();
sfeat.addAll(sfs);
(seq.getDatasetSequence() != null) ? seq.getDatasetSequence()
: new Sequence("THISISAPLACEHOLDER", ""));
}
- if (seq.isHMMConsensusSequence())
+ if (seq.hasHMMProfile())
{
sqinfo.put("HMM", seq.getHMM());
}
if (hmm != null)
{
- sq.setHMM(new HiddenMarkovModel(hmm));
- sq.setIsHMMConsensusSequence(true);
+ sq.setHMM(new HiddenMarkovModel(hmm, sq));
}
return namePresent;
}
package jalview.datamodel;
+import jalview.bin.Cache;
import jalview.io.HMMFile;
import jalview.schemes.ResidueProperties;
import jalview.util.Comparison;
}
/**
- * Copy constructor
+ * Copy constructor given a new aligned sequence with which to associate the
+ * HMM profile
*
* @param hmm
+ * @param sq
*/
- public HiddenMarkovModel(HiddenMarkovModel hmm)
+ public HiddenMarkovModel(HiddenMarkovModel hmm, SequenceI sq)
{
super();
this.fileProperties = new HashMap<>(hmm.fileProperties);
this.nodes = new ArrayList<>(hmm.nodes);
this.symbolIndexLookup = hmm.symbolIndexLookup;
this.fileHeader = new String(hmm.fileHeader);
+ this.hmmSeq = sq;
+ if (sq.getDatasetSequence() == hmm.mapToHmmConsensus.getTo())
+ {
+ this.mapToHmmConsensus = hmm.mapToHmmConsensus;
+ }
+ else
+ {
+ Cache.log.error("Error: HMM copied with change of mapped sequence");
+ }
}
/**
lastResNo - gapCount);
seq.createDatasetSequence();
seq.setHMM(this);
- seq.setIsHMMConsensusSequence(true);
-
this.hmmSeq = seq;
/*
buildConsensusSequence();
}
}
+
+ /**
+ * Sets the aligned consensus sequence this HMM is the model for
+ *
+ * @param hmmSeq
+ */
+ public void setHmmSeq(SequenceI hmmSeq)
+ {
+ this.hmmSeq = hmmSeq;
+ }
}
this.addPDBId(new PDBEntry(pdb));
}
}
- if (seq.isHMMConsensusSequence())
- {
- this.isHMMConsensusSequence = true;
- }
if (seq.getHMM() != null)
{
- this.hmm = new HiddenMarkovModel(seq.getHMM());
+ this.hmm = new HiddenMarkovModel(seq.getHMM(), this);
}
}
}
@Override
- public boolean isHMMConsensusSequence()
- {
- return isHMMConsensusSequence;
- }
-
- @Override
- public void setIsHMMConsensusSequence(boolean value)
- {
- this.isHMMConsensusSequence = value;
- }
-
- @Override
public boolean hasHMMAnnotation()
{
if (this.annotation == null) {
// otherwise, sequence was completely hidden
return 0;
}
+
+ @Override
+ public boolean hasHMMProfile()
+ {
+ return hmm != null;
+ }
}
seqs[ipos].setDescription(seq.getDescription());
seqs[ipos].setDBRefs(seq.getDBRefs());
seqs[ipos].setSequenceFeatures(seq.getSequenceFeatures());
- seqs[ipos].setIsHMMConsensusSequence(seq.isHMMConsensusSequence());
if (seq.getDatasetSequence() != null)
{
seqs[ipos].setDatasetSequence(seq.getDatasetSequence());
*/
public List<DBRefEntry> getPrimaryDBRefs();
- boolean isHMMConsensusSequence();
-
- void setIsHMMConsensusSequence(boolean isHMMConsensusSequence);
-
/**
* Answers true if the sequence has annotation for Hidden Markov Model
* information content, else false
* the iterator to use
* @return a String corresponding to the sequence
*/
- public String getSequenceStringFromIterator(Iterator<int[]> it);
+ String getSequenceStringFromIterator(Iterator<int[]> it);
/**
* Locate the first position in this sequence which is not contained in an
* iterator over regions
* @return first residue not contained in regions
*/
- public int firstResidueOutsideIterator(Iterator<int[]> it);
+ int firstResidueOutsideIterator(Iterator<int[]> it);
+
+ /**
+ * Answers true if this sequence has an associated Hidden Markov Model
+ *
+ * @return
+ */
+ boolean hasHMMProfile();
}
import javax.swing.JCheckBoxMenuItem;
import javax.swing.JEditorPane;
import javax.swing.JFileChooser;
-import javax.swing.JFrame;
import javax.swing.JInternalFrame;
import javax.swing.JLayeredPane;
import javax.swing.JMenu;
else
{
WsParamSetI set = new HMMERPreset();
- ParamDatastoreI store = HMMERParamStore.forBuild();
- WsJobParameters params = new WsJobParameters(new JFrame(), store, set,
- args);
+ ParamDatastoreI store = HMMERParamStore.forBuild(viewport);
+ WsJobParameters params = new WsJobParameters(store, set, args);
if (params.showRunDialog())
{
args = params.getJobParams();
if (!withDefaults)
{
WsParamSetI set = new HMMERPreset();
- ParamDatastoreI store = HMMERParamStore.forAlign();
- WsJobParameters params = new WsJobParameters(new JFrame(), store, set,
- args);
+ ParamDatastoreI store = HMMERParamStore.forAlign(viewport);
+ WsJobParameters params = new WsJobParameters(store, set, args);
if (params.showRunDialog())
{
args = params.getJobParams();
if (!withDefaults)
{
WsParamSetI set = new HMMERPreset();
- ParamDatastoreI store = HMMERParamStore.forSearch();
- WsJobParameters params = new WsJobParameters(new JFrame(), store, set,
- args);
+ ParamDatastoreI store = HMMERParamStore.forSearch(viewport);
+ WsJobParameters params = new WsJobParameters(store, set, args);
if (params.showRunDialog())
{
args = params.getJobParams();
});
add(menuItem);
- if (sequence.isHMMConsensusSequence())
+ if (sequence.hasHMMProfile())
{
JMenuItem selectHMM = new JCheckBoxMenuItem();
selectHMM.setText(MessageManager.getString("label.select_hmm"));
protected void selectHMM_actionPerformed(SequenceI seq)
{
// TODO move this to Viewport
- if (seq.isHMMConsensusSequence())
+ if (seq.hasHMMProfile())
{
ap.alignFrame.setSelectedHMMSequence(seq);
}
/*
* hack to ensure hmm set on alignment
*/
- if (al.getSequenceAt(0).isHMMConsensusSequence())
+ if (al.getSequenceAt(0).hasHMMProfile())
{
al.setHmmConsensus(al.getSequenceAt(0));
}
AlignmentI alignment = viewport.getAlignment();
SequenceI seq = alignment
.getSequenceAt(alignment.getAbsoluteHeight() - 1);
- if (seq.isHMMConsensusSequence())
+ if (seq.hasHMMProfile())
{
/*
* fudge: move HMM consensus sequence from last to first
List<SequenceI> seqs = sg.getSequences();
for (SequenceI seq : seqs)
{
- if (!seq.isHMMConsensusSequence())
+ if (!seq.hasHMMProfile())
{
for (char c : seq.getSequence())
{