public final class ImputedRecBuilder
extends java.lang.Object
Class ImputeRecBuilder
contains methods for constructing
and printing a VCF record in VCF 4.3 format. The sample data in
the output VCF record are in the same order that the data were added
with the addSampleData()
method.
Instances of class ImputeRecBuilder
are not thread-safe.
Constructor | Description |
---|---|
ImputedRecBuilder(Marker marker,
int nSamples,
boolean ap,
boolean gp) |
Constructs a new
ImputedRecBuilder instance for the specified
number of samples. |
Modifier and Type | Method | Description |
---|---|---|
void |
addSampleData(float[] a1,
float[] a2) |
Scales the specified probabilities for each allele to each sum to 1.0,
and adds the sample data to the VCF record.
|
Marker |
marker() |
Returns the marker in the VCF record.
|
int |
nSamples() |
Returns the required number of samples in the VCF record.
|
void |
printRec(java.io.PrintWriter out,
boolean isImputed) |
Prints the VCF record to the specified
PrintWriter . |
int |
sampleCnt() |
Returns the number of times the
this.addSampleData()
method has been invoked. |
public ImputedRecBuilder(Marker marker, int nSamples, boolean ap, boolean gp)
ImputedRecBuilder
instance for the specified
number of samples.marker
- the marker corresponding to the VCF recordnSamples
- the number of samplesap
- true
if posterior allele probabilities are to be printedgp
- true
if posterior genotype probabilities are to be printedjava.lang.IllegalArgumentException
- if nSamples < 1
java.lang.NullPointerException
- if marker == null
public Marker marker()
public int nSamples()
public int sampleCnt()
this.addSampleData()
method has been invoked.this.addSampleData()
method has been invokedpublic void addSampleData(float[] a1, float[] a2)
a1
- the allele probabilities for the first allelea2
- the allele probabilities for the second allelejava.lang.IndexOutOfBoundsException
- if
a1.length < this.marker().nAlleles()
java.lang.IndexOutOfBoundsException
- if
a2.length < this.marker().nAlleles()
java.lang.NullPointerException
- if a1 == null || a2 == null
public void printRec(java.io.PrintWriter out, boolean isImputed)
PrintWriter
.
The INFO field of the VCF record will include the DR2 (dose r2) and
AF (ALT allele frequency) subfields.isImputed
- true
if the INFO field of the VCF record will
have an IMP flag and false
otherwiseout
- the PrintWriter
to which the VCF record will be
printedjava.lang.IllegalStateException
- if
this.nSamples() != this.sampleCnt()
java.lang.NullPointerException
- if out == null