tskit 1.0.1__tar.gz → 1.0.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. tskit-1.0.2/PKG-INFO +45 -0
  2. {tskit-1.0.1 → tskit-1.0.2}/_tskitmodule.c +31 -47
  3. {tskit-1.0.1 → tskit-1.0.2}/lib/subprojects/kastore/kastore.h +1 -1
  4. {tskit-1.0.1 → tskit-1.0.2}/lib/tskit/core.c +2 -2
  5. {tskit-1.0.1 → tskit-1.0.2}/lib/tskit/core.h +5 -5
  6. {tskit-1.0.1 → tskit-1.0.2}/lib/tskit/haplotype_matching.c +6 -6
  7. {tskit-1.0.1 → tskit-1.0.2}/lib/tskit/tables.c +24 -24
  8. {tskit-1.0.1 → tskit-1.0.2}/lib/tskit/tables.h +1 -1
  9. {tskit-1.0.1 → tskit-1.0.2}/lib/tskit/trees.c +23 -24
  10. {tskit-1.0.1 → tskit-1.0.2}/lib/tskit/trees.h +1 -1
  11. {tskit-1.0.1 → tskit-1.0.2}/lwt_interface/tskit_lwt_interface.h +2 -2
  12. {tskit-1.0.1 → tskit-1.0.2}/pyproject.toml +95 -44
  13. {tskit-1.0.1 → tskit-1.0.2}/setup.py +1 -2
  14. {tskit-1.0.1 → tskit-1.0.2}/tests/test_avl_tree.py +2 -3
  15. {tskit-1.0.1 → tskit-1.0.2}/tests/test_balance_metrics.py +1 -0
  16. {tskit-1.0.1 → tskit-1.0.2}/tests/test_cli.py +3 -3
  17. {tskit-1.0.1 → tskit-1.0.2}/tests/test_coalrate.py +5 -12
  18. {tskit-1.0.1 → tskit-1.0.2}/tests/test_combinatorics.py +2 -2
  19. {tskit-1.0.1 → tskit-1.0.2}/tests/test_distance_metrics.py +1 -0
  20. {tskit-1.0.1 → tskit-1.0.2}/tests/test_divmat.py +35 -42
  21. {tskit-1.0.1 → tskit-1.0.2}/tests/test_drawing.py +66 -66
  22. {tskit-1.0.1 → tskit-1.0.2}/tests/test_file_format.py +4 -9
  23. {tskit-1.0.1 → tskit-1.0.2}/tests/test_fileobj.py +8 -9
  24. {tskit-1.0.1 → tskit-1.0.2}/tests/test_genotype_matching.py +2 -5
  25. {tskit-1.0.1 → tskit-1.0.2}/tests/test_genotypes.py +14 -34
  26. {tskit-1.0.1 → tskit-1.0.2}/tests/test_haplotype_matching.py +2 -3
  27. {tskit-1.0.1 → tskit-1.0.2}/tests/test_highlevel.py +14 -15
  28. {tskit-1.0.1 → tskit-1.0.2}/tests/test_ibd.py +5 -7
  29. {tskit-1.0.1 → tskit-1.0.2}/tests/test_immutable_table_collection.py +10 -19
  30. {tskit-1.0.1 → tskit-1.0.2}/tests/test_intervals.py +1 -0
  31. {tskit-1.0.1 → tskit-1.0.2}/tests/test_ld_matrix.py +5 -11
  32. {tskit-1.0.1 → tskit-1.0.2}/tests/test_metadata.py +1 -0
  33. {tskit-1.0.1 → tskit-1.0.2}/tests/test_ms.py +1 -0
  34. {tskit-1.0.1 → tskit-1.0.2}/tests/test_parsimony.py +2 -4
  35. {tskit-1.0.1 → tskit-1.0.2}/tests/test_phylo_formats.py +4 -4
  36. {tskit-1.0.1 → tskit-1.0.2}/tests/test_provenance.py +1 -0
  37. tskit-1.0.1/tests/test_lowlevel.py → tskit-1.0.2/tests/test_python_c.py +33 -45
  38. {tskit-1.0.1 → tskit-1.0.2}/tests/test_reference_sequence.py +2 -3
  39. {tskit-1.0.1 → tskit-1.0.2}/tests/test_relatedness_vector.py +12 -17
  40. {tskit-1.0.1 → tskit-1.0.2}/tests/test_stats.py +1 -0
  41. {tskit-1.0.1 → tskit-1.0.2}/tests/test_table_transforms.py +1 -0
  42. {tskit-1.0.1 → tskit-1.0.2}/tests/test_tables.py +16 -42
  43. {tskit-1.0.1 → tskit-1.0.2}/tests/test_text_formats.py +1 -0
  44. {tskit-1.0.1 → tskit-1.0.2}/tests/test_threads.py +3 -6
  45. {tskit-1.0.1 → tskit-1.0.2}/tests/test_topology.py +17 -48
  46. {tskit-1.0.1 → tskit-1.0.2}/tests/test_tree_positioning.py +1 -0
  47. {tskit-1.0.1 → tskit-1.0.2}/tests/test_tree_stats.py +23 -62
  48. {tskit-1.0.1 → tskit-1.0.2}/tests/test_util.py +1 -0
  49. {tskit-1.0.1 → tskit-1.0.2}/tests/test_utilities.py +3 -7
  50. {tskit-1.0.1 → tskit-1.0.2}/tests/test_vcf.py +8 -14
  51. {tskit-1.0.1 → tskit-1.0.2}/tests/test_version.py +1 -0
  52. {tskit-1.0.1 → tskit-1.0.2}/tests/test_wright_fisher.py +1 -0
  53. {tskit-1.0.1 → tskit-1.0.2}/tskit/_version.py +1 -1
  54. {tskit-1.0.1 → tskit-1.0.2}/tskit/cli.py +1 -0
  55. {tskit-1.0.1 → tskit-1.0.2}/tskit/combinatorics.py +2 -2
  56. {tskit-1.0.1 → tskit-1.0.2}/tskit/drawing.py +18 -35
  57. {tskit-1.0.1 → tskit-1.0.2}/tskit/exceptions.py +8 -7
  58. {tskit-1.0.1 → tskit-1.0.2}/tskit/genotypes.py +2 -4
  59. {tskit-1.0.1 → tskit-1.0.2}/tskit/intervals.py +1 -0
  60. {tskit-1.0.1 → tskit-1.0.2}/tskit/jit/numba.py +1 -3
  61. {tskit-1.0.1 → tskit-1.0.2}/tskit/metadata.py +9 -10
  62. {tskit-1.0.1 → tskit-1.0.2}/tskit/provenance.py +2 -0
  63. {tskit-1.0.1 → tskit-1.0.2}/tskit/stats.py +1 -0
  64. {tskit-1.0.1 → tskit-1.0.2}/tskit/tables.py +9 -17
  65. {tskit-1.0.1 → tskit-1.0.2}/tskit/text_formats.py +8 -22
  66. {tskit-1.0.1 → tskit-1.0.2}/tskit/trees.py +38 -62
  67. {tskit-1.0.1 → tskit-1.0.2}/tskit/util.py +12 -11
  68. {tskit-1.0.1 → tskit-1.0.2}/tskit/vcf.py +1 -0
  69. tskit-1.0.2/tskit.egg-info/PKG-INFO +45 -0
  70. {tskit-1.0.1 → tskit-1.0.2}/tskit.egg-info/SOURCES.txt +1 -1
  71. tskit-1.0.2/tskit.egg-info/requires.txt +2 -0
  72. tskit-1.0.1/PKG-INFO +0 -105
  73. tskit-1.0.1/tskit.egg-info/PKG-INFO +0 -105
  74. tskit-1.0.1/tskit.egg-info/requires.txt +0 -64
  75. {tskit-1.0.1 → tskit-1.0.2}/LICENSE +0 -0
  76. {tskit-1.0.1 → tskit-1.0.2}/MANIFEST.in +0 -0
  77. {tskit-1.0.1 → tskit-1.0.2}/README.rst +0 -0
  78. {tskit-1.0.1 → tskit-1.0.2}/lib/subprojects/kastore/kastore.c +0 -0
  79. {tskit-1.0.1 → tskit-1.0.2}/lib/tskit/convert.c +0 -0
  80. {tskit-1.0.1 → tskit-1.0.2}/lib/tskit/convert.h +0 -0
  81. {tskit-1.0.1 → tskit-1.0.2}/lib/tskit/genotypes.c +0 -0
  82. {tskit-1.0.1 → tskit-1.0.2}/lib/tskit/genotypes.h +0 -0
  83. {tskit-1.0.1 → tskit-1.0.2}/lib/tskit/haplotype_matching.h +0 -0
  84. {tskit-1.0.1 → tskit-1.0.2}/lib/tskit/stats.c +0 -0
  85. {tskit-1.0.1 → tskit-1.0.2}/lib/tskit/stats.h +0 -0
  86. {tskit-1.0.1 → tskit-1.0.2}/lib/tskit.h +0 -0
  87. {tskit-1.0.1 → tskit-1.0.2}/setup.cfg +0 -0
  88. {tskit-1.0.1 → tskit-1.0.2}/tests/test_dict_encoding.py +1 -1
  89. {tskit-1.0.1 → tskit-1.0.2}/tests/test_extend_haplotypes.py +0 -0
  90. {tskit-1.0.1 → tskit-1.0.2}/tests/test_jit.py +0 -0
  91. {tskit-1.0.1 → tskit-1.0.2}/tskit/__init__.py +0 -0
  92. {tskit-1.0.1 → tskit-1.0.2}/tskit/__main__.py +0 -0
  93. {tskit-1.0.1 → tskit-1.0.2}/tskit/jit/__init__.py +0 -0
  94. {tskit-1.0.1 → tskit-1.0.2}/tskit/provenance.schema.json +0 -0
  95. {tskit-1.0.1 → tskit-1.0.2}/tskit.egg-info/dependency_links.txt +0 -0
  96. {tskit-1.0.1 → tskit-1.0.2}/tskit.egg-info/entry_points.txt +0 -0
  97. {tskit-1.0.1 → tskit-1.0.2}/tskit.egg-info/top_level.txt +0 -0
tskit-1.0.2/PKG-INFO ADDED
@@ -0,0 +1,45 @@
1
+ Metadata-Version: 2.4
2
+ Name: tskit
3
+ Version: 1.0.2
4
+ Summary: The tree sequence toolkit.
5
+ Author-email: Tskit Developers <admin@tskit.dev>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://tskit.dev/tskit
8
+ Project-URL: Documentation, https://tskit.dev/tskit/docs/stable
9
+ Project-URL: Changelog, https://tskit.dev/tskit/docs/stable/changelogs.html
10
+ Project-URL: Bug Tracker, https://github.com/tskit-dev/tskit/issues
11
+ Project-URL: GitHub, https://github.com/tskit-dev/tskit/
12
+ Keywords: population genetics,tree sequence,ancestral recombination graph,evolutionary tree,statistical genetics,phylogenetics,tskit
13
+ Classifier: Programming Language :: C
14
+ Classifier: Programming Language :: Python
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Programming Language :: Python :: 3.14
20
+ Classifier: Programming Language :: Python :: 3 :: Only
21
+ Classifier: Development Status :: 5 - Production/Stable
22
+ Classifier: Environment :: Other Environment
23
+ Classifier: Intended Audience :: Science/Research
24
+ Classifier: Operating System :: POSIX
25
+ Classifier: Operating System :: MacOS :: MacOS X
26
+ Classifier: Operating System :: Microsoft :: Windows
27
+ Classifier: Topic :: Scientific/Engineering
28
+ Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
29
+ Requires-Python: >=3.11
30
+ Description-Content-Type: text/x-rst
31
+ License-File: LICENSE
32
+ Requires-Dist: jsonschema>=3.0.0
33
+ Requires-Dist: numpy>=2
34
+ Dynamic: license-file
35
+
36
+
37
+ The tree sequence toolkit.
38
+
39
+ Tskit is a cross-platform library for the storage and analysis of large-scale
40
+ genetic genealogy and variation data.
41
+ Please see the `documentation <https://tskit.dev/tskit/docs/stable/>`_
42
+ for further details.
43
+
44
+ Tskit is highly portable, and provides a number of
45
+ `installation options <https://tskit.dev/tskit/docs/stable/installation.html>`_.
@@ -36,10 +36,10 @@
36
36
  #define NPY_NO_DEPRECATED_API NPY_2_0_API_VERSION
37
37
  #undef NPY_FEATURE_VERSION
38
38
  #define NPY_FEATURE_VERSION NPY_2_0_API_VERSION
39
- #define HAVE_NUMPY_2 1
39
+ #define HAVE_NUMPY_2 1
40
40
  #else
41
41
  #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
42
- #define HAVE_NUMPY_2 0
42
+ #define HAVE_NUMPY_2 0
43
43
  #endif
44
44
  #include <numpy/arrayobject.h>
45
45
 
@@ -49,7 +49,7 @@
49
49
  #include "kastore.h"
50
50
  #include "tskit.h"
51
51
 
52
- #define SET_COLS 0
52
+ #define SET_COLS 0
53
53
  #define APPEND_COLS 1
54
54
 
55
55
  /* TskitException is the superclass of all exceptions that can be thrown by
@@ -6210,21 +6210,17 @@ TreeSequence_decode_alignments(TreeSequence *self, PyObject *args, PyObject *kwd
6210
6210
  nodes = PyArray_DATA(nodes_array);
6211
6211
 
6212
6212
  buf_obj = PyBytes_FromStringAndSize(
6213
- NULL, (Py_ssize_t)(num_nodes * (tsk_size_t)(right - left)));
6213
+ NULL, (Py_ssize_t) (num_nodes * (tsk_size_t) (right - left)));
6214
6214
  if (buf_obj == NULL) {
6215
6215
  goto out;
6216
6216
  }
6217
6217
  buf = PyBytes_AS_STRING(buf_obj);
6218
6218
 
6219
- // clang-format off
6220
- Py_BEGIN_ALLOW_THREADS
6221
- err = tsk_treeseq_decode_alignments(self->tree_sequence,
6222
- ref_seq, (tsk_size_t) ref_len, nodes, num_nodes, left, right, missing_char, buf,
6223
- options);
6219
+ Py_BEGIN_ALLOW_THREADS
6220
+ err = tsk_treeseq_decode_alignments(self->tree_sequence, ref_seq,
6221
+ (tsk_size_t) ref_len, nodes, num_nodes, left, right, missing_char, buf, options);
6224
6222
  Py_END_ALLOW_THREADS
6225
- // clang-format on
6226
- if (err != 0)
6227
- {
6223
+ if (err != 0) {
6228
6224
  handle_library_error(err);
6229
6225
  goto out;
6230
6226
  }
@@ -6337,11 +6333,12 @@ TreeSequence_genealogical_nearest_neighbours(
6337
6333
  goto out;
6338
6334
  }
6339
6335
 
6340
- Py_BEGIN_ALLOW_THREADS err = tsk_treeseq_genealogical_nearest_neighbours(
6341
- self->tree_sequence, PyArray_DATA(focal_array), num_focal, reference_sets,
6342
- reference_set_size, num_reference_sets, 0, PyArray_DATA(ret_array));
6343
- Py_END_ALLOW_THREADS if (err != 0)
6344
- {
6336
+ Py_BEGIN_ALLOW_THREADS
6337
+ err = tsk_treeseq_genealogical_nearest_neighbours(self->tree_sequence,
6338
+ PyArray_DATA(focal_array), num_focal, reference_sets, reference_set_size,
6339
+ num_reference_sets, 0, PyArray_DATA(ret_array));
6340
+ Py_END_ALLOW_THREADS
6341
+ if (err != 0) {
6345
6342
  handle_library_error(err);
6346
6343
  goto out;
6347
6344
  }
@@ -6457,11 +6454,11 @@ TreeSequence_mean_descendants(TreeSequence *self, PyObject *args, PyObject *kwds
6457
6454
  goto out;
6458
6455
  }
6459
6456
 
6460
- Py_BEGIN_ALLOW_THREADS err
6461
- = tsk_treeseq_mean_descendants(self->tree_sequence, reference_sets,
6462
- reference_set_size, num_reference_sets, 0, PyArray_DATA(ret_array));
6463
- Py_END_ALLOW_THREADS if (err != 0)
6464
- {
6457
+ Py_BEGIN_ALLOW_THREADS
6458
+ err = tsk_treeseq_mean_descendants(self->tree_sequence, reference_sets,
6459
+ reference_set_size, num_reference_sets, 0, PyArray_DATA(ret_array));
6460
+ Py_END_ALLOW_THREADS
6461
+ if (err != 0) {
6465
6462
  handle_library_error(err);
6466
6463
  goto out;
6467
6464
  }
@@ -7265,12 +7262,12 @@ TreeSequence_weighted_stat_vector_method(
7265
7262
  if (result_array == NULL) {
7266
7263
  goto out;
7267
7264
  }
7268
- Py_BEGIN_ALLOW_THREADS err
7269
- = method(self->tree_sequence, w_shape[1], PyArray_DATA(weights_array),
7270
- num_windows, PyArray_DATA(windows_array), num_focal_nodes,
7271
- PyArray_DATA(focal_nodes_array), PyArray_DATA(result_array), options);
7272
- Py_END_ALLOW_THREADS if (err != 0)
7273
- {
7265
+ Py_BEGIN_ALLOW_THREADS
7266
+ err = method(self->tree_sequence, w_shape[1], PyArray_DATA(weights_array),
7267
+ num_windows, PyArray_DATA(windows_array), num_focal_nodes,
7268
+ PyArray_DATA(focal_nodes_array), PyArray_DATA(result_array), options);
7269
+ Py_END_ALLOW_THREADS
7270
+ if (err != 0) {
7274
7271
  handle_library_error(err);
7275
7272
  goto out;
7276
7273
  }
@@ -7492,18 +7489,12 @@ TreeSequence_divergence_matrix(TreeSequence *self, PyObject *args, PyObject *kwd
7492
7489
  options |= TSK_STAT_SPAN_NORMALISE;
7493
7490
  }
7494
7491
 
7495
- // clang-format off
7496
7492
  Py_BEGIN_ALLOW_THREADS
7497
- err = tsk_treeseq_divergence_matrix(
7498
- self->tree_sequence,
7499
- num_sample_sets, sample_set_sizes, sample_sets,
7500
- num_windows, PyArray_DATA(windows_array),
7501
- options, PyArray_DATA(result_array));
7493
+ err = tsk_treeseq_divergence_matrix(self->tree_sequence, num_sample_sets,
7494
+ sample_set_sizes, sample_sets, num_windows, PyArray_DATA(windows_array), options,
7495
+ PyArray_DATA(result_array));
7502
7496
  Py_END_ALLOW_THREADS
7503
- // clang-format on
7504
- /* Clang-format insists on doing this in spite of the "off" instruction above */
7505
- if (err != 0)
7506
- {
7497
+ if (err != 0) {
7507
7498
  handle_library_error(err);
7508
7499
  goto out;
7509
7500
  }
@@ -8035,17 +8026,13 @@ TreeSequence_ld_matrix(TreeSequence *self, PyObject *args, PyObject *kwds,
8035
8026
  goto out;
8036
8027
  }
8037
8028
 
8038
- // clang-format off
8039
8029
  Py_BEGIN_ALLOW_THREADS
8040
8030
  err = method(self->tree_sequence, num_sample_sets,
8041
8031
  PyArray_DATA(sample_set_sizes_array), PyArray_DATA(sample_sets_array),
8042
8032
  result_dim[0], row_sites_parsed, row_positions_parsed, result_dim[1],
8043
8033
  col_sites_parsed, col_positions_parsed, options, PyArray_DATA(result_matrix));
8044
8034
  Py_END_ALLOW_THREADS
8045
- // clang-format on
8046
-
8047
- if (err != 0)
8048
- {
8035
+ if (err != 0) {
8049
8036
  handle_library_error(err);
8050
8037
  goto out;
8051
8038
  }
@@ -8218,7 +8205,6 @@ TreeSequence_k_way_ld_matrix(TreeSequence *self, PyObject *args, PyObject *kwds,
8218
8205
  goto out;
8219
8206
  }
8220
8207
 
8221
- // clang-format off
8222
8208
  Py_BEGIN_ALLOW_THREADS
8223
8209
  err = method(self->tree_sequence, num_sample_sets,
8224
8210
  PyArray_DATA(sample_set_sizes_array), PyArray_DATA(sample_sets_array),
@@ -8226,9 +8212,7 @@ TreeSequence_k_way_ld_matrix(TreeSequence *self, PyObject *args, PyObject *kwds,
8226
8212
  row_sites_parsed, row_positions_parsed, result_dim[1], col_sites_parsed,
8227
8213
  col_positions_parsed, options, PyArray_DATA(result_matrix));
8228
8214
  Py_END_ALLOW_THREADS
8229
- // clang-format on
8230
- if (err != 0)
8231
- {
8215
+ if (err != 0) {
8232
8216
  handle_library_error(err);
8233
8217
  goto out;
8234
8218
  }
@@ -157,7 +157,7 @@ to the API or ABI are introduced, i.e., the addition of a new function.
157
157
  The library patch version. Incremented when any changes not relevant to the
158
158
  to the API or ABI are introduced, i.e., internal refactors of bugfixes.
159
159
  */
160
- #define KAS_VERSION_PATCH 1
160
+ #define KAS_VERSION_PATCH 2
161
161
  /** @} */
162
162
 
163
163
  #define KAS_HEADER_SIZE 64
@@ -883,8 +883,8 @@ tsk_search_sorted(const double *restrict array, tsk_size_t size, double value)
883
883
  upper = mid;
884
884
  }
885
885
  }
886
- offset = (int64_t)(array[lower] < value);
887
- return (tsk_size_t)(lower + offset);
886
+ offset = (int64_t) (array[lower] < value);
887
+ return (tsk_size_t) (lower + offset);
888
888
  }
889
889
 
890
890
  /* Rounds the specified double to the closest multiple of 10**-num_digits. If
@@ -42,7 +42,7 @@ extern "C" {
42
42
 
43
43
  #ifdef __GNUC__
44
44
  #define TSK_WARN_UNUSED __attribute__((warn_unused_result))
45
- #define TSK_UNUSED(x) TSK_UNUSED_##x __attribute__((__unused__))
45
+ #define TSK_UNUSED(x) TSK_UNUSED_##x __attribute__((__unused__))
46
46
  #else
47
47
  #define TSK_WARN_UNUSED
48
48
  #define TSK_UNUSED(x) TSK_UNUSED_##x
@@ -93,11 +93,11 @@ missing data.
93
93
  * on the thread above.
94
94
  */
95
95
  typedef int64_t tsk_id_t;
96
- #define TSK_MAX_ID INT64_MAX - 1
96
+ #define TSK_MAX_ID INT64_MAX - 1
97
97
  #define TSK_ID_STORAGE_TYPE KAS_INT64
98
98
  #else
99
99
  typedef int32_t tsk_id_t;
100
- #define TSK_MAX_ID INT32_MAX - 1
100
+ #define TSK_MAX_ID INT32_MAX - 1
101
101
  #define TSK_ID_STORAGE_TYPE KAS_INT32
102
102
  #endif
103
103
 
@@ -109,7 +109,7 @@ The ``tsk_size_t`` type is an unsigned integer used for any size or count value.
109
109
  @endrst
110
110
  */
111
111
  typedef uint64_t tsk_size_t;
112
- #define TSK_MAX_SIZE UINT64_MAX
112
+ #define TSK_MAX_SIZE UINT64_MAX
113
113
  #define TSK_SIZE_STORAGE_TYPE KAS_UINT64
114
114
 
115
115
  /**
@@ -152,7 +152,7 @@ to the API or ABI are introduced, i.e., the addition of a new function.
152
152
  The library patch version. Incremented when any changes not relevant to the
153
153
  to the API or ABI are introduced, i.e., internal refactors of bugfixes.
154
154
  */
155
- #define TSK_VERSION_PATCH 0
155
+ #define TSK_VERSION_PATCH 1
156
156
  /** @} */
157
157
 
158
158
  /*
@@ -572,7 +572,7 @@ static inline bool
572
572
  element_in(
573
573
  const uint64_t *restrict A, tsk_id_t u, const tsk_id_t state, tsk_size_t num_words)
574
574
  {
575
- tsk_size_t index = ((tsk_size_t) u) * num_words + (tsk_size_t)(state / 64);
575
+ tsk_size_t index = ((tsk_size_t) u) * num_words + (tsk_size_t) (state / 64);
576
576
  return (A[index] & (1ULL << (state % 64))) != 0;
577
577
  }
578
578
 
@@ -580,7 +580,7 @@ static inline void
580
580
  set_optimal_value(
581
581
  uint64_t *restrict A, tsk_id_t u, const tsk_size_t num_words, tsk_id_t state)
582
582
  {
583
- tsk_size_t index = ((tsk_size_t) u) * num_words + (tsk_size_t)(state / 64);
583
+ tsk_size_t index = ((tsk_size_t) u) * num_words + (tsk_size_t) (state / 64);
584
584
  tsk_bug_assert(((tsk_size_t) state) / 64 < num_words);
585
585
  A[index] |= 1ULL << (state % 64);
586
586
  }
@@ -815,7 +815,7 @@ tsk_ls_hmm_redistribute_transitions(tsk_ls_hmm_t *self)
815
815
  * iterating over the roots. See the existing parsimony implementations
816
816
  * for an example. */
817
817
  for (root = tsk_tree_get_left_root(&self->tree); root != TSK_NULL;
818
- root = right_sib[root]) {
818
+ root = right_sib[root]) {
819
819
  stack[0].tree_node = root;
820
820
  stack[0].old_state = T_old[T_index[root]].value_index;
821
821
  stack[0].new_state
@@ -966,7 +966,7 @@ tsk_ls_hmm_run_forward(tsk_ls_hmm_t *self, int32_t *haplotype)
966
966
  }
967
967
 
968
968
  for (t_ret = tsk_tree_first(&self->tree); t_ret == TSK_TREE_OK;
969
- t_ret = tsk_tree_next(&self->tree)) {
969
+ t_ret = tsk_tree_next(&self->tree)) {
970
970
  ret = tsk_ls_hmm_update_tree(self, TSK_DIR_FORWARD);
971
971
  if (ret != 0) {
972
972
  goto out;
@@ -1166,7 +1166,7 @@ tsk_ls_hmm_run_backward(
1166
1166
  }
1167
1167
 
1168
1168
  for (t_ret = tsk_tree_last(&self->tree); t_ret == TSK_TREE_OK;
1169
- t_ret = tsk_tree_prev(&self->tree)) {
1169
+ t_ret = tsk_tree_prev(&self->tree)) {
1170
1170
  ret = tsk_ls_hmm_update_tree(self, TSK_DIR_REVERSE);
1171
1171
  if (ret != 0) {
1172
1172
  goto out;
@@ -1492,7 +1492,7 @@ tsk_compressed_matrix_decode(tsk_compressed_matrix_t *self, double *values)
1492
1492
  }
1493
1493
 
1494
1494
  for (t_ret = tsk_tree_first(&tree); t_ret == TSK_TREE_OK;
1495
- t_ret = tsk_tree_next(&tree)) {
1495
+ t_ret = tsk_tree_next(&tree)) {
1496
1496
  ret = tsk_tree_get_sites(&tree, &sites, &num_tree_sites);
1497
1497
  if (ret != 0) {
1498
1498
  goto out;
@@ -100,7 +100,7 @@ check_offset_overflow(tsk_size_t current_size, tsk_size_t additional_elements)
100
100
  || current_size > (max_val - additional_elements);
101
101
  }
102
102
 
103
- #define TSK_NUM_ROWS_UNSET ((tsk_size_t) -1)
103
+ #define TSK_NUM_ROWS_UNSET ((tsk_size_t) - 1)
104
104
  #define TSK_MAX_COL_NAME_LEN 64
105
105
 
106
106
  static int
@@ -8255,8 +8255,8 @@ pair_to_integer(tsk_id_t a, tsk_id_t b, tsk_size_t N)
8255
8255
  static inline void
8256
8256
  integer_to_pair(int64_t index, tsk_size_t N, tsk_id_t *a, tsk_id_t *b)
8257
8257
  {
8258
- *a = (tsk_id_t)(index / (int64_t) N);
8259
- *b = (tsk_id_t)(index % (int64_t) N);
8258
+ *a = (tsk_id_t) (index / (int64_t) N);
8259
+ *b = (tsk_id_t) (index % (int64_t) N);
8260
8260
  }
8261
8261
 
8262
8262
  static int64_t
@@ -8997,7 +8997,7 @@ simplifier_check_state(simplifier_t *self)
8997
8997
  for (j = 0; j < self->input_tables.nodes.num_rows; j++) {
8998
8998
  last_position = -1;
8999
8999
  for (list_node = self->node_mutation_list_map_head[j]; list_node != NULL;
9000
- list_node = list_node->next) {
9000
+ list_node = list_node->next) {
9001
9001
  tsk_bug_assert(
9002
9002
  self->input_tables.mutations.node[list_node->mutation] == (tsk_id_t) j);
9003
9003
  site = self->input_tables.mutations.site[list_node->mutation];
@@ -9028,7 +9028,7 @@ simplifier_check_state(simplifier_t *self)
9028
9028
  child = self->buffered_children[j];
9029
9029
  tsk_bug_assert(self->child_edge_map_head[child] != NULL);
9030
9030
  for (int_list = self->child_edge_map_head[child]; int_list != NULL;
9031
- int_list = int_list->next) {
9031
+ int_list = int_list->next) {
9032
9032
  tsk_bug_assert(int_list->left < int_list->right);
9033
9033
  if (int_list->next != NULL) {
9034
9034
  tsk_bug_assert(int_list->right < int_list->next->left);
@@ -9108,7 +9108,7 @@ simplifier_print_state(simplifier_t *self, FILE *out)
9108
9108
  child = self->buffered_children[j];
9109
9109
  fprintf(out, "%lld -> ", (long long) j);
9110
9110
  for (int_list = self->child_edge_map_head[child]; int_list != NULL;
9111
- int_list = int_list->next) {
9111
+ int_list = int_list->next) {
9112
9112
  fprintf(out, "(%f, %f), ", int_list->left, int_list->right);
9113
9113
  }
9114
9114
  fprintf(out, "\n");
@@ -9123,7 +9123,7 @@ simplifier_print_state(simplifier_t *self, FILE *out)
9123
9123
  if (self->node_mutation_list_map_head[j] != NULL) {
9124
9124
  fprintf(out, "%lld\t-> [", (long long) j);
9125
9125
  for (list_node = self->node_mutation_list_map_head[j]; list_node != NULL;
9126
- list_node = list_node->next) {
9126
+ list_node = list_node->next) {
9127
9127
  fprintf(out, "%lld,", (long long) list_node->mutation);
9128
9128
  }
9129
9129
  fprintf(out, "]\n");
@@ -10187,7 +10187,7 @@ simplifier_insert_input_roots(simplifier_t *self)
10187
10187
  const double *node_time = self->tables->nodes.time;
10188
10188
 
10189
10189
  for (input_id = 0; input_id < (tsk_id_t) self->input_tables.nodes.num_rows;
10190
- input_id++) {
10190
+ input_id++) {
10191
10191
  x = self->ancestor_map_head[input_id];
10192
10192
  if (x != NULL) {
10193
10193
  output_id = self->node_id_map[input_id];
@@ -10736,11 +10736,11 @@ tsk_table_collection_check_individual_integrity(
10736
10736
 
10737
10737
  for (j = 0; j < (tsk_size_t) num_individuals; j++) {
10738
10738
  for (k = individuals.parents_offset[j]; k < individuals.parents_offset[j + 1];
10739
- k++) {
10739
+ k++) {
10740
10740
  /* Check parent references are valid */
10741
10741
  if (individuals.parents[k] != TSK_NULL
10742
10742
  && (individuals.parents[k] < 0
10743
- || individuals.parents[k] >= num_individuals)) {
10743
+ || individuals.parents[k] >= num_individuals)) {
10744
10744
  ret = tsk_trace_error(TSK_ERR_INDIVIDUAL_OUT_OF_BOUNDS);
10745
10745
  goto out;
10746
10746
  }
@@ -11250,20 +11250,20 @@ tsk_table_collection_equals(const tsk_table_collection_t *self,
11250
11250
  if (!(options & TSK_CMP_IGNORE_TABLES)) {
11251
11251
  ret = ret
11252
11252
  && tsk_individual_table_equals(
11253
- &self->individuals, &other->individuals, options)
11253
+ &self->individuals, &other->individuals, options)
11254
11254
  && tsk_node_table_equals(&self->nodes, &other->nodes, options)
11255
11255
  && tsk_edge_table_equals(&self->edges, &other->edges, options)
11256
11256
  && tsk_migration_table_equals(
11257
- &self->migrations, &other->migrations, options)
11257
+ &self->migrations, &other->migrations, options)
11258
11258
  && tsk_site_table_equals(&self->sites, &other->sites, options)
11259
11259
  && tsk_mutation_table_equals(&self->mutations, &other->mutations, options)
11260
11260
  && tsk_population_table_equals(
11261
- &self->populations, &other->populations, options);
11261
+ &self->populations, &other->populations, options);
11262
11262
  /* TSK_CMP_IGNORE_TABLES implies TSK_CMP_IGNORE_PROVENANCE */
11263
11263
  if (!(options & TSK_CMP_IGNORE_PROVENANCE)) {
11264
11264
  ret = ret
11265
11265
  && tsk_provenance_table_equals(
11266
- &self->provenances, &other->provenances, options);
11266
+ &self->provenances, &other->provenances, options);
11267
11267
  }
11268
11268
  }
11269
11269
  /* TSK_CMP_IGNORE_TS_METADATA is implied by TSK_CMP_IGNORE_METADATA */
@@ -11273,19 +11273,19 @@ tsk_table_collection_equals(const tsk_table_collection_t *self,
11273
11273
  if (!(options & TSK_CMP_IGNORE_TS_METADATA)) {
11274
11274
  ret = ret
11275
11275
  && (self->metadata_length == other->metadata_length
11276
- && self->metadata_schema_length == other->metadata_schema_length
11277
- && tsk_memcmp(self->metadata, other->metadata,
11278
- self->metadata_length * sizeof(char))
11279
- == 0
11280
- && tsk_memcmp(self->metadata_schema, other->metadata_schema,
11281
- self->metadata_schema_length * sizeof(char))
11282
- == 0);
11276
+ && self->metadata_schema_length == other->metadata_schema_length
11277
+ && tsk_memcmp(self->metadata, other->metadata,
11278
+ self->metadata_length * sizeof(char))
11279
+ == 0
11280
+ && tsk_memcmp(self->metadata_schema, other->metadata_schema,
11281
+ self->metadata_schema_length * sizeof(char))
11282
+ == 0);
11283
11283
  }
11284
11284
 
11285
11285
  if (!(options & TSK_CMP_IGNORE_REFERENCE_SEQUENCE)) {
11286
11286
  ret = ret
11287
11287
  && tsk_reference_sequence_equals(
11288
- &self->reference_sequence, &other->reference_sequence, options);
11288
+ &self->reference_sequence, &other->reference_sequence, options);
11289
11289
  }
11290
11290
  return ret;
11291
11291
  }
@@ -12057,7 +12057,7 @@ tsk_table_collection_dumpf(
12057
12057
  { "format/name", (const void *) &TSK_FILE_FORMAT_NAME,
12058
12058
  TSK_FILE_FORMAT_NAME_LENGTH, KAS_INT8 },
12059
12059
  { "format/version",
12060
- (const void *) &(uint32_t[]){
12060
+ (const void *) &(uint32_t[]) {
12061
12061
  TSK_FILE_FORMAT_VERSION_MAJOR, TSK_FILE_FORMAT_VERSION_MINOR },
12062
12062
  2, KAS_UINT32 },
12063
12063
  { "sequence_length", (const void *) &self->sequence_length, 1, KAS_FLOAT64 },
@@ -13302,7 +13302,7 @@ tsk_table_collection_union(tsk_table_collection_t *self,
13302
13302
  /* Now we know the full individual map we can remap the parents of the new
13303
13303
  * individuals*/
13304
13304
  for (k = (tsk_id_t) self->individuals.parents_offset[num_individuals_self];
13305
- k < (tsk_id_t) self->individuals.parents_length; k++) {
13305
+ k < (tsk_id_t) self->individuals.parents_length; k++) {
13306
13306
  if (self->individuals.parents[k] != TSK_NULL) {
13307
13307
  self->individuals.parents[k] = individual_map[self->individuals.parents[k]];
13308
13308
  }
@@ -4607,7 +4607,7 @@ tsk_id_t tsk_table_collection_check_integrity(
4607
4607
  /* Undocumented methods */
4608
4608
 
4609
4609
  /* Flags for ibd_segments */
4610
- #define TSK_IBD_STORE_PAIRS (1 << 0)
4610
+ #define TSK_IBD_STORE_PAIRS (1 << 0)
4611
4611
  #define TSK_IBD_STORE_SEGMENTS (1 << 1)
4612
4612
 
4613
4613
  /* TODO be systematic about where "result" should be in the params
@@ -228,7 +228,7 @@ tsk_treeseq_init_individuals(tsk_treeseq_t *self)
228
228
  if (ind != TSK_NULL) {
229
229
  node_array = self->individual_nodes[ind];
230
230
  tsk_bug_assert(node_array - self->individual_nodes_mem
231
- < (tsk_id_t)(total_node_refs - node_count[ind]));
231
+ < (tsk_id_t) (total_node_refs - node_count[ind]));
232
232
  node_array[node_count[ind]] = node;
233
233
  node_count[ind] += 1;
234
234
  }
@@ -537,7 +537,7 @@ tsk_treeseq_init(
537
537
 
538
538
  if (tsk_treeseq_get_time_units_length(self) == strlen(TSK_TIME_UNITS_UNCALIBRATED)
539
539
  && !strncmp(tsk_treeseq_get_time_units(self), TSK_TIME_UNITS_UNCALIBRATED,
540
- strlen(TSK_TIME_UNITS_UNCALIBRATED))) {
540
+ strlen(TSK_TIME_UNITS_UNCALIBRATED))) {
541
541
  self->time_uncalibrated = true;
542
542
  }
543
543
  out:
@@ -856,7 +856,7 @@ out:
856
856
 
857
857
  /* Stats functions */
858
858
 
859
- #define GET_2D_ROW(array, row_len, row) (array + (((size_t)(row_len)) * (size_t)(row)))
859
+ #define GET_2D_ROW(array, row_len, row) (array + (((size_t) (row_len)) * (size_t) (row)))
860
860
 
861
861
  static inline double *
862
862
  GET_3D_ROW(double *base, tsk_size_t num_nodes, tsk_size_t output_dim,
@@ -899,7 +899,7 @@ tsk_treeseq_genealogical_nearest_neighbours(const tsk_treeseq_t *self,
899
899
  /* TODO It's probably not worth bothering with the int16_t here. */
900
900
  int16_t k, focal_reference_set;
901
901
  /* We use the K'th element of the array for the total. */
902
- const int16_t K = (int16_t)(num_reference_sets + 1);
902
+ const int16_t K = (int16_t) (num_reference_sets + 1);
903
903
  tsk_size_t num_nodes = self->tables->nodes.num_rows;
904
904
  const tsk_id_t num_edges = (tsk_id_t) self->tables->edges.num_rows;
905
905
  const tsk_id_t *restrict I = self->tables->indexes.edge_insertion_order;
@@ -1082,7 +1082,7 @@ tsk_treeseq_mean_descendants(const tsk_treeseq_t *self,
1082
1082
  tsk_size_t j;
1083
1083
  int32_t k;
1084
1084
  /* We use the K'th element of the array for the total. */
1085
- const int32_t K = (int32_t)(num_reference_sets + 1);
1085
+ const int32_t K = (int32_t) (num_reference_sets + 1);
1086
1086
  tsk_size_t num_nodes = self->tables->nodes.num_rows;
1087
1087
  const tsk_id_t num_edges = (tsk_id_t) self->tables->edges.num_rows;
1088
1088
  const tsk_id_t *restrict I = self->tables->indexes.edge_insertion_order;
@@ -1742,7 +1742,7 @@ tsk_treeseq_site_general_stat(const tsk_treeseq_t *self, tsk_size_t state_dim,
1742
1742
 
1743
1743
  /* Update the sites */
1744
1744
  for (tree_site = 0; tree_site < self->tree_sites_length[tree_index];
1745
- tree_site++) {
1745
+ tree_site++) {
1746
1746
  site = self->tree_sites[tree_index] + tree_site;
1747
1747
  ret = compute_general_stat_site_result(site, state, state_dim, result_dim, f,
1748
1748
  f_params, total_weight, polarised, site_result);
@@ -2882,7 +2882,7 @@ positions_to_tree_indexes(const tsk_treeseq_t *ts, const double *positions,
2882
2882
  }
2883
2883
  (*tree_indexes)[i] = tree_index;
2884
2884
  }
2885
- tsk_bug_assert(tree_index <= (tsk_id_t)(num_trees - 1));
2885
+ tsk_bug_assert(tree_index <= (tsk_id_t) (num_trees - 1));
2886
2886
 
2887
2887
  out:
2888
2888
  return ret;
@@ -2896,7 +2896,7 @@ get_index_counts(
2896
2896
  tsk_id_t index = indexes[0];
2897
2897
  tsk_size_t count, i;
2898
2898
  tsk_size_t *counts = tsk_calloc(
2899
- (tsk_size_t)(indexes[num_indexes ? num_indexes - 1 : 0] - indexes[0] + 1),
2899
+ (tsk_size_t) (indexes[num_indexes ? num_indexes - 1 : 0] - indexes[0] + 1),
2900
2900
  sizeof(*counts));
2901
2901
  if (counts == NULL) {
2902
2902
  ret = tsk_trace_error(TSK_ERR_NO_MEMORY);
@@ -3315,7 +3315,7 @@ tsk_treeseq_two_branch_count_stat(const tsk_treeseq_t *self, tsk_size_t state_di
3315
3315
  }
3316
3316
  col = 0;
3317
3317
  for (c = 0; c < (col_indexes[n_cols ? n_cols - 1 : 0] - col_indexes[0] + 1);
3318
- c++) {
3318
+ c++) {
3319
3319
  ret = advance_collect_edges(&r_state, (tsk_id_t) c + col_indexes[0]);
3320
3320
  if (ret != 0) {
3321
3321
  goto out;
@@ -3621,7 +3621,7 @@ tsk_treeseq_site_allele_frequency_spectrum(const tsk_treeseq_t *self,
3621
3621
 
3622
3622
  /* Update the sites */
3623
3623
  for (tree_site = 0; tree_site < self->tree_sites_length[tree_index];
3624
- tree_site++) {
3624
+ tree_site++) {
3625
3625
  site = self->tree_sites[tree_index] + tree_site;
3626
3626
  while (windows[window_index + 1] <= site->position) {
3627
3627
  window_index++;
@@ -4566,8 +4566,8 @@ D2_unbiased_summary_func(tsk_size_t state_dim, const double *state,
4566
4566
  double w_ab = n - (w_AB + w_Ab + w_aB);
4567
4567
  result[j] = (1 / (n * (n - 1) * (n - 2) * (n - 3)))
4568
4568
  * ((w_aB * w_aB * (w_Ab - 1) * w_Ab)
4569
- + ((w_ab - 1) * w_ab * (w_AB - 1) * w_AB)
4570
- - (w_aB * w_Ab * (w_Ab + (2 * w_ab * w_AB) - 1)));
4569
+ + ((w_ab - 1) * w_ab * (w_AB - 1) * w_AB)
4570
+ - (w_aB * w_Ab * (w_Ab + (2 * w_ab * w_AB) - 1)));
4571
4571
  }
4572
4572
  return 0;
4573
4573
  }
@@ -4604,8 +4604,8 @@ Dz_unbiased_summary_func(tsk_size_t state_dim, const double *state,
4604
4604
  result[j] = (1 / (n * (n - 1) * (n - 2) * (n - 3)))
4605
4605
  * ((((w_AB * w_ab) - (w_Ab * w_aB)) * (w_aB + w_ab - w_AB - w_Ab)
4606
4606
  * (w_Ab + w_ab - w_AB - w_aB))
4607
- - ((w_AB * w_ab) * (w_AB + w_ab - w_Ab - w_aB - 2))
4608
- - ((w_Ab * w_aB) * (w_Ab + w_aB - w_AB - w_ab - 2)));
4607
+ - ((w_AB * w_ab) * (w_AB + w_ab - w_Ab - w_aB - 2))
4608
+ - ((w_Ab * w_aB) * (w_Ab + w_aB - w_AB - w_ab - 2)));
4609
4609
  }
4610
4610
  return 0;
4611
4611
  }
@@ -4639,11 +4639,10 @@ pi2_unbiased_summary_func(tsk_size_t state_dim, const double *state,
4639
4639
  double w_Ab = state_row[1];
4640
4640
  double w_aB = state_row[2];
4641
4641
  double w_ab = n - (w_AB + w_Ab + w_aB);
4642
- result[j]
4643
- = (1 / (n * (n - 1) * (n - 2) * (n - 3)))
4644
- * (((w_AB + w_Ab) * (w_aB + w_ab) * (w_AB + w_aB) * (w_Ab + w_ab))
4645
- - ((w_AB * w_ab) * (w_AB + w_ab + (3 * w_Ab) + (3 * w_aB) - 1))
4646
- - ((w_Ab * w_aB) * (w_Ab + w_aB + (3 * w_AB) + (3 * w_ab) - 1)));
4642
+ result[j] = (1 / (n * (n - 1) * (n - 2) * (n - 3)))
4643
+ * (((w_AB + w_Ab) * (w_aB + w_ab) * (w_AB + w_aB) * (w_Ab + w_ab))
4644
+ - ((w_AB * w_ab) * (w_AB + w_ab + (3 * w_Ab) + (3 * w_aB) - 1))
4645
+ - ((w_Ab * w_aB) * (w_Ab + w_aB + (3 * w_AB) + (3 * w_ab) - 1)));
4647
4646
  }
4648
4647
  return 0;
4649
4648
  }
@@ -7784,7 +7783,7 @@ tsk_tree_map_mutations(tsk_tree_t *self, int32_t *genotypes,
7784
7783
  ret = tsk_trace_error(TSK_ERR_BAD_ANCESTRAL_STATE);
7785
7784
  goto out;
7786
7785
  } else if (ancestral_state >= num_alleles) {
7787
- num_alleles = (int32_t)(ancestral_state + 1);
7786
+ num_alleles = (int32_t) (ancestral_state + 1);
7788
7787
  }
7789
7788
  }
7790
7789
 
@@ -7882,8 +7881,8 @@ kc_vectors_alloc(kc_vectors *self, tsk_id_t n)
7882
7881
 
7883
7882
  self->n = n;
7884
7883
  self->N = (n * (n - 1)) / 2;
7885
- self->m = tsk_calloc((size_t)(self->N + self->n), sizeof(*self->m));
7886
- self->M = tsk_calloc((size_t)(self->N + self->n), sizeof(*self->M));
7884
+ self->m = tsk_calloc((size_t) (self->N + self->n), sizeof(*self->m));
7885
+ self->M = tsk_calloc((size_t) (self->N + self->n), sizeof(*self->M));
7887
7886
  if (self->m == NULL || self->M == NULL) {
7888
7887
  ret = tsk_trace_error(TSK_ERR_NO_MEMORY);
7889
7888
  goto out;
@@ -10739,14 +10738,14 @@ tsk_matvec_calculator_run(tsk_matvec_calculator_t *self)
10739
10738
  while (m < self->num_windows) {
10740
10739
  if (valid && self->position == tree_pos.interval.left) {
10741
10740
  for (k = (tsk_size_t) tree_pos.out.start;
10742
- k != (tsk_size_t) tree_pos.out.stop; k++) {
10741
+ k != (tsk_size_t) tree_pos.out.stop; k++) {
10743
10742
  e = out_order[k];
10744
10743
  p = edge_parent[e];
10745
10744
  c = edge_child[e];
10746
10745
  tsk_matvec_calculator_remove_edge(self, p, c);
10747
10746
  }
10748
10747
  for (j = (tsk_size_t) tree_pos.in.start; j != (tsk_size_t) tree_pos.in.stop;
10749
- j++) {
10748
+ j++) {
10750
10749
  e = in_order[j];
10751
10750
  p = edge_parent[e];
10752
10751
  c = edge_child[e];
@@ -663,7 +663,7 @@ sequence.
663
663
  @endrst
664
664
 
665
665
  @param self A pointer to a tsk_treeseq_t object.
666
- @return Returns a pointer to the time units.
666
+ @return Returns a pointer to the null-terminated file uuid.
667
667
  */
668
668
  const char *tsk_treeseq_get_file_uuid(const tsk_treeseq_t *self);
669
669