Function tskit::bindings::tsk_table_collection_simplify[][src]

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

@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_table_simplification> section 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 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.

Options**:

Options can be specified by providing one or more of the following bitwise flags:

TSK_FILTER_SITES Remove sites from the output if there are no mutations that reference them. TSK_FILTER_POPULATIONS Remove populations from the output if there are no nodes or migrations that reference them. TSK_FILTER_INDIVIDUALS Remove individuals from the output if there are no nodes that reference them. TSK_REDUCE_TO_SITE_TOPOLOGY Reduce the topological information in the tables to the minimum necessary to represent the trees that contain sites. If there are zero sites this will result in an zero output edges. When the number of sites is greater than zero, every tree in the output tree sequence will contain at least one site. For a given site, the topology of the tree containing that site will be identical (up to node ID remapping) to the topology of the corresponding tree in the input. TSK_KEEP_UNARY By default simplify removes unary nodes (i.e., nodes with exactly one child) along the path from samples to root. If this option is specified such unary nodes will be preserved in the output. TSK_KEEP_INPUT_ROOTS By default simplify removes all topology ancestral the MRCAs of the samples. This option inserts edges from these MRCAs back to the roots of the input trees. TSK_KEEP_UNARY_IN_INDIVDUALS This acts like TSK_KEEP_UNARY (and is mutually exclusive with that flag). It keeps unary nodes, but only if the unary node is referenced from an individual.

.. 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>_

The table collection will always be unindexed after simplify successfully completes. @endrst

@param self A pointer to a tsk_individual_table_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.