private static final String DNA = "DNA";
+ private static final String RNA = "RNA";
+
/*
* Quick look-up of String value of char 'A' to 'Z'
*/
}
else if (DNA.equals(alph) && removeBelowBackground)
{
- freq = ResidueProperties.nucleotideBackgroundFrequencies
+ freq = ResidueProperties.dnaBackgroundFrequencies.get(symbol);
+ if (value < freq)
+ {
+ value = 0d;
+ }
+ }
+ else if (RNA.equals(alph) && removeBelowBackground)
+ {
+ freq = ResidueProperties.rnaBackgroundFrequencies
.get(symbol);
if (value < freq)
{
Integer alpha = 0;
final int AMINO = 0;
final int DNA = 1;
+ final int RNA = 2;
if ("amino".equals(hmm.getAlphabetType()))
{
alpha = AMINO;
{
alpha = DNA;
}
+ else if ("RNA".equals(hmm.getAlphabetType()))
+ {
+ alpha = RNA;
+ }
int size = 0;
.getCharAt(hmm.getNodeAlignmentColumn(l));
character = Character.toUpperCase(character);
- boolean containedN;
+ boolean containedD;
+ boolean containedR;
boolean containedA;
- containedN = ResidueProperties.nucleotideBackgroundFrequencies
+ containedD = ResidueProperties.dnaBackgroundFrequencies
.containsKey(character);
containedA = ResidueProperties.aminoBackgroundFrequencies
.containsKey(character);
+ containedR = ResidueProperties.rnaBackgroundFrequencies
+ .containsKey(character);
if (!Comparison.isGap(character)
- && ((alpha == DNA && containedN)
+ && ((alpha == DNA && containedD)
|| (alpha == AMINO && containedA)))
{
size++;
character = Character.toUpperCase(character);
boolean containedN;
boolean containedA;
+ boolean containedR;
- containedN = ResidueProperties.nucleotideBackgroundFrequencies
+ containedN = ResidueProperties.dnaBackgroundFrequencies
.containsKey(character);
containedA = ResidueProperties.aminoBackgroundFrequencies
.containsKey(character);
+ containedR = ResidueProperties.rnaBackgroundFrequencies
+ .containsKey(character);
if (!Comparison.isGap(character)
&& ((alpha == DNA && containedN)
}
if (alpha == DNA)
{
- freq = ResidueProperties.nucleotideBackgroundFrequencies
+ freq = ResidueProperties.dnaBackgroundFrequencies
+ .get(character);
+ }
+ if (alpha == RNA)
+ {
+ freq = ResidueProperties.rnaBackgroundFrequencies
.get(character);
}
Double doubleValue = Math.log(prob / freq);
parseModel(dataIn);
}
+ /**
+ * Reads the data from HMM file into the HMM field on this object.
+ *
+ * @throws IOException
+ */
+
+ public void parse(BufferedReader br) throws IOException
+ {
+ parseFileProperties(br);
+ parseModel(br);
+ }
+
/**
}
Double prob;
prob = hmm.getMatchEmissionProbability(position, symbol);
+ double freq = 0;
+ if ("amino".equals(hmm.getAlphabetType()))
+ {
+ if (!ResidueProperties.aminoBackgroundFrequencies.containsKey(symbol))
+ {
+ return Color.white;
+ }
+ freq = ResidueProperties.aminoBackgroundFrequencies.get(symbol);
+ }
+ else if ("DNA".equals(hmm.getAlphabetType()))
+ {
+ if (!ResidueProperties.dnaBackgroundFrequencies.containsKey(symbol))
+ {
+ return Color.white;
+ }
+ freq = ResidueProperties.dnaBackgroundFrequencies.get(symbol);
+ }
+ else if ("RNA".equals(hmm.getAlphabetType()))
+ {
+ if (!ResidueProperties.rnaBackgroundFrequencies.containsKey(symbol))
+ {
+ return Color.white;
+ }
+ freq = ResidueProperties.rnaBackgroundFrequencies.get(symbol);
+ }
if (prob == 0)
{
return Color.red;
}
- double freq = ResidueProperties.aminoBackgroundFrequencies.get(symbol);
Double value = Math.log(prob / freq);
Color colour = null;
if (value > 0)
// amino acid background Frequencies
public static final Map<Character, Float> aminoBackgroundFrequencies = new HashMap<>();
- // nucleotide background Frequencies
- public static final Map<Character, Float> nucleotideBackgroundFrequencies = new HashMap<>();
+ // dna background Frequencies
+ public static final Map<Character, Float> dnaBackgroundFrequencies = new HashMap<>();
+
+ // rna background Frequencies
+ public static final Map<Character, Float> rnaBackgroundFrequencies = new HashMap<>();
static
{
}
+ // TODO get correct frequencies
+
+ static
+ {
+ dnaBackgroundFrequencies.put('A', 0.25f);
+ dnaBackgroundFrequencies.put('C', 0.25f);
+ dnaBackgroundFrequencies.put('T', 0.25f);
+ dnaBackgroundFrequencies.put('G', 0.25f);
+
+ }
+
static
{
- nucleotideBackgroundFrequencies.put('A', 0.25f);
- nucleotideBackgroundFrequencies.put('C', 0.25f);
- nucleotideBackgroundFrequencies.put('T', 0.25f);
- nucleotideBackgroundFrequencies.put('G', 0.25f);
+ rnaBackgroundFrequencies.put('A', 0.25f);
+ rnaBackgroundFrequencies.put('C', 0.25f);
+ rnaBackgroundFrequencies.put('T', 0.25f);
+ rnaBackgroundFrequencies.put('G', 0.25f);
}