1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
//! Tools for working with site frequency spectra.
//!
//! This serves as the core library implementation for the `sfs` CLI, but can also be used as a
//! free-standing library for working with frequency spectra.
//!
//! # Overview
//!
//! The core struct is a [`Spectrum`], which is backed by an N-dimensional [`Array`].
//! A spectrum may either be a *frequency* spectrum ([`Sfs`]), in which case we say that it is
//! normalized, or it may be a *count* spectrum ([`Scs`]).
//!
//! # Example
//!
//! As a very brief introduction to the API, let's create a count spectrum, and then normalize it
//! to obtain a per-base estimate of θ using Watterson's estimator.
//!
//! ```
//! use sfs_core::Scs;
//!
//! // Create a 1-dimensional SCS from some data
//! let scs = Scs::from_vec([25., 8., 4., 2., 1., 0.]);
//!
//! // Normalize the spectrum to frequencies
//! let sfs = scs.into_normalized();
//!
//! // Calculate θ
//! let theta = sfs.theta_watterson().expect("θ only defined in 1D");
//!
//! assert!((theta - 0.18).abs() < 1e-16);
//! ```
pub
pub use Input;
pub use ;
pub use Array;