From d27372417928ce7fb34dd4bde6be62b350e565ac Mon Sep 17 00:00:00 2001 From: peter Date: Wed, 23 Sep 2026 10:39:58 -0700 Subject: [PATCH 1/2] docfix --- pyslim/slim_metadata.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pyslim/slim_metadata.py b/pyslim/slim_metadata.py index 4c39f7c..7fd2352 100644 --- a/pyslim/slim_metadata.py +++ b/pyslim/slim_metadata.py @@ -786,10 +786,14 @@ def default_slim_metadata(name, num_chromosomes=1, num_traits=1, **kwargs): metadata dictionary: for each such key=value pair the returned dictionary has `value` (re)assigned to `key`. + For top-level ("tree_sequence") metadata, this method does not provide entries + for more than one chromosome under the key "chromosomes", since this is + considered optional by SLiM. + :param str name: The type of metadata requested. :param int num_chromosomes: The number of chromosomes (only relevant for "node"). :param int num_traits: The number of traits - (only relevant for "individual" and "mutation_list_entry"). + (only relevant for "tree_sequence", "individual" and "mutation_list_entry"). :rtype dict: """ if name == "tree_sequence": From de65925e93ba4f2f6a29a5ffc699cd669ef64ffd Mon Sep 17 00:00:00 2001 From: peter Date: Wed, 23 Sep 2026 11:59:50 -0700 Subject: [PATCH 2/2] document mutation_at and nucleotide_at; closes #369 --- docs/.gitignore | 1 + docs/python_api.md | 10 ++++++++++ pyslim/slim_tree_sequence.py | 2 +- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/docs/.gitignore b/docs/.gitignore index 57d31a2..2a584d5 100644 --- a/docs/.gitignore +++ b/docs/.gitignore @@ -5,3 +5,4 @@ example_snps.vcf sims.make example_sim.vcf .ipynb_checkpoints +example_sim2.vcf diff --git a/docs/python_api.md b/docs/python_api.md index 2197a3c..87076c4 100644 --- a/docs/python_api.md +++ b/docs/python_api.md @@ -49,6 +49,8 @@ Here is a quick reference to some of the methods: individuals_alive_at mutation_metadata next_slim_mutation_id + mutation_at + nucleotide_at nodes_vacant population_size recapitate @@ -156,6 +158,14 @@ Additionally, ``pyslim`` contains the following methods: .. autofunction:: is_current_version ``` +```{eval-rst} +.. autofunction:: nucleotide_at +``` + +```{eval-rst} +.. autofunction:: mutation_at +``` + ## Metadata diff --git a/pyslim/slim_tree_sequence.py b/pyslim/slim_tree_sequence.py index 331881d..0065be1 100644 --- a/pyslim/slim_tree_sequence.py +++ b/pyslim/slim_tree_sequence.py @@ -120,7 +120,7 @@ def nucleotide_at(ts, node, position, time=None, mut_metadata=None): mutation IDs in its metadata. This method uses a dictionary of mutation metadata, computed by - :meth:`mut_metadata`. This step can be expensive if there are + :meth:`mutation_metadata`. This step can be expensive if there are many mutations, so this can be pre-computed and passed in as ``mutations``. If not provided, it will be computed.