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);
54 double freq = ResidueProperties.aminoBackgroundFrequencies.get(symbol);
55 Double value = prob - freq;
61 colour = ColorUtils.getGraduatedColour(value.floatValue(), 0,
62 Color.WHITE, 1f, Color.green);
79 public void alignmentChanged(AnnotatedCollectionI collection,
80 Map<SequenceI, SequenceCollectionI> hiddenReps)
82 AlignmentAnnotation[] annArr = collection.getAlignmentAnnotation();
83 for (AlignmentAnnotation ann : annArr)
85 if (ann.label.indexOf("Information Content") > -1)
94 public ColourSchemeI getInstance(AnnotatedCollectionI sg,
95 Map<SequenceI, SequenceCollectionI> hiddenRepSequences)
97 HiddenMarkovModel markov = null;
98 AlignmentAnnotation[] annArr = sg.getAlignmentAnnotation();
99 for (AlignmentAnnotation ann : annArr)
101 if (ann.label.indexOf("Information Content") > -1)
103 markov = ann.getHMM();
111 HMMERColourScheme colour = new HMMERColourScheme(markov);
117 public boolean isApplicableTo(AnnotatedCollectionI ac)
124 public String getSchemeName()
127 return JalviewColourScheme.HMMER.name();
131 public boolean isSimple()
133 // TODO Auto-generated method stub