public final class BaseUtils
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
BaseUtils.Base |
static class |
BaseUtils.BaseSubstitutionType |
Modifier and Type | Field and Description |
---|---|
static char[] |
BASE_CHARS |
static byte[] |
BASES |
static java.util.Comparator<byte[]> |
BASES_COMPARATOR
Lexicographical sorting of base arrays
Comparator . |
Modifier and Type | Method and Description |
---|---|
static byte |
baseIndexToSimpleBase(int baseIndex)
Converts a base index to a simple base
|
static boolean |
basesAreEqual(byte base1,
byte base2) |
static byte |
basesToIUPAC(byte base1,
byte base2)
Converts a pair of bases to their IUPAC ambiguity code
|
static byte[] |
convertIUPACtoN(byte[] bases,
boolean errorOnBadReferenceBase,
boolean ignoreConversionOfFirstByte) |
static void |
fillWithRandomBases(byte[] dest,
int fromIndex,
int toIndex)
Fill an array section with random bases.
|
static byte |
getComplement(byte base) |
static boolean |
isAllRegularBases(byte[] bases)
Returns true iff all bases are 'regular'
isRegularBase(byte) . |
static boolean |
isNBase(byte base) |
static boolean |
isRegularBase(byte base)
Returns true iff the base represented by the byte is a 'regular' base (ACGT or *).
|
static boolean |
isTransition(byte base1,
byte base2) |
static int |
simpleBaseToBaseIndex(byte base)
Converts a simple base to a base index
|
static byte |
simpleComplement(byte base)
Return the complement (A <-> T or C <-> G) of a base, or the specified base if it can't be complemented (i.e.
|
static byte[] |
simpleReverseComplement(byte[] bases)
Reverse complement a byte array of bases (that is, chars casted to bytes, *not* base indices in byte form)
|
static BaseUtils.BaseSubstitutionType |
SNPSubstitutionType(byte base1,
byte base2)
Returns the base substitution type of the 2 state SNP
|
public static final byte[] BASES
public static final char[] BASE_CHARS
public static final java.util.Comparator<byte[]> BASES_COMPARATOR
Comparator
.public static boolean isNBase(byte base)
public static BaseUtils.BaseSubstitutionType SNPSubstitutionType(byte base1, byte base2)
base1
- base2
- public static boolean isTransition(byte base1, byte base2)
public static boolean basesAreEqual(byte base1, byte base2)
public static byte[] convertIUPACtoN(byte[] bases, boolean errorOnBadReferenceBase, boolean ignoreConversionOfFirstByte)
public static int simpleBaseToBaseIndex(byte base)
base
- [AaCcGgTt]public static boolean isRegularBase(byte base)
public static boolean isAllRegularBases(byte[] bases)
isRegularBase(byte)
.public static byte baseIndexToSimpleBase(int baseIndex)
baseIndex
- 0, 1, 2, 3public static byte simpleComplement(byte base)
base
- the base [AaCcGgTt]public static byte[] simpleReverseComplement(byte[] bases)
bases
- the byte array of basespublic static void fillWithRandomBases(byte[] dest, int fromIndex, int toIndex)
dest
- array to fill.fromIndex
- first index to be filled (inclusive).toIndex
- index after last to be filled (exclusive).java.lang.IllegalArgumentException
- if dest
is null
,
fromIndex
or toIndex
is negative,
fromIndex
or toIndex
are greater than dest
length,
or fromIndex
greater than toIndex
.public static byte getComplement(byte base)
public static byte basesToIUPAC(byte base1, byte base2)
base1
- 1st basebase2
- 2nd base