* less than their background frequencies.
* @return
*/
- public static int[] getHMMProfileFor(AlignmentAnnotation aa, int column,
+ public static int[] getHMMProfileFor(HiddenMarkovModel hmm, int column,
boolean removeBelowBackground)
{
- HiddenMarkovModel hmm;
- hmm = aa.getHMM();
if (hmm != null)
{
String alph = hmm.getAlphabetType();
public static final int CDNA_PROFILE = 2;
- private static long counter = 0;
+ HiddenMarkovModel hmm;
- private HiddenMarkovModel hmm;
+ private static long counter = 0;
/**
* If true, this annotations is calculated every edit, eg consensus, quality
return graphMin < graphMax;
}
- /**
- * Returns the HMM associated with this annotation.
- *
- * @return
- */
- public HiddenMarkovModel getHMM()
+ public void setHMM(HiddenMarkovModel markov)
{
- return hmm;
+ hmm = markov;
}
- /**
- * Sets the HMM associated with this annotation.
- *
- * @param hmm
- */
- public void setHMM(HiddenMarkovModel hmm)
+ public HiddenMarkovModel getHMM()
{
- this.hmm = hmm;
+ return hmm;
}
}
if ("x".equals(character) || "X".equals(character))
{
nodeIndex++;
- if (nodeIndex <= nodes.size())
+ if (nodeIndex < nodes.size())
{
nodes.get(nodeIndex).setAlignmentColumn(col + 1);
nodeLookup.put(col + 1, nodeIndex);
int end;
+ HiddenMarkovModel hmm;
+
Vector<PDBEntry> pdbIds;
String vamsasId;
{
if (pdbIds == null)
{
- pdbIds = new Vector<PDBEntry>();
+ pdbIds = new Vector<>();
pdbIds.add(entry);
return true;
}
@Override
public List<int[]> getInsertions()
{
- ArrayList<int[]> map = new ArrayList<int[]>();
+ ArrayList<int[]> map = new ArrayList<>();
int lastj = -1, j = 0;
int pos = start;
int seqlen = sequence.length;
{
if (this.annotation == null)
{
- this.annotation = new Vector<AlignmentAnnotation>();
+ this.annotation = new Vector<>();
}
if (!this.annotation.contains(annotation))
{
public List<AlignmentAnnotation> getAlignmentAnnotations(String calcId,
String label)
{
- List<AlignmentAnnotation> result = new ArrayList<AlignmentAnnotation>();
+ List<AlignmentAnnotation> result = new ArrayList<>();
if (this.annotation != null)
{
for (AlignmentAnnotation ann : annotation)
}
synchronized (dbrefs)
{
- List<DBRefEntry> primaries = new ArrayList<DBRefEntry>();
+ List<DBRefEntry> primaries = new ArrayList<>();
DBRefEntry[] tmp = new DBRefEntry[1];
for (DBRefEntry ref : dbrefs)
{
}
}
+ @Override
+ public HiddenMarkovModel getHMM()
+ {
+ return hmm;
+ }
+
+ @Override
+ public void setHMM(HiddenMarkovModel hmm)
+ {
+ this.hmm = hmm;
+ }
+
}
*/
public void setName(String name);
+ public HiddenMarkovModel getHMM();
+
+ public void setHMM(HiddenMarkovModel hmm);
+
/**
* Get the display name
*/
// pipeline
hmmFile.parse();
HiddenMarkovModel hmm = hmmFile.getHMM();
+ AlignmentAnnotation annotArray[] = getViewport().getAlignment()
+ .getAlignmentAnnotation();
+
+ AlignmentAnnotation reference = null;
+ for (AlignmentAnnotation annot : annotArray)
+ {
+ if (annot.label.contains("Reference"))
+ {
+ reference = annot;
+ }
+ }
+
+ if (reference != null)
+ {
+ hmm.mapToReferenceAnnotation(reference);
+ }
+
AlignmentAnnotation annotation = hmm.createAnnotation(
getViewport().getAlignment().getWidth());
getViewport().getAlignment().addAnnotation(annotation);
- annotation.setHMM(hmm);
int length = getViewport().getAlignment().getWidth();
Sequence consensus = hmm.getConsensusSequence(length);
+ consensus.setHMM(hmm);
+ annotation.setHMM(hmm);
SequenceI[] consensusArr = new Sequence[] { consensus };
AlignmentI newAlignment = new Alignment(consensusArr);
newAlignment.append(getViewport().getAlignment());
*/
protected void initData()
{
- seqs = new Vector<SequenceI>();
- annotations = new Vector<AlignmentAnnotation>();
- seqGroups = new ArrayList<SequenceGroup>();
+ seqs = new Vector<>();
+ annotations = new Vector<>();
+ seqGroups = new ArrayList<>();
parseCalled = false;
}
@Override
public void setSeqs(SequenceI[] s)
{
- seqs = new Vector<SequenceI>();
+ seqs = new Vector<>();
for (int i = 0; i < s.length; i++)
{
{
if (newickStrings == null)
{
- newickStrings = new Vector<String[]>();
+ newickStrings = new Vector<>();
}
newickStrings.addElement(new String[] { treeName, newickString });
}
{
seqs.add(seq);
}
+
+ /**
+ * Used only for hmmer statistics, so should probably be removed at some
+ * point. TODO remove this
+ *
+ * @return
+ */
+ public Vector<AlignmentAnnotation> getAnnotations()
+ {
+ return annotations;
+ }
+
}
import jalview.datamodel.Annotation;
import jalview.datamodel.ColumnSelection;
import jalview.datamodel.HiddenColumns;
+import jalview.datamodel.HiddenMarkovModel;
import jalview.datamodel.ProfilesI;
import jalview.schemes.ColourSchemeI;
import jalview.schemes.NucleotideColourScheme;
//
if (aa.label.startsWith("Information"))
{
- return AAFrequency.getHMMProfileFor(aa, column,
+ HiddenMarkovModel hmm = aa.getHMM();
+ return AAFrequency.getHMMProfileFor(hmm, column,
av_ignoreBelowBackground); // TODO check if this follows standard
// pipeline
}
package jalview.schemes;
-import jalview.datamodel.AlignmentAnnotation;
import jalview.datamodel.AnnotatedCollectionI;
import jalview.datamodel.HiddenMarkovModel;
import jalview.datamodel.SequenceCollectionI;
public void alignmentChanged(AnnotatedCollectionI collection,
Map<SequenceI, SequenceCollectionI> hiddenReps)
{
- AlignmentAnnotation[] annArr = collection.getAlignmentAnnotation();
- for (AlignmentAnnotation ann : annArr)
- {
- if (ann.label.indexOf("Information Content") > -1)
- {
- hmm = ann.getHMM();
- }
- }
-
+ SequenceI seq = collection.getSequences().get(0);
+ hmm = seq.getHMM();
}
+
+
@Override
public ColourSchemeI getInstance(AnnotatedCollectionI sg,
Map<SequenceI, SequenceCollectionI> hiddenRepSequences)
{
HiddenMarkovModel markov = null;
- AlignmentAnnotation[] annArr = sg.getAlignmentAnnotation();
- for (AlignmentAnnotation ann : annArr)
- {
- if (ann.label.indexOf("Information Content") > -1)
- {
- markov = ann.getHMM();
- }
- }
-
-
-
-
-
+ SequenceI seq = sg.getSequences().get(0);
+ markov = seq.getHMM();
HMMERColourScheme colour = new HMMERColourScheme(markov);
return colour;
"test/jalview/io/test_MADE1_hmm.txt", DataSourceType.FILE));
hmmFile.parse();
HiddenMarkovModel hmm = hmmFile.getHMM();
- AlignmentAnnotation aa = hmm.createAnnotation(80);
- aa.setHMM(hmm);
-
int[] expected = { 0, 4, 100, 'T', 71, 'C', 12, 'G', 9, 'A', 9 };
- int[] actual = AAFrequency.getHMMProfileFor(aa, 17, false);
+ int[] actual = AAFrequency.getHMMProfileFor(hmm, 17, false);
for (int i = 0; i < actual.length; i++)
{
if (i == 2)
}
int[] expected2 = { 0, 4, 85, 'A', 85, 'C', 0, 'G', 0, 'T', 0 };
- int[] actual2 = AAFrequency.getHMMProfileFor(aa, 2, true);
+ int[] actual2 = AAFrequency.getHMMProfileFor(hmm, 2, true);
for (int i = 0; i < actual.length; i++)
{
if (i == 2)