Repository navigation
Conversation
alignment: hide module-level docs from re-imports to reduce clutter. Documentation of re-imported stuff will be inlined.
alignment: replace Vec<String> used to map node indices to sequence ids with a named type with a description
alignment: fix docstrings (use IDs instead of ids) for consistency among docs
alphabets: hide submodule docs for public re-export of the parsimony_set submodule
alphabets: add doctrings for static objects such as alphabets and pre-computed conditional probabilities
alphabets: replace incorrect use of HashSet for an empty parsimony set with the predefined ParsimonySet type
Added module-level docs for the ASR module with an example. Added an example tree file with ancestral node labels.
There was a problem hiding this comment.
🟡 Changes recommended
Resolve the public API regression and crate-wide documentation-lint CI failures.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Adds crate-level documentation and examples for alignment, alphabets, and asr, plus ASR test coverage and fixture data.
Changes:
- Enables crate-wide
missing_docswarnings. - Adds module/API documentation and examples.
- Adds an ancestral reconstruction test and Newick fixture.
File summaries
| File | Summary |
|---|---|
phylo/src/lib.rs |
Enables missing-documentation warnings. |
phylo/src/asr/tests.rs |
Adds ancestral reconstruction test coverage. |
phylo/src/asr/mod.rs |
Adds ASR module documentation and example. |
phylo/src/alphabets/mod.rs |
Documents alphabet APIs and statics. |
phylo/src/alignment/mod.rs |
Documents alignment APIs and examples. |
phylo/examples/data/tree_with_ancestral_ids.newick |
Provides test tree data. |
Review details
Suppressed comments (3)
phylo/src/alignment/mod.rs:187
- The new description's phrase
by its node indexis grammatically incorrect and redundant; the node index is the selector for the sequence being updated.
/// Updates the `Mapping` of the ancestral sequence associated with the given internal node by
/// its node index.
phylo/src/alphabets/mod.rs:364
- The new documentation contains the typo
beused; it should be two words.
/// Static definition of an unknown alphabet, can beused as a fallback when the alphabet of a
phylo/src/alphabets/mod.rs:456
- This doc comment is indented with three spaces inside the
lazy_static!block, so the repository's rustfmt check will rewrite it to four spaces and fail the formatting job. Please align it with the surrounding declarations.
/// Static parsimony sets for each amino acid character.
- Files reviewed: 6/6 changed files
- Comments generated: 4
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Test Results991 tests +8 990 ✅ +8 14m 58s ⏱️ -26s Results for commit a4678c5. ± Comparison against base commit 752d213. This pull request removes 15 and adds 23 tests. Note that renamed tests count towards both.♻️ This comment has been updated with latest results. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #185 +/- ##
===========================================
+ Coverage 96.32% 96.65% +0.33%
===========================================
Files 32 46 +14
Lines 4355 5475 +1120
===========================================
+ Hits 4195 5292 +1097
- Misses 160 183 +23 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
| //! Ancestral sequence reconstruction module. | ||
| //! | ||
| //! Provides the `AncestralSequenceReconstruction` trait for reconstructing ancestral sequences | ||
| //! given a leaf alignment or an existing ancestral alignment and a phylogenetic tree. |
There was a problem hiding this comment.
existing ancestral alignment
Perhaps say that the ancestral sequences will be ignored in that case. Since its only passed as Alignment so we dont have access to the ancestral sequences.
| //! The Sequences object is used to store the sequences in the alignment, and the lengths of | ||
| //! the sequences in the alignment must be consistent. |
There was a problem hiding this comment.
... and the lengths of the sequences in the alignment must be consistent.
But right now the lens of the seqs in the Sequences obj that is a field of the alignment must not be of equal length, as their gaps are removed. Only when we call from_aligned, passing a Sequences, must they be of equal length.
| //! The sequence IDs must be unique within the collection. | ||
| //! The sequences stored in the object can be aligned or unaligned. | ||
| //! | ||
| //! Contains the [`Alignment`] and [`AncestralAlignment`] traits for representing and manipulating |
There was a problem hiding this comment.
Perhaps mention that the alignment and how its implemented here depends on a tree, since we are using NodeIdx for some its fields (like SeqMaps). So the alignment should always be seen as belonging to some tree.
| /// Represents the mapping of sequences for nodes in the tree as a `hashbrown::HashMap` | ||
| /// where the key is the node index (of type [`NodeIdx`]) and the value is the [`Mapping`] of | ||
| /// sequences for that node. | ||
| pub type SeqMaps = HashMap<NodeIdx, Mapping>; |
There was a problem hiding this comment.
... tree ...
Perhaps link the Tree struct here?
| /// Returns the `Mapping` of the ancestral sequence associated with the given internal node. | ||
| fn ancestral_map(&self, node_idx: &NodeIdx) -> &Mapping; |
There was a problem hiding this comment.
| /// Returns the `Mapping` of the ancestral sequence associated with the given internal node. | |
| fn ancestral_map(&self, node_idx: &NodeIdx) -> &Mapping; | |
| /// Returns the `Mapping` of the ancestral sequence corresponding to the given internal node index. | |
| fn ancestral_map(&self, node_idx: &NodeIdx) -> &Mapping; |
There was a problem hiding this comment.
To match the doc for the leaf_map()
| /// Represents a multiple sequence alignment (MSA) with associated leaf mappings and internal alignments. | ||
| /// | ||
| /// This structure stores the sequences and their corresponding mappings for leaf nodes, | ||
| /// as well as the internal alignments and a mapping from node indices in the tree to sequence IDs. |
There was a problem hiding this comment.
... internal alignments ...
Perhaps mention that these are created according to the tree that was passed on creation.
This also applies for the MASA doc.
| pub(crate) static AMB_AMINOACIDS: &[u8] = b"BJZX"; | ||
|
|
||
| /// All single-letter symbols for valid non-ambiguous nucleotides used in the alphabet. | ||
| /// This is legacy sorting, i.e., conforming with tools like RaXML and PhyML, and is used also |
| /// The character representing a gap in the alphabet used in MSAs. | ||
| pub static GAP: u8 = b'-'; |
There was a problem hiding this comment.
| /// The character representing a gap in the alphabet used in MSAs. | |
| pub static GAP: u8 = b'-'; | |
| /// The character in the alphabet representing a gap as used in MSAs. |
or The character in the alphabets representing a gap.
or The character representing a gap in MSAs.
| pub struct Alphabet { | ||
| /// Human-readable name of the alphabet. | ||
| name: &'static str, | ||
| /// Unambiguous symbols in the alphabet, in matrix order. |
There was a problem hiding this comment.
Perhaps link the QMatrix here?
| pub(crate) static AMB_NUCLEOTIDES: &[u8] = b"RYSWKMBDHVNZX"; | ||
|
|
||
| /// The character representing an ambiguous symbol in both the amino acid and nucleotide alphabets. | ||
| pub(crate) static AMB_CHAR: u8 = b'X'; |
There was a problem hiding this comment.
In the upcoming simulation #140 , but also in parsimony_presence_absence, and EdgeSeqsReestimator I use these X chars as mention in the docs, since I want to tell the user which char will be used for indicating any char. This will not be possible when having this only pub(crate) and not pub. Same holds for the GAP.
Properly documented the
alignment,alphabetsandasrmodules, including missing docstrings/tests and module-level docs for each.Includes slight changes in the public API by making some string constants
pub(crate)instead ofpub.