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 Left and right coordinates of the genomic interval that this tree covers. The left coordinate is inclusive and the right coordinate exclusive.
- @brief The tree sequence object.
- @brief A variant at a specific site.
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 Extends this table by copying from a set of column arrays
- @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 Replace this table’s data by copying from a set of column arrays
- @brief Controls the pre-allocation strategy for the metadata column
- @brief Controls the pre-allocation strategy for this table
- @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 Squash adjacent edges in-place
- @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 Extends this table by copying from a set of column arrays
- @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 Replace this table’s data by copying from a set of column arrays
- @brief Controls the pre-allocation strategy for the location column
- @brief Controls the pre-allocation strategy for the metadata column
- @brief Controls the pre-allocation strategy for the parents column
- @brief Controls the pre-allocation strategy for this table
- @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 Check if a number is
TSK_UNKNOWN_TIME
- @brief Adds a row to this migration table.
- @brief Extends this table by copying from a set of column arrays
- @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 Replace this table’s data by copying from a set of column arrays
- @brief Controls the pre-allocation strategy for the metadata column
- @brief Controls the pre-allocation strategy for this table
- @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 Extends this table by copying from a set of column arrays
- @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 Replace this table’s data by copying from a set of column arrays
- @brief Controls the pre-allocation strategy for the derived_state column
- @brief Controls the pre-allocation strategy for the metadata column
- @brief Controls the pre-allocation strategy for this table
- @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 Extends this table by copying from a set of column arrays
- @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 Replace this table’s data by copying from a set of column arrays
- @brief Controls the pre-allocation strategy for the metadata column
- @brief Controls the pre-allocation strategy for this table
- @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 Extends this table by copying from a set of column arrays
- @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 Replace this table’s data by copying from a set of column arrays
- @brief Controls the pre-allocation strategy for the metadata column
- @brief Controls the pre-allocation strategy for this table
- @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 Extends this table by copying from a set of column arrays
- @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 Replace this table’s data by copying from a set of column arrays
- @brief Controls the pre-allocation strategy for the record column
- @brief Controls the pre-allocation strategy for this table
- @brief Controls the pre-allocation strategy for the timestamp column
- @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 Extends this table by copying from a set of column arrays
- @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 Replace this table’s data by copying from a set of column arrays
- @brief Controls the pre-allocation strategy for the ancestral_state column
- @brief Controls the pre-allocation strategy for the metadata column
- @brief Controls the pre-allocation strategy for this table
- @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 Sorts the individual table in this collection.
- @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 Set the time_units @rst Copies the time_units string to this table collection, replacing any existing. @endrst @param self A pointer to a tsk_table_collection_t object. @param time_units A pointer to a char array. @param time_units_length The size of the time units string 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.
- @brief Set the tree into the null state.
- @brief Copies the state of this tree into the specified destination.
- @brief Seek to the first tree in the sequence.
- @brief Free the internal memory for the specified tree.
- @brief Return the length of the branch ancestral to the specified node.
- @brief Return number of nodes on the path from the specified node to root.
- @brief Returns the leftmost root in this tree.
- @brief Compute the most recent common ancestor of two nodes.
- @brief Returns the number of roots in this tree.
- @brief Counts the number of samples in the subtree rooted at a node.
- @brief Returns the parent of the specified node.
- @brief Returns the rightmost root in this tree.
- @brief Get the list of sites for this tree.
- @brief Return an upper bound on the number of nodes reachable from the roots of this tree.
- @brief Returns the time of the specified node.
- @brief Computes the sum of the lengths of all branches reachable from the specified node, or from all roots if
u=TSK_NULL
. - @brief Initialises the tree by allocating internal memory and associating with the specified tree sequence.
- @brief Returns true if u is a descendant of v.
- @brief Seek to the last tree in the sequence.
- @brief Seek to the next tree in the sequence.
- @brief Fill an array with the nodes of this tree in postorder.
- @brief Fill an array with the nodes of this tree starting from a particular node.
- @brief Fill an array with the nodes of this tree in preorder.
- @brief Fill an array with the nodes of this tree starting from a particular node.
- @}
- @brief Seek to the previous tree in the sequence.
- @brief Print out the state of this tree to the specified stream.
- @brief Seek to a particular position on the genome.
- @brief Copies the state of the table collection underlying this tree sequence into the specified destination table collection.
- @brief Write a tree sequence to file.
- @brief Write a tree sequence to a stream.
- @brief Free the internal memory for the specified tree sequence.
- @brief Get the breakpoints
- @brief Get the discrete genome status
- @brief Get the discrete time status
- @brief Get a edge by its index
- @brief Get the file uuid
- @brief Get a individual by its index
- @brief Get the top-level tree sequence metadata.
- @brief Get the length of top-level tree sequence metadata
- @brief Get the top-level tree sequence metadata schema.
- @brief Get the length of the top-level tree sequence metadata schema.
- @brief Get a edge by its index
- @brief Get a mutation by its index
- @brief Get a node by its index
- @brief Get the number of edges
- @brief Get the number of individuals
- @brief Get the number of migrations
- @brief Get the number of mutations
- @brief Get the number of nodes
- @brief Get the number of populations
- @brief Get the number of provenances
- @brief Get the number of samples
- @brief Get the number of sites
- @brief Return the number of trees in this tree sequence.
- @brief Get a population by its index
- @brief Get a provenance by its index
- @brief Get the map of node id to sample index
- @brief Get the samples
- @brief Get the sequence length
- @brief Get a site by its index
- @brief Get the time units string
- @brief Get the length of time units string @rst Returns the length of the time units string. @endrst
- @brief Initialises the tree sequence based on the specified table collection.
- @brief Check if a node is a sample
- @brief Load a tree sequence from a file path.
- @brief Load a tree sequence from a stream.
- @brief Print out the state of this tree sequence to the specified stream.
- @brief Create a simplified instance of this tree sequence
- @}
- @}
- @brief Decode the genotypes at the given site, storing them in this variant.
- @brief Free the internal memory for the specified variant.
- @brief Initialises the variant by allocating the internal memory
- @brief Print out the state of this variant to the specified stream.
- @brief Copies the state of this variant to another variant
Type Definitions
- @brief Container for bitwise flags.
- @brief Tskit sizes.
- @brief Low-level table sorting method.