Added some methods to complement a single simple base ([AaCcGgTt]) and reverse-complement a byte-array of bases.

git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@483 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
kiran 2009-04-21 22:25:33 +00:00
parent 521e202a10
commit 5b2a7c9c23
1 changed files with 25 additions and 0 deletions

View File

@ -64,10 +64,35 @@ public class BaseUtils {
/**
* Converts a base to the base representing its cross-talk partner
*
* @param base [AaCcGgTt]
* @return C, A, T, G, or '.' if the base can't be understood
*/
static public char crossTalkPartnerBase(char base) {
return baseIndexToSimpleBase(crossTalkPartnerIndex(simpleBaseToBaseIndex(base)));
}
static public byte simpleComplement(char base) {
switch (base) {
case 'A':
case 'a': return 'T';
case 'C':
case 'c': return 'G';
case 'G':
case 'g': return 'C';
case 'T':
case 't': return 'A';
default: return '.';
}
}
static public byte[] simpleReverseComplement(byte[] bases) {
byte[] rcbases = new byte[bases.length];
for (int i = 0; i < bases.length; i++) {
rcbases[i] = simpleComplement((char) bases[bases.length - 1]);
}
return rcbases;
}
}