Package bref

Class AsIsBref3Writer

java.lang.Object
bref.AsIsBref3Writer
All Implemented Interfaces:
BrefWriter, Closeable, AutoCloseable

public class AsIsBref3Writer extends 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.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final byte
    The byte value denoting an allele coded record
    static final int
    The end of file code for a bref file.
    static final long
    The integer denoting denoting the end of the index in a bref file
    static final int
    The initial integer in a bref version 3 file.
    final int
     
    static final byte
    The byte value denoting a sequence coded record
  • Constructor Summary

    Constructors
    Constructor
    Description
    AsIsBref3Writer(String program, Samples samples, File brefFile)
    Constructs a new AsIsBref4Writer for the specified data.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Flushes any buffered output and releases any system resources that are held by this BrefWriter.
    Returns the list of samples.
    void
    Writes the specified phased genotype data in binary reference format.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • END_OF_DATA

      public static final int END_OF_DATA
      The end of file code for a bref file.
      See Also:
    • 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:
    • MAGIC_NUMBER_V3

      public static final int MAGIC_NUMBER_V3
      The initial integer in a bref version 3 file.
      See Also:
    • SEQ_CODED

      public static final byte SEQ_CODED
      The byte value denoting a sequence coded record
      See Also:
    • ALLELE_CODED

      public static final byte ALLELE_CODED
      The byte value denoting an allele coded record
      See Also:
    • MAX_SAMPLES

      public final int MAX_SAMPLES
      See Also:
  • Constructor Details

    • AsIsBref3Writer

      public AsIsBref3Writer(String program, Samples samples, File brefFile)
      Constructs a new AsIsBref4Writer for 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 format
      brefFile - name of the output binary reference file or null if the output should be directed to standard output
      Throws:
      IllegalArgumentException - if { samples.size() > AsIsBref4Writer.MAX_SAMPLES
      NullPointerException - if program == null || samples == null
  • Method Details

    • samples

      public Samples samples()
      Description copied from interface: BrefWriter
      Returns the list of samples.
      Specified by:
      samples in interface BrefWriter
      Returns:
      the list of samples
    • write

      public void write(RefGTRec rec)
      Description copied from interface: BrefWriter
      Writes 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, if this.close() has previously been invoked, or if rec.samples().equals(this.samples()) == false.
      Specified by:
      write in interface BrefWriter
      Parameters:
      rec - phased genotype data
    • close

      public void close()
      Description copied from interface: BrefWriter
      Flushes any buffered output and releases any system resources that are held by this BrefWriter. The Java virtual machine will exit with an error message if an I/O error occurs during method execution.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface BrefWriter
      Specified by:
      close in interface Closeable