Skip to content

Commit

Permalink
Merge pull request #300 from neherlab/refactor/fitch-simplify-upsert
Browse files Browse the repository at this point in the history
refactor: simplify upsert operation
  • Loading branch information
ivan-aksamentov authored Dec 10, 2024
2 parents 4b65646 + 4085c37 commit 4e9a8d2
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions packages/treetime/src/commands/ancestral/fitch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,13 +178,7 @@ fn fitch_backwards(graph: &SparseGraph, sparse_partitions: &[PartitionParsimony]
*parent_state = child_state;
} else {
// otherwise set or update the variable state
if seq_dis.variable.contains_key(&pos) {
let new_state = seq_dis.variable[&pos] + child_state;
seq_dis.variable.insert(pos, new_state);
} else {
let new_state = stateset! {*parent_state, child_state};
seq_dis.variable.insert(pos, new_state);
}
*seq_dis.variable.entry(pos).or_insert(stateset! {*parent_state}) += child_state;
*parent_state = VARIABLE_CHAR;
}
}
Expand Down

0 comments on commit 4e9a8d2

Please sign in to comment.