Skip to content

Commit a7c0421

Browse files
authored
update to CAPI 1.0.0 (#229)
1 parent 7c0b616 commit a7c0421

21 files changed

+4226
-1567
lines changed

src/error.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ pub fn panic_on_tskit_error(code: i32) {
7979
///
8080
/// ```
8181
/// let x = tskit::error::get_tskit_error_message(-207);
82-
/// assert_eq!(x, "Individual out of bounds");
82+
/// assert!(x.contains("Individual out of bounds"));
8383
/// ```
8484
///
8585
/// # Panics
@@ -121,14 +121,14 @@ mod test {
121121
let x = mock_error();
122122
let mut s: String = "nope!".to_string();
123123
x.map_or_else(|e: TskitError| s = format!("{}", e), |_| ());
124-
assert_eq!(s, "Individual out of bounds");
124+
assert!(s.contains("Individual out of bounds"));
125125
}
126126

127127
#[test]
128128
fn test_extract_error_message() {
129129
let x = mock_error();
130130
match extract_error_message(x) {
131-
Some(s) => assert_eq!(s, "Individual out of bounds"),
131+
Some(s) => assert!(s.contains("Individual out of bounds")),
132132
None => panic!(),
133133
}
134134

src/flags.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -43,28 +43,28 @@ bitflags! {
4343
pub struct SimplificationOptions: RawFlags {
4444
/// Default behavior
4545
const NONE = 0;
46-
const FILTER_SITES = ll_bindings::TSK_FILTER_SITES;
46+
const FILTER_SITES = ll_bindings::TSK_SIMPLIFY_FILTER_SITES;
4747
/// If True, remove any populations that are not referenced by
4848
/// nodes after simplification; new population IDs are allocated
4949
/// sequentially from zero.
5050
/// If False, the population table will not be altered in any way.
51-
const FILTER_POPULATIONS = ll_bindings::TSK_FILTER_POPULATIONS;
51+
const FILTER_POPULATIONS = ll_bindings::TSK_SIMPLIFY_FILTER_POPULATIONS;
5252
/// If True, remove any individuals that are not referenced by nodes
5353
/// after simplification; new individual IDs are allocated sequentially
5454
/// from zero. If False, the individual table will not be altered in any way.
55-
const FILTER_INDIVIDUALS = ll_bindings::TSK_FILTER_INDIVIDUALS;
55+
const FILTER_INDIVIDUALS = ll_bindings::TSK_SIMPLIFY_FILTER_INDIVIDUALS;
5656
/// Whether to reduce the topology down to the trees that are present at sites.
57-
const REDUCE_TO_SITE_TOPOLOGY = ll_bindings::TSK_REDUCE_TO_SITE_TOPOLOGY;
57+
const REDUCE_TO_SITE_TOPOLOGY = ll_bindings::TSK_SIMPLIFY_REDUCE_TO_SITE_TOPOLOGY;
5858
/// If True, preserve unary nodes (i.e. nodes with exactly one child)
5959
/// that exist on the path from samples to root.
60-
const KEEP_UNARY = ll_bindings::TSK_KEEP_UNARY;
60+
const KEEP_UNARY = ll_bindings::TSK_SIMPLIFY_KEEP_UNARY;
6161
/// Whether to retain history ancestral to the MRCA of the samples.
62-
const KEEP_INPUT_ROOTS = ll_bindings::TSK_KEEP_INPUT_ROOTS;
62+
const KEEP_INPUT_ROOTS = ll_bindings::TSK_SIMPLIFY_KEEP_INPUT_ROOTS;
6363
/// If True, preserve unary nodes that exist on the path from samples
6464
/// to root, but only if they are associated with an individual
6565
/// in the individuals table.
6666
/// Cannot be specified at the same time as `KEEP_UNARY`.
67-
const KEEP_UNARY_IN_INDIVIDUALS = ll_bindings::TSK_KEEP_UNARY_IN_INDIVIDUALS;
67+
const KEEP_UNARY_IN_INDIVIDUALS = ll_bindings::TSK_SIMPLIFY_KEEP_UNARY_IN_INDIVIDUALS;
6868
}
6969
}
7070

@@ -161,7 +161,7 @@ bitflags! {
161161
/// Default behavior
162162
const NONE = 0;
163163
/// If used, then build table indexes if they are not present.
164-
const BUILD_INDEXES = ll_bindings::TSK_BUILD_INDEXES;
164+
const BUILD_INDEXES = ll_bindings::TSK_TS_INIT_BUILD_INDEXES;
165165
}
166166
}
167167

src/trees.rs

-2
Original file line numberDiff line numberDiff line change
@@ -722,7 +722,6 @@ impl<'a> PostorderNodeIterator<'a> {
722722
let rv = unsafe {
723723
ll_bindings::tsk_tree_postorder(
724724
tree.as_ptr(),
725-
NodeId::NULL.into(), // start from virtual root
726725
nodes.as_mut_ptr().cast::<tsk_id_t>(),
727726
ptr,
728727
)
@@ -1509,7 +1508,6 @@ pub(crate) mod test_trees {
15091508
unsafe {
15101509
ll_bindings::tsk_tree_preorder(
15111510
tree.as_ptr(),
1512-
-1,
15131511
nodes.as_mut_ptr() as *mut tsk_id_t,
15141512
ptr,
15151513
);

subprojects/kastore/VERSION.txt

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2.1.1

0 commit comments

Comments
 (0)