Skip to main content

Crate tskit

Crate tskit 

Source
Expand description

A rust interface to tskit.

This crate provides a mapping of the tskit C API to rust. The result is an interface similar to the tskit Python interface, but with all operations implemented using compiled code.

§Features

§Interface to the C library

§Safety

  • The types listed above handle all the memory management!
  • All array accesses are range-checked.
  • Object lifetimes are clear:
    • Creating a tree sequence moves/consumes a table collection.
    • Tree lifetimes are tied to that of the parent tree sequence.
    • Table objects (NodeTable, etc..) are only represented by non-owning, immutable types.

§Prelude

The prelude module contains definitions that are difficult/annoying to live without. In particuar, this module exports various traits that make it so that client code does not have to use them a la carte.

We recomment that client code import all symbols from this module:

use tskit::prelude::*;

The various documentation examples manually use each trait both in order to illustrate which traits are needed and to serve as doc tests.

§Optional features

Some features are optional, and are activated by requesting them in your Cargo.toml file.

To add features to your Cargo.toml file:

[dependencies]
tskit = {version = "0.2.0", features=["feature0", "feature1"]}

§What is missing?

  • A lot of wrappers to the C functions.
  • Tree sequence statistics!

§Manual

A manual is here.

Re-exports§

pub use error::TskitError;

Modules§

bindingsbindings
Low-level (“unsafe”) bindings to the C API.
error
Error handling
metadata
Support for table row metadata
prelude
Export commonly-use types and traits
provenanceprovenance
Optional module for table and tree sequence provenance tables.
types
“Other” tskit types live here.

Macros§

handle_metadata_return
Convenience macro to handle implementing crate::metadata::MetadataRoundtrip

Structs§

CurrentTreeEdgeDifferences
EdgeDifference
An edge difference. Edge insertions and removals are differentiated by marker types Insertion and Removal, respectively.
EdgeDifferencesIterator
Manages iteration over trees to obtain edge differences.
EdgeId
An edge ID
EdgeInsertionsIterator
EdgeRemovalsIterator
EdgeTable
An edge table.
EdgeTableRow
Row of an EdgeTable
IndividualFlags
Individual flags
IndividualId
An individual ID
IndividualTable
An individual table.
IndividualTableRow
Row of a IndividualTable
IndividualTableSortOptions
Modify behavior of crate::TableCollection::topological_sort_individuals.
Insertion
Marker type for edge insertion.
Location
A newtype for the concept of location. A Location may represent a location or the output of arithmetic involving locations.
MigrationId
A migration ID
MigrationTable
A migration table.
MigrationTableRow
Row of a MigrationTable
MutationId
A mutation ID
MutationParentsFlags
MutationTable
An immutable view of site table.
MutationTableRow
Row of a MutationTable
NodeDefaults
Defaults for node table rows without metadata
NodeDefaultsWithMetadata
Notes
NodeFlags
NodeId
A node ID
NodeTable
A node table
NodeTableRow
Row of a NodeTable
PopulationId
A population ID
PopulationTable
A population table
PopulationTableRow
Row of a PopulationTable
Position
A newtype for the concept of “genomic position”. A Position can represent either a locus or a distance between loci.
ProvenanceIdprovenance
A provenance ID
Removal
Marker type for edge removal.
SimplificationOptions
Control the behavior of table simplification.
SiteId
A site ID
SiteTable
A site table.
SiteTableRow
Row of a SiteTable
SizeType
Wraps tsk_size_t
TableClearOptions
Modify behavior of crate::TableCollection::clear.
TableCollection
A table collection.
TableEqualityOptions
Modify behavior of crate::TableCollection::equals.
TableIntegrityCheckFlags
Flags to affect the behavior of TableCollection::check_integrity.
TableOutputOptions
Modify behavior of crate::TableCollection::dump.
TableSortOptions
Modify behavior of crate::TableCollection::sort.
Time
A newtype for the concept of time. A Time value can represent either a point in time or the output of arithmetic involving time.
Tree
A Tree.
TreeFlags
Specify the behavior of iterating over crate::Tree objects. See crate::TreeSequence::tree_iterator.
TreeSequence
A tree sequence.
TreeSequenceFlags
Modify behavior of crate::TableCollection::tree_sequence and crate::TreeSequence::new.

Enums§

NodeTraversalOrder

Traits§

DoubleEndedStreamingIterator
A streaming iterator able to yield elements from both ends.
IndividualLocation
Abstraction of individual location.
IndividualParents
Abstraction of individual parents.
StreamingIterator
An interface for dealing with streaming iterators.
TableColumn
Interface of a non-ragged table column.

Functions§

c_api_major_version
C API major version
c_api_minor_version
C API minor version
c_api_patch_version
C API patch version
c_api_version
The C API version in MAJOR.MINOR.PATCH format
version
Version of the rust crate.

Type Aliases§

EdgeInsertion
Type alias for EdgeDifference<Insertion>
EdgeRemoval
Type alias for EdgeDifference<Removal>
RawFlags
Alias for tsk_flags_t
TskReturnValue
Handles return codes from low-level tskit functions.