public final class VcfRecGTParser
extends java.lang.Object
Class VcfRecGTParser
parses VCF records and extracts the GT format
field.
Instances of class VcfRecGTParser
are not thread-safe.
Constructor and Description |
---|
VcfRecGTParser(VcfHeader vcfHeader,
java.lang.String vcfRec)
Constructs a new
VcfRecGTParser object from the specified VCF
record. |
Modifier and Type | Method and Description |
---|---|
int |
allele1()
Returns the first allele of the genotype for the current sample.
|
int |
allele2()
Returns the second allele of the genotype for the current sample.
|
int |
currentSample()
Returns the index of the current sample, or
-1 if
this.nextSample() has not yet been invoked. |
boolean |
isPhased()
Returns
true if the genotype for the current sample is phased,
and returns false otherwise. |
Marker |
marker()
Returns the marker.
|
void |
nextSample()
Increases the current sample index by one.
|
int |
nSamples()
Returns the number of samples.
|
Samples |
samples()
Returns the list of samples.
|
VcfHeader |
vcfHeader()
Returns the VCF meta-information lines and header line.
|
java.lang.String |
vcfRecord()
Returns the VCF record that is being parsed.
|
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 currentSample()
this.nextSample()
has not yet been invoked.this.nextSample()
has not yet been invokedpublic int allele1()
public int allele2()
public boolean isPhased()
true
if the genotype for the current sample is phased,
and returns false
otherwise.true
if the genotype for the current sample is phasedpublic Samples samples()
public int nSamples()
public void nextSample()
java.lang.IndexOutOfBoundsException
- if
(this.currentSample() + 1 == this.nSamples())
immediately prior
to the invocation of this methodjava.lang.IllegalArgumentException
- if a format error is detected in
this.vcfRecord()