public class SeqCoder3
extends java.lang.Object
Class SeqCoder3 compresses a sequence of allele-coded
RefGTRec objects. The class is designed for use with brev v3 format.
Compression is performed by storing the list of distinct allele sequences
and the allele sequence carried by each haplotype.
Class SeqCoder3 is not thread-safe.
| Modifier and Type | Field | Description |
|---|---|---|
static float |
COMPRESS_FREQ_THRESHOLD |
The major allele frequency threshold for allele coding.
|
static int |
MAX_NALLELES |
The maximum number of alleles are that permitted in order
for the
add() method to return true |
| Constructor | Description |
|---|---|
SeqCoder3(Samples samples) |
Constructs a new
SeqCoder3 for the specified samples. |
SeqCoder3(Samples samples,
int maxNSeq) |
Constructs a new
SeqCoder3 for the specified samples. |
| Modifier and Type | Method | Description |
|---|---|---|
boolean |
add(RefGTRec rec) |
Attempts to add the specified
RefGTRec object to the list of
compressed RefGTRec objects, and returns true
if the RefGTRec object was added. |
static int |
defaultMaxNSeq(int nSamples) |
Returns the default maximum number of sequences for the specified
number of samples.
|
java.util.List<RefGTRec> |
getCompressedList() |
Returns and clears the stored list of compressed
RefGTRec
objects. |
int |
maxNSeq() |
Returns the maximum number of distinct allele sequences.
|
int |
nRecs() |
Returns the number of compressed
RefGTRec objects. |
Samples |
samples() |
Returns the list of samples whose phased genotype data will be compressed.
|
public static final int MAX_NALLELES
add() method to return truepublic static final float COMPRESS_FREQ_THRESHOLD
public SeqCoder3(Samples samples)
SeqCoder3 for the specified samples.samples - the list of samples whose data will be compressedjava.lang.NullPointerException - if samples == nullpublic SeqCoder3(Samples samples, int maxNSeq)
SeqCoder3 for the specified samples.samples - the list of samples whose data will be compressedmaxNSeq - the maximum number of distinct allele sequences
permitted if the add() method returns truejava.lang.NullPointerException - if samples == nulljava.lang.IllegalArgumentException - maxNSeq < 0 || maxNSeq >= Chracter.MAX_VALUEpublic static int defaultMaxNSeq(int nSamples)
(int) Math.min((long) Math.pow(2, 2*Math.log10(nSamples) + 1),
Character.MAX_VALUE)nSamples - the number of samplesjava.lang.IllegalArgumentException - if nSamples < 1public Samples samples()
public int nRecs()
RefGTRec objects.RefGTRec objectspublic int maxNSeq()
public boolean add(RefGTRec rec)
RefGTRec object to the list of
compressed RefGTRec objects, and returns true
if the RefGTRec object was added.rec - reference genotypes for a markertrue if the specified RefGTRec object was
added to the list of compressed markersjava.lang.IllegalArgumentException - if
em.samples().equals(this.samples()) == falsejava.lang.IllegalArgumentException - if
rec.isAlleleCoded() == falsejava.lang.NullPointerException - if em == nullpublic java.util.List<RefGTRec> getCompressedList()
RefGTRec
objects.RefGTRec objects