Browse Source

made KMer char2code and code2base public static

remotes/georgeg/bam_output_redesign
lomereiter 9 years ago
parent
commit
0f348e8bb7
1 changed files with 14 additions and 4 deletions
  1. +14
    -4
      bio/core/kmer.d

+ 14
- 4
bio/core/kmer.d View File

@ -9,6 +9,20 @@ struct KMer(uint K)
{
private ulong _id;
static Base5 code2base(int code) {
return Base5("ACGT"[code]);
}
static int char2code(char base) {
switch (base) {
case 'A': return 0;
case 'C': return 1;
case 'G': return 2;
case 'T': return 3;
default: return -1;
}
}
/// Unique ID
ulong id() @property const {
return _id;
@ -69,10 +83,6 @@ struct KMer(uint K)
void popFront() { --_len; }
void popBack() { --_len; _n >>= 2; }
private static Base5 code2base(int code) {
return Base5("ACGT"[code]);
}
Base5 opIndex(size_t i) const {
return code2base((_n >> (2 * (_len - i - 1))) & 3);
}


Loading…
Cancel
Save