13 unstable releases (5 breaking)

0.6.0 Apr 16, 2024
0.5.0 Sep 26, 2023
0.4.0 Mar 30, 2023
0.4.0-alpha.2 Oct 28, 2022
0.1.0 May 27, 2022

#19 in Simulation

Download history 27/week @ 2024-05-29 15/week @ 2024-06-05 3/week @ 2024-06-12 253/week @ 2024-06-26 877/week @ 2024-07-03 317/week @ 2024-07-10 415/week @ 2024-07-17 51/week @ 2024-07-24 718/week @ 2024-07-31 104/week @ 2024-08-07 2/week @ 2024-08-14 30/week @ 2024-08-21 59/week @ 2024-08-28 1/week @ 2024-09-04 18/week @ 2024-09-11

109 downloads per month
Used in 2 crates (via demes-forward)

MIT license

295KB
7K SLoC

Rust 5K SLoC // 0.0% comments Python 2K SLoC // 0.1% comments C 114 SLoC C++ 104 SLoC // 0.0% comments Shell 90 SLoC // 0.1% comments

rust implementation of the demes specification.

Citation

If you use demes for your research, please cite:

Gower, G., A. P. Ragsdale, G. Bisschop, R. N. Gutenkunst, M. Hartfield, E. Noskova, S. Schiffels, T. J. Struck, J. Kelleher, K. R. Thornton (2022) Demes: a standard format for demographic models. Genetics 222 (3):iyac131    

DOI for the paper.

Example

This example reads in models from files. The models are in YAML format. After reading, we iterate over every deme in the model and over every epoch of each deme. The iteration order is past to present.

fn main() {
    for input in std::env::args().skip(1) {
        println!("processing file {input}");
        let file = std::fs::File::open(input).unwrap();
        let graph = demes::load(file).unwrap();
        for deme in graph.demes() {
            println!("deme {}", deme.name());
            for epoch in deme.epochs() {
                println!("\tstart size = {}", epoch.start_size());
                println!("\tend size = {}", epoch.end_size());
                println!("\tstart time = {}", epoch.start_time());
                println!("\tend time = {}", epoch.end_time());
            }
        }
    }
}

This example can be run from the root of the workspace:

cargo run --example iterate_graph -- demes/examples/jouganous.yaml

Here is a richer example. To run it:

cargo run --example iterate_graph_detail -- demes/examples/jouganous.yaml

Change log

See here.

Dependencies

~4.5–7MB
~126K SLoC