symbol = Character.toUpperCase(symbol);
}
- double prob = getHmm().getMatchEmissionProbability(column, symbol);
+ final double prob = getHmm().getMatchEmissionProbability(column,
+ symbol);
+
Float freq = 0f;
if (!frequencies.containsKey(symbol))
}
double value = Math.log(prob / freq.floatValue());
Color colour = null;
- if (value > 0)
- {
- colour = ColorUtils.getGraduatedColour((float) value, 0,
- Color.WHITE, getMaxInformationScore(), Color.blue);
- }
- else if (value < 0)
+ if (value < 0)
{
return Color.ORANGE;
}
+
+ colour = ColorUtils.getGraduatedColour((float) value, 0, Color.WHITE,
+ getMaxInformationScore(), Color.blue);
return colour;
}
public HmmerGlobalBackground(HiddenMarkovModel markov)
{
super(markov);
- setFrequencies(ResidueProperties.backgroundFrequencies
- .get(getHmm().getAlphabetType()));
+ String alphabetType = markov == null ? ResidueProperties.ALPHABET_AMINO
+ : markov.getAlphabetType();
+ setFrequencies(
+ ResidueProperties.backgroundFrequencies.get(alphabetType));
}
/**
PurinePyrimidine("Purine/Pyrimidine", PurinePyrimidineColourScheme.class),
RNAHelices("RNA Helices", RNAHelicesColour.class),
TCoffee("T-Coffee Scores", TCoffeeColourScheme.class),
- HMMERU("HMMER-Uniprot", HmmerColourScheme.class),
+ HMMERU("HMMER-Uniprot", HmmerGlobalBackground.class),
HMMERA("HMMER-Alignment", HmmerLocalBackground.class);
// RNAInteraction("RNA Interaction type", RNAInteractionColourScheme.class)
public class ResidueProperties
{
+ // alphabet names used in Hidden Markov Model files
+ public static final String ALPHABET_RNA = "RNA";
+
+ public static final String ALPHABET_DNA = "DNA";
+
+ public static final String ALPHABET_AMINO = "amino";
+
// Stores residue codes/names and colours and other things
public static final int[] aaIndex; // aaHash version 2.1.1 and below
amino.put('I', 0.0593f);
amino.put('P', 0.0472f);
amino.put('V', 0.0686f);
- backgroundFrequencies.put("amino", amino);
+ backgroundFrequencies.put(ALPHABET_AMINO, amino);
// todo: these don't match https://www.ebi.ac.uk/uniprot/TrEMBLstats - what
// are they?
}
dna.put('C', 0.25f);
dna.put('T', 0.25f);
dna.put('G', 0.25f);
- backgroundFrequencies.put("DNA", dna);
+ backgroundFrequencies.put(ALPHABET_DNA, dna);
}
rna.put('C', 0.25f);
rna.put('T', 0.25f);
rna.put('G', 0.25f);
- backgroundFrequencies.put("RNA", rna);
+ backgroundFrequencies.put(ALPHABET_RNA, rna);
}