BrefWriter
, java.io.Closeable
, java.lang.AutoCloseable
public class AsIsBref3Writer extends java.lang.Object implements BrefWriter
Class AsIsBref3Writer
writes 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 the RefGTRec
passed to the write()
method.
The close()
method must be called after the last invocation of the
write()
method in order to ensure that any buffered data are
written to the output binary reference file.
Instances of class AsIsBref3Writer
are not thread-safe.
Modifier and Type | Field | Description |
---|---|---|
static byte |
ALLELE_CODED |
The byte value denoting an allele coded record
|
static int |
END_OF_DATA |
The end of file code for a bref file.
|
static long |
END_OF_INDEX |
The integer denoting denoting the end of the index in a bref file
|
static int |
MAGIC_NUMBER_V3 |
The initial integer in a bref version 3 file.
|
int |
MAX_SAMPLES |
|
static byte |
SEQ_CODED |
The byte value denoting a sequence coded record
|
Constructor | Description |
---|---|
AsIsBref3Writer(java.lang.String program,
Samples samples,
java.io.File brefFile) |
Constructs a new
AsIsBref4Writer for the specified data. |
Modifier and Type | Method | Description |
---|---|---|
void |
close() |
Flushes any buffered output and releases any system resources that are
held by this
BrefWriter . |
Samples |
samples() |
Returns the list of samples.
|
void |
write(RefGTRec rec) |
Writes the specified phased genotype data in binary reference format.
|
public static final int END_OF_DATA
public static final long END_OF_INDEX
public static final int MAGIC_NUMBER_V3
public static final byte SEQ_CODED
public static final byte ALLELE_CODED
public final int MAX_SAMPLES
public AsIsBref3Writer(java.lang.String program, Samples samples, java.io.File brefFile)
AsIsBref4Writer
for the specified data.
The Java virtual machine will exit with an error message if an I/O
error occurs during object constructionprogram
- 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 or
null
if the output should be directed to standard outputjava.lang.IllegalArgumentException
- if {
samples.nSamples() > AsIsBref4Writer.MAX_SAMPLES
java.lang.NullPointerException
- if program == null || samples == null
public Samples samples()
BrefWriter
samples
in interface BrefWriter
public void write(RefGTRec rec)
BrefWriter
this.close()
has previously been invoked, or if
rec.samples().equals(this.samples()) == false
.write
in interface BrefWriter
rec
- phased genotype datapublic void close()
BrefWriter
BrefWriter
. The Java virtual machine will exit
with an error message if an I/O error occurs during method execution.close
in interface java.lang.AutoCloseable
close
in interface BrefWriter
close
in interface java.io.Closeable