Package bref
Class AsIsBref3Writer
- java.lang.Object
-
- bref.AsIsBref3Writer
-
- All Implemented Interfaces:
BrefWriter,java.io.Closeable,java.lang.AutoCloseable
public class AsIsBref3Writer extends java.lang.Object implements BrefWriter
Class
AsIsBref3Writerwrites VCF data with phased, non-missing genotypes to a binary reference format v3 (bref) file. Each record that is written will have the same internal representation (allele-coded or sequence-coded) as theRefGTRecpassed to thewrite()method. Theclose()method must be called after the last invocation of thewrite()method in order to ensure that any buffered data are written to the output binary reference file.Instances of class
AsIsBref3Writerare not thread-safe.
-
-
Field Summary
Fields Modifier and Type Field Description static byteALLELE_CODEDThe byte value denoting an allele coded recordstatic intEND_OF_DATAThe end of file code for a bref file.static longEND_OF_INDEXThe integer denoting denoting the end of the index in a bref filestatic intMAGIC_NUMBER_V3The initial integer in a bref version 3 file.intMAX_SAMPLESstatic byteSEQ_CODEDThe byte value denoting a sequence coded record
-
Constructor Summary
Constructors Constructor Description AsIsBref3Writer(java.lang.String program, Samples samples, java.io.File brefFile)Constructs a newAsIsBref4Writerfor the specified data.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Flushes any buffered output and releases any system resources that are held by thisBrefWriter.Samplessamples()Returns the list of samples.voidwrite(RefGTRec rec)Writes the specified phased genotype data in binary reference format.
-
-
-
Field Detail
-
END_OF_DATA
public static final int END_OF_DATA
The end of file code for a bref file.- See Also:
- Constant Field Values
-
END_OF_INDEX
public static final long END_OF_INDEX
The integer denoting denoting the end of the index in a bref file- See Also:
- Constant Field Values
-
MAGIC_NUMBER_V3
public static final int MAGIC_NUMBER_V3
The initial integer in a bref version 3 file.- See Also:
- Constant Field Values
-
SEQ_CODED
public static final byte SEQ_CODED
The byte value denoting a sequence coded record- See Also:
- Constant Field Values
-
ALLELE_CODED
public static final byte ALLELE_CODED
The byte value denoting an allele coded record- See Also:
- Constant Field Values
-
MAX_SAMPLES
public final int MAX_SAMPLES
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
AsIsBref3Writer
public AsIsBref3Writer(java.lang.String program, Samples samples, java.io.File brefFile)Constructs a newAsIsBref4Writerfor the specified data. The Java virtual machine will exit with an error message if an I/O error occurs during object construction- Parameters:
program- the name of the program which is creating the binary reference file.samples- the list of samples whose genotype data will be written in binary reference formatbrefFile- name of the output binary reference file ornullif the output should be directed to standard output- Throws:
java.lang.IllegalArgumentException- if {samples.size() > AsIsBref4Writer.MAX_SAMPLESjava.lang.NullPointerException- ifprogram == null || samples == null
-
-
Method Detail
-
samples
public Samples samples()
Description copied from interface:BrefWriterReturns the list of samples.- Specified by:
samplesin interfaceBrefWriter- Returns:
- the list of samples
-
write
public void write(RefGTRec rec)
Description copied from interface:BrefWriterWrites the specified phased genotype data in binary reference format. The Java virtual machine will exit with an error message if an I/O error occurs during method execution, ifthis.close()has previously been invoked, or ifrec.samples().equals(this.samples()) == false.- Specified by:
writein interfaceBrefWriter- Parameters:
rec- phased genotype data
-
close
public void close()
Description copied from interface:BrefWriterFlushes any buffered output and releases any system resources that are held by thisBrefWriter. The Java virtual machine will exit with an error message if an I/O error occurs during method execution.- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfaceBrefWriter- Specified by:
closein interfacejava.io.Closeable
-
-