Package imp
Class ImputedRecBuilder
java.lang.Object
imp.ImputedRecBuilder
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 Summary
ConstructorsConstructorDescriptionImputedRecBuilder(Marker marker, int nInputTargHaps, boolean ap, boolean gp) Constructs a newImputedRecBuilderinstance for the specified number of samples. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddSampleData(float[] a1) Scales the specified probabilities for each allele to each sum to 1.0, and adds the sample data to the VCF record.voidaddSampleData(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.inthapCnt()Returns the number of imputed alleles added by the addSampleData() methods.marker()Returns the marker in the VCF record.intReturns the number of input target haplotypes for haploid and diploid samples.voidprintRec(PrintWriter out, boolean isImputed) Prints the VCF record to the specifiedPrintWriter.
-
Constructor Details
-
ImputedRecBuilder
Constructs a newImputedRecBuilderinstance for the specified number of samples.- Parameters:
marker- the marker corresponding to the VCF recordnInputTargHaps- the number of input target haplotypes for haploid and diploid samplesap-trueif posterior allele probabilities are to be printedgp-trueif posterior genotype probabilities are to be printed- Throws:
IllegalArgumentException- ifnInputTargHaps < 1NullPointerException- ifmarker == null
-
-
Method Details
-
marker
Returns the marker in the VCF record.- Returns:
- the marker in the VCF record
-
nInputTargHaps
public int nInputTargHaps()Returns the number of input target haplotypes for haploid and diploid samples.- Returns:
- the number of input target haplotypes for haploid and diploid samples
-
hapCnt
public int hapCnt()Returns the number of imputed alleles added by the addSampleData() methods.- Returns:
- the number of imputed alleles added by the addSampleData() methods
-
addSampleData
public 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. The contract for this method is undefined if any element of the specified arrays is not a finite non-negative number.- Parameters:
a1- the allele probabilities for the first allelea2- the allele probabilities for the second allele- Throws:
IndexOutOfBoundsException- ifa1.length < this.marker().nAlleles()IndexOutOfBoundsException- ifa2.length < this.marker().nAlleles()NullPointerException- ifa1 == null || a2 == null
-
addSampleData
public void addSampleData(float[] a1) Scales the specified probabilities for each allele to each sum to 1.0, and adds the sample data to the VCF record. The contract for this method is undefined if any element of the specified arrays is not a finite non-negative number.- Parameters:
a1- the allele probabilities- Throws:
IndexOutOfBoundsException- ifa1.length < this.marker().nAlleles()IndexOutOfBoundsException- ifa2.length < this.marker().nAlleles()NullPointerException- ifa1 == null || a2 == null
-
printRec
Prints the VCF record to the specifiedPrintWriter. The INFO field of the VCF record will include the DR2 (dose r2) and AF (ALT allele frequency) subfields.- Parameters:
out- thePrintWriterto which the VCF record will be printedisImputed-trueif the INFO field of the VCF record will have an IMP flag andfalseotherwise- Throws:
IllegalStateException- ifthis.hapCnt() != this.nInputTargHaps()NullPointerException- ifout == null
-