1 package jalview.schemes;
3 import jalview.datamodel.AlignmentAnnotation;
4 import jalview.datamodel.AnnotatedCollectionI;
5 import jalview.datamodel.HiddenMarkovModel;
6 import jalview.datamodel.SequenceCollectionI;
7 import jalview.datamodel.SequenceI;
8 import jalview.util.ColorUtils;
9 import jalview.util.Comparison;
11 import java.awt.Color;
14 public class HMMERColourScheme extends ResidueColourScheme
17 AnnotatedCollectionI alignment;
19 HiddenMarkovModel hmm;
21 boolean peptideSpecific;
23 boolean nucleotideSpecific;
25 public HMMERColourScheme(HiddenMarkovModel markov)
29 public HMMERColourScheme()
35 public Color findColour(char symbol, int position, SequenceI seq,
36 String consensusResidue, float pid)
42 return findColour(symbol, position);
45 public Color findColour(char symbol, int position)
48 if (Comparison.isGap(symbol))
53 prob = hmm.getMatchEmissionProbability(position, symbol);
58 double freq = ResidueProperties.aminoBackgroundFrequencies.get(symbol);
59 Double value = Math.log(prob / freq);
64 colour = ColorUtils.getGraduatedColour(value.floatValue(), 0,
65 Color.WHITE, 3f, Color.blue);
82 public void alignmentChanged(AnnotatedCollectionI collection,
83 Map<SequenceI, SequenceCollectionI> hiddenReps)
85 AlignmentAnnotation[] annArr = collection.getAlignmentAnnotation();
86 for (AlignmentAnnotation ann : annArr)
88 if (ann.label.indexOf("Information Content") > -1)
97 public ColourSchemeI getInstance(AnnotatedCollectionI sg,
98 Map<SequenceI, SequenceCollectionI> hiddenRepSequences)
100 HiddenMarkovModel markov = null;
101 AlignmentAnnotation[] annArr = sg.getAlignmentAnnotation();
102 for (AlignmentAnnotation ann : annArr)
104 if (ann.label.indexOf("Information Content") > -1)
106 markov = ann.getHMM();
114 HMMERColourScheme colour = new HMMERColourScheme(markov);
120 public boolean isApplicableTo(AnnotatedCollectionI ac)
127 public String getSchemeName()
130 return JalviewColourScheme.HMMER.name();
134 public boolean isSimple()
136 // TODO Auto-generated method stub