Skip to content

Commit

Permalink
deactivate empty node removal
Browse files Browse the repository at this point in the history
  • Loading branch information
mmolari committed Jan 10, 2025
1 parent 418769e commit 305221e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
11 changes: 8 additions & 3 deletions packages/pangraph/src/reconsensus/reconsensus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ use crate::pangraph::edits::{Ins, Sub};
use crate::pangraph::pangraph::Pangraph;
use crate::pangraph::pangraph_block::{BlockId, PangraphBlock};
use crate::pangraph::pangraph_node::NodeId;
use crate::reconsensus::remove_nodes::remove_emtpy_nodes;
// use crate::reconsensus::remove_nodes::remove_emtpy_nodes;
use crate::reconsensus::remove_nodes::find_empty_nodes;
use crate::utils::collections::insert_at_inplace;
use eyre::Report;
use itertools::Itertools;
Expand All @@ -24,8 +25,12 @@ use std::collections::BTreeMap;
/// - for any in/del present in > M/2 sites, appends it to the consensus
/// - if the consensus has updated indels, then re-aligns all the sequences to the new consensus
pub fn reconsensus_graph(graph: &mut Pangraph, ids_updated_blocks: Vec<BlockId>) -> Result<(), Report> {
// remove selected nodes from graph
remove_emtpy_nodes(graph, &ids_updated_blocks);
// // remove selected nodes from graph
// remove_emtpy_nodes(graph, &ids_updated_blocks);
debug_assert!(
find_empty_nodes(graph, &ids_updated_blocks).is_empty(),
"Empty nodes found in the graph"
);

for block_id in ids_updated_blocks {
let block = graph.blocks.get_mut(&block_id).unwrap();
Expand Down
2 changes: 1 addition & 1 deletion packages/pangraph/src/reconsensus/remove_nodes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pub fn remove_emtpy_nodes(graph: &mut Pangraph, block_ids: &[BlockId]) {

/// Finds nodes with empty sequences (full deletion) in the graph.
/// It only checks specific blocks (the ones that were updated by a merger/split).
fn find_empty_nodes(graph: &Pangraph, block_ids: &[BlockId]) -> Vec<NodeId> {
pub fn find_empty_nodes(graph: &Pangraph, block_ids: &[BlockId]) -> Vec<NodeId> {
let mut node_ids_to_delete = Vec::new();
for &block_id in block_ids {
let block = &graph.blocks[&block_id];
Expand Down

0 comments on commit 305221e

Please sign in to comment.