git://source.jalview.org
/
jalview.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
db0d1ba
)
JAL-2629 moved HMM storage location to placeholder sequence
author
TZVanaalten
<TZVanaalten@LS30916.ad.lifesci.dundee.ac.uk>
Thu, 27 Jul 2017 11:06:02 +0000
(12:06 +0100)
committer
TZVanaalten
<TZVanaalten@LS30916.ad.lifesci.dundee.ac.uk>
Thu, 27 Jul 2017 11:06:02 +0000
(12:06 +0100)
src/jalview/analysis/AAFrequency.java
patch
|
blob
|
history
src/jalview/datamodel/AlignmentAnnotation.java
patch
|
blob
|
history
src/jalview/datamodel/HiddenMarkovModel.java
patch
|
blob
|
history
src/jalview/datamodel/Sequence.java
patch
|
blob
|
history
src/jalview/datamodel/SequenceI.java
patch
|
blob
|
history
src/jalview/gui/AlignFrame.java
patch
|
blob
|
history
src/jalview/io/AlignFile.java
patch
|
blob
|
history
src/jalview/renderer/AnnotationRenderer.java
patch
|
blob
|
history
src/jalview/schemes/HMMERColourScheme.java
patch
|
blob
|
history
test/jalview/analysis/AAFrequencyTest.java
patch
|
blob
|
history
diff --git
a/src/jalview/analysis/AAFrequency.java
b/src/jalview/analysis/AAFrequency.java
index
573e607
..
900209d
100755
(executable)
--- a/
src/jalview/analysis/AAFrequency.java
+++ b/
src/jalview/analysis/AAFrequency.java
@@
-741,12
+741,10
@@
public class AAFrequency
* less than their background frequencies.
* @return
*/
* less than their background frequencies.
* @return
*/
- public static int[] getHMMProfileFor(AlignmentAnnotation aa, int column,
+ public static int[] getHMMProfileFor(HiddenMarkovModel hmm, int column,
boolean removeBelowBackground)
{
boolean removeBelowBackground)
{
- HiddenMarkovModel hmm;
- hmm = aa.getHMM();
if (hmm != null)
{
String alph = hmm.getAlphabetType();
if (hmm != null)
{
String alph = hmm.getAlphabetType();
diff --git
a/src/jalview/datamodel/AlignmentAnnotation.java
b/src/jalview/datamodel/AlignmentAnnotation.java
index
31aeecc
..
e8e8d01
100755
(executable)
--- a/
src/jalview/datamodel/AlignmentAnnotation.java
+++ b/
src/jalview/datamodel/AlignmentAnnotation.java
@@
-51,9
+51,9
@@
public class AlignmentAnnotation
public static final int CDNA_PROFILE = 2;
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
/**
* If true, this annotations is calculated every edit, eg consensus, quality
@@
-1506,23
+1506,13
@@
public class AlignmentAnnotation
return graphMin < graphMax;
}
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;
}
}
}
}
diff --git
a/src/jalview/datamodel/HiddenMarkovModel.java
b/src/jalview/datamodel/HiddenMarkovModel.java
index
40f106e
..
96a5a6f
100644
(file)
--- a/
src/jalview/datamodel/HiddenMarkovModel.java
+++ b/
src/jalview/datamodel/HiddenMarkovModel.java
@@
-1069,7
+1069,7
@@
public class HiddenMarkovModel
if ("x".equals(character) || "X".equals(character))
{
nodeIndex++;
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);
{
nodes.get(nodeIndex).setAlignmentColumn(col + 1);
nodeLookup.put(col + 1, nodeIndex);
diff --git
a/src/jalview/datamodel/Sequence.java
b/src/jalview/datamodel/Sequence.java
index
b0faf21
..
56a89a1
100755
(executable)
--- a/
src/jalview/datamodel/Sequence.java
+++ b/
src/jalview/datamodel/Sequence.java
@@
-57,6
+57,8
@@
public class Sequence extends ASequence implements SequenceI
int end;
int end;
+ HiddenMarkovModel hmm;
+
Vector<PDBEntry> pdbIds;
String vamsasId;
Vector<PDBEntry> pdbIds;
String vamsasId;
@@
-416,7
+418,7
@@
public class Sequence extends ASequence implements SequenceI
{
if (pdbIds == null)
{
{
if (pdbIds == null)
{
- pdbIds = new Vector<PDBEntry>();
+ pdbIds = new Vector<>();
pdbIds.add(entry);
return true;
}
pdbIds.add(entry);
return true;
}
@@
-787,7
+789,7
@@
public class Sequence extends ASequence implements SequenceI
@Override
public List<int[]> getInsertions()
{
@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;
int lastj = -1, j = 0;
int pos = start;
int seqlen = sequence.length;
@@
-1048,7
+1050,7
@@
public class Sequence extends ASequence implements SequenceI
{
if (this.annotation == null)
{
{
if (this.annotation == null)
{
- this.annotation = new Vector<AlignmentAnnotation>();
+ this.annotation = new Vector<>();
}
if (!this.annotation.contains(annotation))
{
}
if (!this.annotation.contains(annotation))
{
@@
-1372,7
+1374,7
@@
public class Sequence extends ASequence implements SequenceI
public List<AlignmentAnnotation> getAlignmentAnnotations(String calcId,
String label)
{
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)
if (this.annotation != null)
{
for (AlignmentAnnotation ann : annotation)
@@
-1428,7
+1430,7
@@
public class Sequence extends ASequence implements SequenceI
}
synchronized (dbrefs)
{
}
synchronized (dbrefs)
{
- List<DBRefEntry> primaries = new ArrayList<DBRefEntry>();
+ List<DBRefEntry> primaries = new ArrayList<>();
DBRefEntry[] tmp = new DBRefEntry[1];
for (DBRefEntry ref : dbrefs)
{
DBRefEntry[] tmp = new DBRefEntry[1];
for (DBRefEntry ref : dbrefs)
{
@@
-1475,4
+1477,16
@@
public class Sequence extends ASequence implements SequenceI
}
}
}
}
+ @Override
+ public HiddenMarkovModel getHMM()
+ {
+ return hmm;
+ }
+
+ @Override
+ public void setHMM(HiddenMarkovModel hmm)
+ {
+ this.hmm = hmm;
+ }
+
}
}
diff --git
a/src/jalview/datamodel/SequenceI.java
b/src/jalview/datamodel/SequenceI.java
index
e81553b
..
3298829
100755
(executable)
--- a/
src/jalview/datamodel/SequenceI.java
+++ b/
src/jalview/datamodel/SequenceI.java
@@
-41,6
+41,10
@@
public interface SequenceI extends ASequenceI
*/
public void setName(String name);
*/
public void setName(String name);
+ public HiddenMarkovModel getHMM();
+
+ public void setHMM(HiddenMarkovModel hmm);
+
/**
* Get the display name
*/
/**
* Get the display name
*/
diff --git
a/src/jalview/gui/AlignFrame.java
b/src/jalview/gui/AlignFrame.java
index
b14423c
..
0c951fa
100644
(file)
--- a/
src/jalview/gui/AlignFrame.java
+++ b/
src/jalview/gui/AlignFrame.java
@@
-4683,12
+4683,30
@@
public class AlignFrame extends GAlignFrame implements DropTargetListener,
// pipeline
hmmFile.parse();
HiddenMarkovModel hmm = hmmFile.getHMM();
// 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);
AlignmentAnnotation annotation = hmm.createAnnotation(
getViewport().getAlignment().getWidth());
getViewport().getAlignment().addAnnotation(annotation);
- annotation.setHMM(hmm);
int length = getViewport().getAlignment().getWidth();
Sequence consensus = hmm.getConsensusSequence(length);
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());
SequenceI[] consensusArr = new Sequence[] { consensus };
AlignmentI newAlignment = new Alignment(consensusArr);
newAlignment.append(getViewport().getAlignment());
diff --git
a/src/jalview/io/AlignFile.java
b/src/jalview/io/AlignFile.java
index
7333075
..
745fb93
100755
(executable)
--- a/
src/jalview/io/AlignFile.java
+++ b/
src/jalview/io/AlignFile.java
@@
-311,9
+311,9
@@
public abstract class AlignFile extends FileParse implements
*/
protected void initData()
{
*/
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;
}
parseCalled = false;
}
@@
-326,7
+326,7
@@
public abstract class AlignFile extends FileParse implements
@Override
public void setSeqs(SequenceI[] s)
{
@Override
public void setSeqs(SequenceI[] s)
{
- seqs = new Vector<SequenceI>();
+ seqs = new Vector<>();
for (int i = 0; i < s.length; i++)
{
for (int i = 0; i < s.length; i++)
{
@@
-397,7
+397,7
@@
public abstract class AlignFile extends FileParse implements
{
if (newickStrings == null)
{
{
if (newickStrings == null)
{
- newickStrings = new Vector<String[]>();
+ newickStrings = new Vector<>();
}
newickStrings.addElement(new String[] { treeName, newickString });
}
}
newickStrings.addElement(new String[] { treeName, newickString });
}
@@
-421,4
+421,16
@@
public abstract class AlignFile extends FileParse implements
{
seqs.add(seq);
}
{
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;
+ }
+
}
}
diff --git
a/src/jalview/renderer/AnnotationRenderer.java
b/src/jalview/renderer/AnnotationRenderer.java
index
1f3d5a9
..
78b3a88
100644
(file)
--- a/
src/jalview/renderer/AnnotationRenderer.java
+++ b/
src/jalview/renderer/AnnotationRenderer.java
@@
-29,6
+29,7
@@
import jalview.datamodel.AlignmentAnnotation;
import jalview.datamodel.Annotation;
import jalview.datamodel.ColumnSelection;
import jalview.datamodel.HiddenColumns;
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;
import jalview.datamodel.ProfilesI;
import jalview.schemes.ColourSchemeI;
import jalview.schemes.NucleotideColourScheme;
@@
-359,7
+360,8
@@
public class AnnotationRenderer
//
if (aa.label.startsWith("Information"))
{
//
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
}
av_ignoreBelowBackground); // TODO check if this follows standard
// pipeline
}
diff --git
a/src/jalview/schemes/HMMERColourScheme.java
b/src/jalview/schemes/HMMERColourScheme.java
index
09092a6
..
c9e081f
100644
(file)
--- a/
src/jalview/schemes/HMMERColourScheme.java
+++ b/
src/jalview/schemes/HMMERColourScheme.java
@@
-1,6
+1,5
@@
package jalview.schemes;
package jalview.schemes;
-import jalview.datamodel.AlignmentAnnotation;
import jalview.datamodel.AnnotatedCollectionI;
import jalview.datamodel.HiddenMarkovModel;
import jalview.datamodel.SequenceCollectionI;
import jalview.datamodel.AnnotatedCollectionI;
import jalview.datamodel.HiddenMarkovModel;
import jalview.datamodel.SequenceCollectionI;
@@
-106,35
+105,19
@@
public class HMMERColourScheme extends ResidueColourScheme
public void alignmentChanged(AnnotatedCollectionI collection,
Map<SequenceI, SequenceCollectionI> hiddenReps)
{
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;
@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;
HMMERColourScheme colour = new HMMERColourScheme(markov);
return colour;
diff --git
a/test/jalview/analysis/AAFrequencyTest.java
b/test/jalview/analysis/AAFrequencyTest.java
index
646412f
..
4755bf6
100644
(file)
--- a/
test/jalview/analysis/AAFrequencyTest.java
+++ b/
test/jalview/analysis/AAFrequencyTest.java
@@
-249,11
+249,8
@@
public class AAFrequencyTest
"test/jalview/io/test_MADE1_hmm.txt", DataSourceType.FILE));
hmmFile.parse();
HiddenMarkovModel hmm = hmmFile.getHMM();
"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[] 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)
for (int i = 0; i < actual.length; i++)
{
if (i == 2)
@@
-267,7
+264,7
@@
public class AAFrequencyTest
}
int[] expected2 = { 0, 4, 85, 'A', 85, 'C', 0, 'G', 0, 'T', 0 };
}
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)
for (int i = 0; i < actual.length; i++)
{
if (i == 2)