Function tskit::bindings::tsk_table_collection_simplify
source · pub unsafe extern "C" fn tsk_table_collection_simplify(
self_: *mut tsk_table_collection_t,
samples: *const tsk_id_t,
num_samples: tsk_size_t,
options: tsk_flags_t,
node_map: *mut tsk_id_t
) -> c_int
Expand description
@brief Simplify the tables to remove redundant information.
@rst
Simplification transforms the tables to remove redundancy and canonicalise
tree sequence data. See the :ref:simplification <sec_simplification>
tutorial for
more details.
A mapping from the node IDs in the table before simplification to their equivalent
values after simplification can be obtained via the node_map
argument. If this
is non NULL, node_map[u]
will contain the new ID for node u
after simplification,
or :c:macro:TSK_NULL
if the node has been removed. Thus, node_map
must be an array
of at least self->nodes.num_rows
:c:type:tsk_id_t
values. The table collection will
always be unindexed after simplify successfully completes.
.. note:: Migrations are currently not supported by simplify, and an error will
be raised if we attempt call simplify on a table collection with greater
than zero migrations. See <https://github.com/tskit-dev/tskit/issues/20>
_
Options**:
Options can be specified by providing one or more of the following bitwise flags:
- :c:macro:
TSK_SIMPLIFY_FILTER_SITES
- :c:macro:
TSK_SIMPLIFY_FILTER_POPULATIONS
- :c:macro:
TSK_SIMPLIFY_FILTER_INDIVIDUALS
- :c:macro:
TSK_SIMPLIFY_REDUCE_TO_SITE_TOPOLOGY
- :c:macro:
TSK_SIMPLIFY_KEEP_UNARY
- :c:macro:
TSK_SIMPLIFY_KEEP_INPUT_ROOTS
- :c:macro:
TSK_SIMPLIFY_KEEP_UNARY_IN_INDIVIDUALS
@endrst
@param self A pointer to a tsk_table_collection_t object. @param samples Either NULL or an array of num_samples distinct and valid node IDs. If non-null the nodes in this array will be marked as samples in the output. If NULL, the num_samples parameter is ignored and the samples in the output will be the same as the samples in the input. This is equivalent to populating the samples array with all of the sample nodes in the input in increasing order of ID. @param num_samples The number of node IDs in the input samples array. Ignored if the samples array is NULL. @param options Simplify options; see above for the available bitwise flags. For the default behaviour, a value of 0 should be provided. @param node_map If not NULL, this array will be filled to define the mapping between nodes IDs in the table collection before and after simplification. @return Return 0 on success or a negative value on failure.