public class VcfEmissionCompressor
extends java.lang.Object
Class VcfEmissionCompressor
compresses a sequence of
VcfEmission
objects which contain reference genotype data.
Reference genotype data does not contain any unphased or missing genotypes.
Compression is performed by storing the list of distinct allele sequences
and the allele sequence carried by each haplotype.
Class VcfEmissionCompressor
is not thread-safe.
Constructor and Description |
---|
VcfEmissionCompressor(Samples samples,
int capacity)
Constructs a new
VcfEmissionCompressor for the specified
samples. |
Modifier and Type | Method and Description |
---|---|
boolean |
addToCompessedList(VcfEmission em)
Attempts to add the specified
VcfEmission object to the list of
compressed VcfEmission objects, and returns true
if the VcfEmission object was added. |
int |
capacity()
Returns the maximum number of allele sequences that is
permitted to exist in the list of compressed
VcfEmission objects. |
void |
clear()
Clears the list of compressed
VcfEmission objects. |
java.util.List<VcfEmission> |
getCompressedList()
Returns the list of compressed
VcfEmission objects. |
IntArray |
hapToSeq()
Returns an array of length
2*this.samples().nSamples() , whose
j -th element is the index of the allele sequence carried by the
j -th haplotype in the list of compressed VcfEmission
objects. |
Marker |
marker(int index)
Returns the specified marker.
|
int |
nSeq()
Returns the number of distinct allele sequences in the list of
compressed
VcfEmission objects. |
Samples |
samples()
Returns the list of samples whose phased genotype data will be compressed.
|
IntArray |
seqToAllele(int index)
Returns an array of length
this.nSeq() whose j -th
element is the allele carried by the j -th distinct allele
sequence at this.marker(index) . |
int |
size()
Returns the size of the list of compressed
VcfEmission objects. |
public VcfEmissionCompressor(Samples samples, int capacity)
VcfEmissionCompressor
for the specified
samples.samples
- the list of samples whose data will be compressedcapacity
- the maximum number of allele sequences that is
permitted to exist in the list of compressed VcfEmission
objectsjava.lang.IllegalArgumentException
- if capacity < 0
java.lang.NullPointerException
- if samples == null
public Samples samples()
public int capacity()
VcfEmission
objects.VcfEmission
objectspublic boolean addToCompessedList(VcfEmission em)
VcfEmission
object to the list of
compressed VcfEmission
objects, and returns true
if the VcfEmission
object was added.em
- reference genotypes for a markertrue
if the specified VcfEmission
object was
added to the list of compressed markers, and false
othersjava.lang.IllegalArgumentException
- if
em.samples().equals(this.samples()) == false
java.lang.IllegalArgumentException
- if em.isRefData() == false
java.lang.NullPointerException
- if em == null
public int size()
VcfEmission
objects.VcfEmission
objectspublic int nSeq()
VcfEmission
objects.public Marker marker(int index)
index
- an index in the list of compressed VcfEmission
objectsjava.lang.IndexOutOfBoundsException
- if
index < 0 || index >= this.size()
public IntArray hapToSeq()
2*this.samples().nSamples()
, whose
j
-th element is the index of the allele sequence carried by the
j
-th haplotype in the list of compressed VcfEmission
objects.public IntArray seqToAllele(int index)
this.nSeq()
whose j
-th
element is the allele carried by the j
-th distinct allele
sequence at this.marker(index)
.index
- an index in the list of compressed VcfEmission
objectsjava.lang.IndexOutOfBoundsException
- if
index < 0 || index >= this.size()
public java.util.List<VcfEmission> getCompressedList()
VcfEmission
objects.VcfEmission
objectspublic final void clear()
VcfEmission
objects.