/**
* A class to count occurrences of residues in a profile, optimised for speed
* and memory footprint.
+ *
* @author gmcarstairs
*
*/
*/
private static final String AAS = "ACDEFGHIKLMNPQRSTUVWXY";
- private static final int GAP_COUNT = 0;
+ static final int GAP_COUNT = 0;
/*
* fast lookup tables holding the index into our count
counts[offset] = (short) ++newValue;
}
}
- maxCount = Math.max(maxCount, newValue);
+
+ if (offset != GAP_COUNT)
+ {
+ // update modal residue count
+ maxCount = Math.max(maxCount, newValue);
+ }
return newValue;
}
*/
public int addGap()
{
- int newValue;
- if (useIntCounts)
- {
- newValue = ++intCounts[GAP_COUNT];
- }
- else
- {
- newValue = ++counts[GAP_COUNT];
- }
+ int newValue = increment(GAP_COUNT);
return newValue;
}
{
if (intCounts[i] == count)
{
- modal.append(isNucleotide ? NUCS.charAt(i - 1) : AAS
- .charAt(i - 1));
+ modal.append(
+ isNucleotide ? NUCS.charAt(i - 1) : AAS.charAt(i - 1));
}
}
}
{
if (counts[i] == count)
{
- modal.append(isNucleotide ? NUCS.charAt(i - 1) : AAS
- .charAt(i - 1));
+ modal.append(
+ isNucleotide ? NUCS.charAt(i - 1) : AAS.charAt(i - 1));
}
}
}
*
* @return
*/
- public int size() {
+ public int size()
+ {
int size = 0;
if (useIntCounts)
{
{
if (intCounts[i] > 0)
{
- char symbol = isNucleotide ? NUCS.charAt(i - 1) : AAS
- .charAt(i - 1);
+ char symbol = isNucleotide ? NUCS.charAt(i - 1)
+ : AAS.charAt(i - 1);
symbols[j] = symbol;
values[j] = intCounts[i];
j++;
{
if (counts[i] > 0)
{
- char symbol = isNucleotide ? NUCS.charAt(i - 1) : AAS
- .charAt(i - 1);
+ char symbol = isNucleotide ? NUCS.charAt(i - 1)
+ : AAS.charAt(i - 1);
symbols[j] = symbol;
values[j] = counts[i];
j++;