This is a Rust program designed to sample a certain subset of leaves uniformly in a species tree as well as all the corresponding gene trees.
Building a project written in Rust is very easy.
- Install the Cargo package manager.
- Clone the repository.
- Navigate inside the directory in the terminal.
- Run the command
cargo build --release
. This will automatically download all necessary dependencies and compile the binary inside a new target directory.
This Rust script chooses species uniformly among leaves of the species tree, then removes all other leaves. It then removes the leaves with the same names from the gene trees chosen.
Input:
- A .nwk file representing the species tree in a format like
((a:1.0,b:1.0)c:1.0,d:2.0)e:0.0;
. - A path for the folder
gene_folder
containing gene trees, which should be namedgene_folder/gene_i.nwk
. - An integer giving the number of leaves to keep on the sampled trees.
- The start index
i
of the first gene to sample (inclusive). - The end index
j
of the last gene to sample (exclusive). - The output directory
output_dir
.
Usage: target/release/sample_script <species_tree_path> <gene_trees_path> <n_sampled_nodes> <start_index> <end_index> <output_dir> <seed>
Output:
output_dir
will contain the sampled species tree output_dir/sampled_species_tree.nwk
as well as the sampled gene trees output_dir/sampled_gene_i.nwk
.