Function tskit::bindings::tsk_variant_init
source · pub unsafe extern "C" fn tsk_variant_init(
self_: *mut tsk_variant_t,
tree_sequence: *const tsk_treeseq_t,
samples: *const tsk_id_t,
num_samples: tsk_size_t,
alleles: *mut *const c_char,
options: tsk_flags_t
) -> c_int
Expand description
@brief Initialises the variant by allocating the internal memory
@rst
This must be called before any operations are performed on the variant.
See the :ref:sec_c_api_overview_structure
for details on how objects
are initialised and freed.
@endrst
@param self A pointer to an uninitialised tsk_variant_t object.
@param tree_sequence A pointer to the tree sequence from which this variant
will decode genotypes. No copy is taken, so this tree sequence must persist
for the lifetime of the variant.
@param samples Optional. Either NULL
or an array of node ids of the samples that are to
have their genotypes decoded. A copy of this array will be taken by the variant. If
NULL
then the samples from the tree sequence will be used.
@param num_samples The number of ids in the samples array, ignored if samples
is NULL
@param alleles Optional. Either NULL
or an array of string alleles with a terminal
NULL
sentinel value.
If specified, the genotypes will be decoded to match the index in this allele array.
If NULL
then alleles will be automatically determined from the mutations encountered.
@param options Variant options. Either 0
or TSK_ISOLATED_NOT_MISSING
which
if specified indicates that isolated sample nodes should not be decoded as the “missing”
state but as the ancestral state (or the state of any mutation above them).
@return Return 0 on success or a negative value on failure.