Skip to content

update ancestral maps #122

@MattesMrzik

Description

@MattesMrzik
  • add assert/debug assert to update_ancestral_map if the new map doesn't have the same length as all the other mappings.
    • warn if dollo is violated?
  • if the mapping is updated, but the sequences are not, then they are not in sync, which leads to wrong fmt. E.g.
// this is not valid code, but gets the idea across
ancestral_seq = b"AT";
new_mapping = vec![None, Some(0)];
// bug: expected fmt is "T" but is actually "A"

That means, if the new mapping has a None at some position were previously there was Some the char must be removed in the seq. And if there is a Some in the new mapping were previously there was a None a ambiguous char must be added to the seq. Alternatively we could also pass the new corresponding sequence.

  • add tests for update_ancestral_map
#[test]
fn test_update_ancestal_map() {
    // arrange
    let tree = tree!("((C:0.1,D:0.2)I01:0.3,(A:0.4,B:0.5)I02:0.6)Root;");
    let sequences =
        Sequences::new(read_sequences("./data/sequences_DNA1_with_ancestors.fasta").unwrap());
    let mut msa = MASA::from_aligned_with_ancestral(sequences, &tree).unwrap();
    let new_mapping = align!(b"A--A-A");

    // act
    msa.update_ancestral_map(&tree.root, new_mapping);

   // assert
   ...
}
  • If ancestral mappings change, then so does the TKF cost. So when mappings change, how do we know whether we need to update the tmp values of model_info?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions