The VariantMatrix¶
Variation data are stored in instances of libsequence.VariantMatrix
. This class stores state
data as signed 8-bit integers and position data as floats (C/C++ doubles). Missing data are encoded as negative
numbers. You can use any negative number for missing data except the minimum possible value of an 8-bit integer, which
is reserved for internal use as a “mask” value when filtering data out of variant matrices.
In [1]: import libsequence
# You can construct variant matrices from lists
In [2]: states = [0, 1, 1, 0, 0, 0, 0, 1]
In [3]: pos = [0.1, 0.2]
In [4]: m = libsequence.VariantMatrix(states, pos)
In [5]: print(m.nsites)
2
In [6]: print(m.nsam)