public final class VcfRecGTParser
extends java.lang.Object
Class VcfRecGTParser
parses VCF records and extracts the GT format
field.
Instances of class VcfRecGTParser
are immutable.
Constructor | Description |
---|---|
VcfRecGTParser(VcfHeader vcfHeader,
java.lang.String vcfRec) |
Constructs a new
VcfRecGTParser object from the specified VCF
record. |
Modifier and Type | Method | Description |
---|---|---|
Marker |
marker() |
Returns the marker.
|
int |
nAlleles() |
Returns
this.marker().nAlleles() . |
int[][] |
nonMajRefIndices() |
Returns an array of length
this.nAlleles() whose
k -th element is the list of haplotype indices carrying
the k -th allele if k is a non-major allele,
and whose k -th element is null if k is
the major allele. |
int |
nSamples() |
Returns the number of samples.
|
int[] |
phasedAlleles() |
Returns the list of phased alleles in the backing VCF record.
|
Samples |
samples() |
Returns the list of samples.
|
void |
storeAlleles(java.util.BitSet allele1,
java.util.BitSet allele2,
java.util.BitSet isMissing1,
java.util.BitSet isMissing2,
java.util.BitSet isPhased) |
Stores the genotypes genotypes in the specified BitSets.
|
VcfHeader |
vcfHeader() |
Returns the VCF meta-information lines and header line for the backing
VCF record
|
java.lang.String |
vcfRecord() |
Returns the backing VCF record.
|
public VcfRecGTParser(VcfHeader vcfHeader, java.lang.String vcfRec)
VcfRecGTParser
object from the specified VCF
record.vcfHeader
- the VCF meta-information lines and header linevcfRec
- the VCF recordjava.lang.IllegalArgumentException
- if
vcfHeader.nSamples() == 0
java.lang.IllegalArgumentException
- if a format error is detected in the
vcfRecord
java.lang.NullPointerException
- if
vcfHeader == null || vcfRec == null
public VcfHeader vcfHeader()
public java.lang.String vcfRecord()
public Marker marker()
public int nAlleles()
this.marker().nAlleles()
.public Samples samples()
public int nSamples()
public void storeAlleles(java.util.BitSet allele1, java.util.BitSet allele2, java.util.BitSet isMissing1, java.util.BitSet isMissing2, java.util.BitSet isPhased)
allele1
- an empty BitSet in which the first allele for each
sample is storedallele2
- an empty BitSet in which the second allele for each
sample is storedisMissing1
- an empty BitSet whose k
-th bit will be set
if the first allele of the k
-th sample is missingisMissing2
- an empty BitSet whose k
-th bit will be set
if the second allele of the k
-th sample is missingisPhased
- an empty BitSet whose k
-th bit will be set
if the phased allele separator is present in the k
-th samplejava.lang.IllegalArgumentException
- if a format error is detected in the
VCF recordjava.lang.NullPointerException
- if any parameter is null
public int[] phasedAlleles()
java.lang.IllegalArgumentException
- if the VCF record contains an
unphased or missing genotypejava.lang.IllegalArgumentException
- if a format error is detected in the
VCF recordpublic int[][] nonMajRefIndices()
this.nAlleles()
whose
k
-th element is the list of haplotype indices carrying
the k
-th allele if k
is a non-major allele,
and whose k
-th element is null
if k
is
the major allele. If there is more than one allele with maximal count,
the allele with maximal count having the smallest index is defined to
be the major allele.java.lang.IllegalArgumentException
- if a format error is detected in
the specified VCF record or if the specified VCF header is
inconsistent with the specified VCF header.java.lang.NullPointerException
- if vcfRec == null || rec == null