public class GeneralUtils extends Object
Modifier and Type | Field | Description |
---|---|---|
static boolean |
DEBUG_MODE_ENABLED |
Setting this to true causes the VCF/BCF/VariantContext classes to emit debugging information
to standard error
|
static double |
LOG10_P_OF_ZERO |
The smallest log10 value we'll emit from normalizeFromLog10 and other functions
where the real-space value is 0.0.
|
Constructor | Description |
---|---|
GeneralUtils() |
Modifier and Type | Method | Description |
---|---|---|
static double |
arrayMax(double[] array) |
|
static byte |
compareDoubles(double a,
double b) |
Compares double values for equality (within 1e-6), or inequality.
|
static byte |
compareDoubles(double a,
double b,
double epsilon) |
Compares double values for equality (within epsilon), or inequality.
|
static <T> List<T> |
cons(T elt,
List<T> l) |
|
static <T> String |
join(String separator,
Collection<T> objects) |
Returns a string of the form elt1.toString() [sep elt2.toString() ...
|
static <T> List<List<T>> |
makePermutations(List<T> objects,
int n,
boolean withReplacement) |
Make all combinations of N size of objects
if objects = [A, B, C]
if N = 1 => [[A], [B], [C]]
if N = 2 => [[A, A], [B, A], [C, A], [A, B], [B, B], [C, B], [A, C], [B, C], [C, C]]
|
static int |
maxElementIndex(double[] array) |
|
static int |
maxElementIndex(double[] array,
int endIndex) |
|
static double[] |
normalizeFromLog10(double[] array) |
normalizes the log10-based array.
|
static double[] |
normalizeFromLog10(double[] array,
boolean takeLog10OfOutput) |
normalizes the log10-based array.
|
static double[] |
normalizeFromLog10(double[] array,
boolean takeLog10OfOutput,
boolean keepInLogSpace) |
See #normalizeFromLog10 but with the additional option to use an approximation that keeps the calculation always in log-space
|
static <T> List<T> |
reverse(List<T> l) |
public static final boolean DEBUG_MODE_ENABLED
public static final double LOG10_P_OF_ZERO
public static <T> String join(String separator, Collection<T> objects)
T
- the type of the objectsseparator
- the string to use to separate objectsobjects
- a collection of objects. the element order is defined by the iterator over objectspublic static double[] normalizeFromLog10(double[] array)
array
- the array to be normalizedpublic static double[] normalizeFromLog10(double[] array, boolean takeLog10OfOutput)
array
- the array to be normalizedtakeLog10OfOutput
- if true, the output will be transformed back into log10 unitspublic static double[] normalizeFromLog10(double[] array, boolean takeLog10OfOutput, boolean keepInLogSpace)
array
- takeLog10OfOutput
- keepInLogSpace
- public static double arrayMax(double[] array)
public static int maxElementIndex(double[] array)
public static int maxElementIndex(double[] array, int endIndex)
public static <T> List<List<T>> makePermutations(List<T> objects, int n, boolean withReplacement)
T
- objects
- n
- withReplacement
- if false, the resulting permutations will only contain unique objects from objectspublic static byte compareDoubles(double a, double b)
a
- the first double valueb
- the second double valuepublic static byte compareDoubles(double a, double b, double epsilon)
a
- the first double valueb
- the second double valueepsilon
- the precision within which two double values will be considered equal