Helpful functions for converting a base (char) to a base index (A:0, C:1, G:2, T:3, alphabetical and consistent with Illumina conventions to minimize confusion.

git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@373 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
kiran 2009-04-13 00:46:23 +00:00
parent 35fc002d5d
commit 5e96ab6161
1 changed files with 31 additions and 0 deletions

View File

@ -0,0 +1,31 @@
package org.broadinstitute.sting.utils;
public class BaseUtils {
static public int simpleBaseToBaseIndex(char base) {
switch (base) {
case 'A':
case 'a': return 0;
case 'C':
case 'c': return 1;
case 'G':
case 'g': return 2;
case 'T':
case 't': return 3;
default: return -1;
}
}
static public char baseIndexToSimpleBase(int baseIndex) {
switch (baseIndex) {
case 0: return 'A';
case 1: return 'C';
case 2: return 'G';
case 3: return 'T';
default: return '.';
}
}
}