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 | Description |
---|---|---|
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 |
appendRecords(GT phasedTarg,
int start,
int end,
boolean printDS,
boolean printGP,
java.io.PrintWriter out) |
Writes the data in phased genotypes for the specified markers
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 ds,
boolean ap,
boolean gp,
boolean gl,
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 == null
java.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 ds, boolean ap, boolean gp, boolean gl, java.io.PrintWriter out)
PrintWriter
.sampleIds
- the sample identifierssource
- a description of the data source, or null
if
no description is to be printedds
- { @code true} if the meta-information lines
will describe the DS FORMAT subfield and false
otherwiseap
- true
if the meta-information lines
will describe the AP1 and AP2 FORMAT subfields and false
otherwisegp
- true
if the meta-information lines
will describe the GP FORMAT subfield and false
otherwisegl
- 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 == null
java.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()) == false
java.lang.IndexOutOfBoundsException
- if
(start < 0 || start > end || end > haps.nMarkers())
java.lang.NullPointerException
- if
(gv == null || out == null)
public static void appendRecords(GT phasedTarg, int start, int end, boolean printDS, boolean printGP, java.io.PrintWriter out)
PrintWriter
.phasedTarg
- the estimated haplotype allele probabilitiesstart
- 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
phasedTarg.isPhased() == false
java.lang.IndexOutOfBoundsException
- if
(start < 0 || start > end || end > phasedTarg.nMarkers())
java.lang.NullPointerException
- if
alProbs == phasedTarg == null || out == null
public 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