public final class BCF2Utils
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static BCF2Type[] |
ID_TO_ENUM |
static BCF2Type[] |
INTEGER_TYPES_BY_SIZE |
static int |
MAX_ALLELES_IN_GENOTYPES |
static int |
MAX_INLINE_ELEMENTS |
static int |
OVERFLOW_ELEMENT_MARKER |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
collapseStringList(java.util.List<java.lang.String> strings)
Collapse multiple strings into a comma separated list
["s1", "s2", "s3"] => ",s1,s2,s3"
|
static int |
decodeSize(byte typeDescriptor) |
static BCF2Type |
decodeType(byte typeDescriptor) |
static int |
decodeTypeID(byte typeDescriptor) |
static BCF2Type |
determineIntegerType(int value) |
static BCF2Type |
determineIntegerType(int[] values) |
static BCF2Type |
determineIntegerType(java.util.List<java.lang.Integer> values) |
static byte |
encodeTypeDescriptor(int nElements,
BCF2Type type) |
static java.util.List<java.lang.String> |
explodeStringList(java.lang.String collapsed)
Inverse operation of collapseStringList.
|
static boolean |
headerLinesAreOrderedConsistently(VCFHeader outputHeader,
VCFHeader genotypesBlockHeader)
Are the elements and their order in the output and input headers consistent so that
we can write out the raw genotypes block without decoding and recoding it?
If the order of INFO, FILTER, or contrig elements in the output header is different than
in the input header we must decode the blocks using the input header and then recode them
based on the new output order.
|
static boolean |
isCollapsedString(java.lang.String s) |
static java.util.ArrayList<java.lang.String> |
makeDictionary(VCFHeader header)
Create a strings dictionary from the VCF header
The dictionary is an ordered list of common VCF identifers (FILTER, INFO, and FORMAT)
fields.
|
static BCF2Type |
maxIntegerType(BCF2Type t1,
BCF2Type t2)
Returns the maximum BCF2 integer size of t1 and t2
For example, if t1 == INT8 and t2 == INT16 returns INT16
|
static byte |
readByte(java.io.InputStream stream) |
static java.io.File |
shadowBCF(java.io.File vcfFile)
Returns a good name for a shadow BCF file for vcfFile.
|
static boolean |
sizeIsOverflow(byte typeDescriptor) |
static <T> java.util.List<T> |
toList(java.lang.Class<T> c,
java.lang.Object o)
Helper function that takes an object and returns a list representation
of it:
o == null => []
o is a list => o
else => [o]
|
public static final int MAX_ALLELES_IN_GENOTYPES
public static final int OVERFLOW_ELEMENT_MARKER
public static final int MAX_INLINE_ELEMENTS
public static final BCF2Type[] INTEGER_TYPES_BY_SIZE
public static final BCF2Type[] ID_TO_ENUM
public static java.util.ArrayList<java.lang.String> makeDictionary(VCFHeader header)
header
- the VCFHeader from which to build the dictionarypublic static byte encodeTypeDescriptor(int nElements, BCF2Type type)
public static int decodeSize(byte typeDescriptor)
public static int decodeTypeID(byte typeDescriptor)
public static BCF2Type decodeType(byte typeDescriptor)
public static boolean sizeIsOverflow(byte typeDescriptor)
public static byte readByte(java.io.InputStream stream) throws java.io.IOException
java.io.IOException
public static java.lang.String collapseStringList(java.util.List<java.lang.String> strings)
strings
- size > 1 list of stringspublic static java.util.List<java.lang.String> explodeStringList(java.lang.String collapsed)
collapsed
- public static boolean isCollapsedString(java.lang.String s)
public static final java.io.File shadowBCF(java.io.File vcfFile)
vcfFile
- public static BCF2Type determineIntegerType(int value)
public static BCF2Type determineIntegerType(int[] values)
public static BCF2Type maxIntegerType(BCF2Type t1, BCF2Type t2)
t1
- t2
- public static BCF2Type determineIntegerType(java.util.List<java.lang.Integer> values)
public static <T> java.util.List<T> toList(java.lang.Class<T> c, java.lang.Object o)
c
- the class of the objecto
- the object to convert to a Java Listpublic static boolean headerLinesAreOrderedConsistently(VCFHeader outputHeader, VCFHeader genotypesBlockHeader)