public final class VcfWriter
extends java.lang.Object
Class VcfWriter contains static methods for writing data in
VCF 4.2 format.
Instances of class VcfWriter are not thread-safe.
| Modifier and Type | Method and Description |
|---|---|
static void |
appendRecords(AlleleProbs alProbs,
boolean[] isImputed,
int start,
int end,
boolean printDS,
boolean printGP,
java.io.PrintWriter out)
Writes the data in alProbs for markers with index between
start (inclusive) and end (exclusive) to the specified
PrintWriter. |
static void |
appendRecords(GenotypeValues gv,
int start,
int end,
java.io.PrintWriter out)
Writes the specified genotype data as VCF records to the specified
PrintWriter. |
static void |
blockedAppendRecords(AlleleProbs alProbs,
boolean[] isImputed,
int start,
int end,
boolean printDS,
boolean printGP,
java.io.PrintWriter out)
Writes the data in alProbs for markers with index between
start (inclusive) and end (exclusive) to the specified
PrintWriter. |
static void |
printFixedFieldsGT(Marker marker,
java.io.PrintWriter out)
Prints the first 9 VCF record fields for the specified marker to
the specified
PrintWriter. |
static void |
writeMetaLines(java.lang.String[] sampleIds,
java.lang.String source,
boolean printGT,
boolean printGP,
boolean printGL,
java.io.PrintWriter out)
Writes VCF meta-information lines and header line to the specified
PrintWriter. |
static void |
writeMetaLinesGT(java.lang.String[] sampleIds,
java.lang.String source,
java.io.PrintWriter out)
Writes VCF meta-information lines and header line to the specified
PrintWriter. |
public static void writeMetaLinesGT(java.lang.String[] sampleIds,
java.lang.String source,
java.io.PrintWriter out)
PrintWriter. Only one FORMAT subfield, the GT subfield,
is described in the meta-information lines.sampleIds - the sample identifierssource - a description of the data source, or null if
no description is to be printedout - the PrintWriter to which VCF meta-information
lines will be writtenjava.lang.NullPointerException - if out == nulljava.lang.NullPointerException - if
sampleIds == null, or if sampleIds[j] == null for any
j satisfying (0 <= j && j < <sampleIds.length)public static void writeMetaLines(java.lang.String[] sampleIds,
java.lang.String source,
boolean printGT,
boolean printGP,
boolean printGL,
java.io.PrintWriter out)
PrintWriter.sampleIds - the sample identifierssource - a description of the data source, or null if
no description is to be printedprintGT - true if the meta-information lines
will describe the GT FORMAT subfield and false otherwiseprintGP - true if the meta-information lines
will describe the GP FORMAT subfield and false otherwiseprintGL - true if the meta-information lines
will describe the GL FORMAT subfield and false otherwiseout - the PrintWriter to which VCF meta-information lines
will be written.java.lang.NullPointerException - if out == nulljava.lang.NullPointerException - if
sampleIds == null, or if sampleIds[j] == null for any
j satisfying (0 <= j && j < sampleIds.length)public static void appendRecords(GenotypeValues gv, int start, int end, java.io.PrintWriter out)
PrintWriter.gv - the scaled sample posterior genotype probabilitiesstart - the starting marker index (inclusive)end - the ending marker index (exclusive)out - the PrintWriter to which VCF records will
be written.java.lang.IllegalArgumentException - if
haps.markers().equals(gv.markers()) == falsejava.lang.IndexOutOfBoundsException - if
(start < 0 || start > end || end > haps.nMarkers())java.lang.NullPointerException - if
(gv == null || out == null)public static void appendRecords(AlleleProbs alProbs, boolean[] isImputed, int start, int end, boolean printDS, boolean printGP, java.io.PrintWriter out)
start (inclusive) and end (exclusive) to the specified
PrintWriter.alProbs - the estimated haplotype allele probabilitiesisImputed - an array of length alProbs.nMarkers()
whose j-th element is true if the corresponding
marker is imputed, and false otherwisestart - the starting marker index (inclusive)end - the ending marker index (exclusive)printDS - true if the DS field should be printed, and
false otherwiseprintGP - true if the GP field should be printed, and
false otherwiseout - the PrintWriter to which VCF records will be writtenjava.lang.IllegalArgumentException - if
isImputed.length != alProbs.nMarkers()java.lang.IndexOutOfBoundsException - if
(start < 0 || start > end || end > alProbs.nMarkers())java.lang.NullPointerException - if
alProbs == null || isImputed == null || out == nullpublic static void blockedAppendRecords(AlleleProbs alProbs, boolean[] isImputed, int start, int end, boolean printDS, boolean printGP, java.io.PrintWriter out)
start (inclusive) and end (exclusive) to the specified
PrintWriter.alProbs - the estimated haplotype allele probabilitiesisImputed - an array of length alProbs.nMarkers()
whose j-th element is true if the corresponding
marker is imputed, and false otherwisestart - the starting marker index (inclusive)end - the ending marker index (exclusive)printDS - true if the DS field should be printed, and
false otherwiseprintGP - true if the GP field should be printed, and
false otherwiseout - the PrintWriter to which VCF records will be writtenjava.lang.IllegalArgumentException - if
isImputed.length != alProbs.nMarkers()java.lang.IndexOutOfBoundsException - if
(start < 0 || start > end || end > alProbs.nMarkers())java.lang.NullPointerException - if
alProbs == null || isImputed == null || out == nullpublic static void printFixedFieldsGT(Marker marker, java.io.PrintWriter out)
PrintWriter. Only one VCF FORMAT subfield,
the GT subfield, is printed.marker - a markerout - the PrintWriter to which the first 9 VCF record
fields will be writtenjava.lang.NullPointerException - if marker == null || out == null