Package vcf
Class VcfWriter
- java.lang.Object
-
- vcf.VcfWriter
-
public final class VcfWriter extends java.lang.ObjectClass
VcfWritercontains static methods for writing data in VCF 4.2 format.Instances of class
VcfWriterare not thread-safe.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidappendRecords(GT phasedTarg, int start, int end, java.io.PrintWriter out)Writes the data in phased genotypes for the specified markers to the specifiedPrintWriter.static voidappendRecords(Samples samples, GTRec[] recs, java.io.PrintWriter out)Writes the data in phased genotypes for the specified markers to the specifiedPrintWriter.static voidprintFixedFieldsGT(Marker marker, java.io.PrintWriter out)Prints the first 9 VCF record fields for the specified marker to the specifiedPrintWriter.static voidwriteMetaLines(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 specifiedPrintWriter.static voidwriteMetaLinesGT(java.lang.String[] sampleIds, java.lang.String source, java.io.PrintWriter out)Writes VCF meta-information lines and header line to the specifiedPrintWriter.
-
-
-
Method Detail
-
writeMetaLinesGT
public 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 specifiedPrintWriter. Only one FORMAT subfield, the GT subfield, is described in the meta-information lines.- Parameters:
sampleIds- the sample identifierssource- a description of the data source, ornullif no description is to be printedout- thePrintWriterto which VCF meta-information lines will be written- Throws:
java.lang.NullPointerException- ifout == nulljava.lang.NullPointerException- ifsampleIds == null, or ifsampleIds[j] == nullfor anyjsatisfying(0 <= j && j < <sampleIds.length)
-
writeMetaLines
public 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 specifiedPrintWriter.- Parameters:
sampleIds- the sample identifierssource- a description of the data source, ornullif no description is to be printedds- { @code true} if the meta-information lines will describe the DS FORMAT subfield andfalseotherwiseap-trueif the meta-information lines will describe the AP1 and AP2 FORMAT subfields andfalseotherwisegp-trueif the meta-information lines will describe the GP FORMAT subfield andfalseotherwisegl-trueif the meta-information lines will describe the GL FORMAT subfield andfalseotherwiseout- thePrintWriterto which VCF meta-information lines will be written.- Throws:
java.lang.NullPointerException- ifout == nulljava.lang.NullPointerException- ifsampleIds == null, or ifsampleIds[j] == nullfor anyjsatisfying(0 <= j && j < sampleIds.length)
-
appendRecords
public static void appendRecords(GT phasedTarg, int start, int end, java.io.PrintWriter out)
Writes the data in phased genotypes for the specified markers to the specifiedPrintWriter.- Parameters:
phasedTarg- the estimated haplotype allele probabilitiesstart- the starting marker index (inclusive)end- the ending marker index (exclusive)out- thePrintWriterto which VCF records will be written- Throws:
java.lang.IllegalArgumentException- ifphasedTarg.isPhased() == falsejava.lang.IndexOutOfBoundsException- if(start < 0 || start > end || end > phasedTarg.nMarkers())java.lang.NullPointerException- ifphasedTarg == null || out == null
-
appendRecords
public static void appendRecords(Samples samples, GTRec[] recs, java.io.PrintWriter out)
Writes the data in phased genotypes for the specified markers to the specifiedPrintWriter.- Parameters:
samples- the list of samplesrecs- the estimated haplotype allele probabilitiesout- thePrintWriterto which VCF records will be written- Throws:
java.lang.IllegalArgumentException- ifphasedTarg.isPhased() == falsejava.lang.IndexOutOfBoundsException- if(start < 0 || start > end || end > phasedTarg.nMarkers())java.lang.NullPointerException- ifphasedTarg == null || out == null
-
printFixedFieldsGT
public static void printFixedFieldsGT(Marker marker, java.io.PrintWriter out)
Prints the first 9 VCF record fields for the specified marker to the specifiedPrintWriter. Only one VCF FORMAT subfield, the GT subfield, is printed.- Parameters:
marker- a markerout- thePrintWriterto which the first 9 VCF record fields will be written- Throws:
java.lang.NullPointerException- ifmarker == null || out == null
-
-