diff --git a/java/src/org/broadinstitute/sting/utils/BaseUtils.java b/java/src/org/broadinstitute/sting/utils/BaseUtils.java new file mode 100644 index 000000000..b4f3b4d2f --- /dev/null +++ b/java/src/org/broadinstitute/sting/utils/BaseUtils.java @@ -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 '.'; + } + } +}