Module tskit::bindings[][src]

Expand description

Low-level (“unsafe”) bindings to the C API.

This module is a 1-to-1 mapping of C types and functions for both tskit and kastore. The bindings are generate via bindgen.

Using things from this module will be unsafe. Further, as many of the types require init() methods to correctly set up the structs, one has to coerce rust into allowing uninitialized variables:

use std::mem::MaybeUninit;
let mut edges: MaybeUninit<tskit::bindings::tsk_edge_table_t> = MaybeUninit::uninit();
unsafe {
    let _ = tskit::bindings::tsk_edge_table_init(edges.as_mut_ptr(), 0);
    let _ = tskit::bindings::tsk_edge_table_add_row(edges.as_mut_ptr(), 0., 10., 0, 1, std::ptr::null(), 0);
    assert_eq!((*edges.as_ptr()).num_rows, 1);
    tskit::bindings::tsk_edge_table_free(edges.as_mut_ptr());
}

The best source for documentation will be the tskit docs. Those docs describe the most important parts of the C API. This module contains the same types/functions with the same names.

Structs

@brief Low-level table sorting method.

@brief A file-backed store of key-array values.

@brief A bookmark recording the position of all the tables in a table collection.

@brief A single edge defined by a row in the edge table.

@brief The edge table.

@brief A single individual defined by a row in the individual table.

@brief The individual table.

@brief A single migration defined by a row in the migration table.

@brief The migration table.

@brief A single mutation defined by a row in the mutation table.

@brief The mutation table.

@brief A single node defined by a row in the node table.

@brief The node table.

@brief A single population defined by a row in the population table.

@brief The population table.

@brief A single provenance defined by a row in the provenance table.

@brief The provenance table.

@brief A single site defined by a row in the site table.

@brief The site table.

@brief A collection of tables defining the data for a tree sequence.

@brief A single tree in a tree sequence.

@brief The tree sequence object.

Constants

Functions

@brief Close an opened store, freeing all resources.

@brief Return 1 if the store contains the specified key and 0 if it does not.

@brief Return 1 if the store contains the specified NULL terminated key and 0 if it does not.

@brief Get the array for the specified key.

@brief Get the array for the specified NULL-terminated key.

@defgroup TYPED_GETS_GROUP Typed get functions. @{

@brief Open a store from a given file in read (“r”), write (“w”) or append (“a”) mode.

@brief Open a store from a given FILE pointer.

@brief Insert the specified key-array pair into the store, transferring ownership of the malloced array buffer to the store (own-put).

@brief Insert the specified NULL terminated key and array pair into the store, transferring ownership of the malloced array buffer to the store (own-put).

@defgroup TYPED_OPUTS_GROUP Typed own-and-put functions. @{

@brief Insert the specified key-array pair into the store.

@brief Insert the specified NULL terminated key and array pair into the store.

@defgroup TYPED_PUTS_GROUP Typed put functions. @{

@brief Adds a row to this edge table.

@brief Clears this table, setting the number of rows to zero.

@brief Copies the state of this table into the specified destination.

@brief Returns true if the data in the specified table is identical to the data in this table.

@brief Extends this table by appending rows copied from another table.

@brief Free the internal memory for the specified table.

@brief Get the row at the specified index.

@brief Initialises the table by allocating the internal memory.

@brief Print out the state of this table to the specified stream.

@brief Set the metadata schema @rst Copies the metadata schema string to this table, replacing any existing. @endrst @param self A pointer to a tsk_edge_table_t object. @param metadata_schema A pointer to a char array @param metadata_schema_length The size of the metadata schema in bytes. @return Return 0 on success or a negative value on failure.

@brief Truncates this table so that only the first num_rows are retained.

@brief Updates the row at the specified index.

@brief Adds a row to this individual table.

@brief Clears this table, setting the number of rows to zero.

@brief Copies the state of this table into the specified destination.

@brief Returns true if the data in the specified table is identical to the data in this table.

@brief Extends this table by appending rows copied from another table.

@brief Free the internal memory for the specified table.

@brief Get the row at the specified index.

@brief Initialises the table by allocating the internal memory.

@brief Print out the state of this table to the specified stream.

@brief Set the metadata schema

@brief Truncates this table so that only the first num_rows are retained.

@brief Updates the row at the specified index.

@brief Adds a row to this migration table.

@brief Clears this table, setting the number of rows to zero.

@brief Copies the state of this table into the specified destination.

@brief Returns true if the data in the specified table is identical to the data in this table.

@brief Extends this table by appending rows copied from another table.

@brief Free the internal memory for the specified table.

@brief Get the row at the specified index.

@brief Initialises the table by allocating the internal memory.

@brief Print out the state of this table to the specified stream.

@brief Set the metadata schema @rst Copies the metadata schema string to this table, replacing any existing. @endrst @param self A pointer to a tsk_migration_table_t object. @param metadata_schema A pointer to a char array @param metadata_schema_length The size of the metadata schema in bytes. @return Return 0 on success or a negative value on failure.

@brief Truncates this table so that only the first num_rows are retained.

@brief Updates the row at the specified index.

@brief Adds a row to this mutation table.

@brief Clears this table, setting the number of rows to zero.

@brief Copies the state of this table into the specified destination.

@brief Returns true if the data in the specified table is identical to the data in this table.

@brief Extends this table by appending rows copied from another table.

@brief Free the internal memory for the specified table.

@brief Get the row at the specified index.

@brief Initialises the table by allocating the internal memory.

@brief Print out the state of this table to the specified stream.

@brief Set the metadata schema @rst Copies the metadata schema string to this table, replacing any existing. @endrst @param self A pointer to a tsk_mutation_table_t object. @param metadata_schema A pointer to a char array @param metadata_schema_length The size of the metadata schema in bytes. @return Return 0 on success or a negative value on failure.

@brief Truncates this table so that only the first num_rows are retained.

@brief Updates the row at the specified index.

@brief Adds a row to this node table.

@brief Clears this table, setting the number of rows to zero.

@brief Copies the state of this table into the specified destination.

@brief Returns true if the data in the specified table is identical to the data in this table.

@brief Extends this table by appending rows copied from another table.

@brief Free the internal memory for the specified table.

@brief Get the row at the specified index.

@brief Initialises the table by allocating the internal memory.

@brief Print out the state of this table to the specified stream.

@brief Set the metadata schema @rst Copies the metadata schema string to this table, replacing any existing. @endrst @param self A pointer to a tsk_node_table_t object. @param metadata_schema A pointer to a char array @param metadata_schema_length The size of the metadata schema in bytes. @return Return 0 on success or a negative value on failure.

@brief Truncates this table so that only the first num_rows are retained.

@brief Updates the row at the specified index.

@brief Adds a row to this population table.

@brief Clears this table, setting the number of rows to zero.

@brief Copies the state of this table into the specified destination.

@brief Returns true if the data in the specified table is identical to the data in this table.

@brief Extends this table by appending rows copied from another table.

@brief Free the internal memory for the specified table.

@brief Get the row at the specified index.

@brief Initialises the table by allocating the internal memory.

@brief Print out the state of this table to the specified stream.

@brief Set the metadata schema @rst Copies the metadata schema string to this table, replacing any existing. @endrst @param self A pointer to a tsk_population_table_t object. @param metadata_schema A pointer to a char array @param metadata_schema_length The size of the metadata schema in bytes. @return Return 0 on success or a negative value on failure.

@brief Truncates this table so that only the first num_rows are retained.

@brief Updates the row at the specified index.

@brief Adds a row to this provenance table.

@brief Clears this table, setting the number of rows to zero.

@brief Copies the state of this table into the specified destination.

@brief Returns true if the data in the specified table is identical to the data in this table.

@brief Extends this table by appending rows copied from another table.

@brief Free the internal memory for the specified table.

@brief Get the row at the specified index.

@brief Initialises the table by allocating the internal memory.

@brief Print out the state of this table to the specified stream.

@brief Truncates this table so that only the first num_rows are retained.

@brief Updates the row at the specified index.

@brief Adds a row to this site table.

@brief Clears this table, setting the number of rows to zero.

@brief Copies the state of this table into the specified destination.

@brief Returns true if the data in the specified table is identical to the data in this table.

@brief Extends this table by appending rows copied from another table.

@brief Free the internal memory for the specified table.

@brief Get the row at the specified index.

@brief Initialises the table by allocating the internal memory.

@brief Print out the state of this table to the specified stream.

@brief Set the metadata schema @rst Copies the metadata schema string to this table, replacing any existing. @endrst @param self A pointer to a tsk_site_table_t object. @param metadata_schema A pointer to a char array @param metadata_schema_length The size of the metadata schema in bytes. @return Return 0 on success or a negative value on failure.

@brief Truncates this table so that only the first num_rows are retained.

@brief Updates the row at the specified index.

@brief Return a description of the specified error.

@brief Builds indexes for this table collection.

@brief Puts the tables into canonical form.

@brief Runs integrity checks on this table collection.

@brief Clears data tables (and optionally provenances and metadata) in this table collection.

@brief Copies the state of this table collection into the specified destination.

@brief Deletes the indexes for this table collection.

@brief Write a table collection to file.

@brief Write a table collection to a stream.

@brief Returns true if the data in the specified table collection is equal to the data in this table collection.

@brief Free the internal memory for the specified table collection.

@brief Returns true if this table collection is indexed.

@brief Initialises the table collection by allocating the internal memory and initialising all the constituent tables.

@brief Load a table collection from a file path.

@brief Load a table collection from a stream.

@brief Print out the state of this table collection to the specified stream.

@brief Record the number of rows in each table in the specified tsk_bookmark_t object.

@brief Set the metadata @rst Copies the metadata string to this table collection, replacing any existing. @endrst @param self A pointer to a tsk_table_collection_t object. @param metadata A pointer to a char array @param metadata_length The size of the metadata in bytes. @return Return 0 on success or a negative value on failure.

@brief Set the metadata schema @rst Copies the metadata schema string to this table collection, replacing any existing. @endrst @param self A pointer to a tsk_table_collection_t object. @param metadata_schema A pointer to a char array @param metadata_schema_length The size of the metadata schema in bytes. @return Return 0 on success or a negative value on failure.

@brief Simplify the tables to remove redundant information.

@brief Sorts the tables in this collection.

@brief Subsets and reorders a table collection according to an array of nodes.

@brief Truncates the tables in this table collection according to the specified bookmark.

@brief Forms the node-wise union of two table collections.

@brief Free the internal memory for the specified table sorter.

@brief Initialises the memory for the sorter object.

@brief Runs the sort using the configured functions.

@defgroup TREE_API_GROUP Tree sequence API @{

@defgroup TREESEQ_API_GROUP Tree sequence API @{

Type Definitions

Unions