Skip to content

Commit 2344b99

Browse files
Basis info tweaks to account for exact match flags
1 parent 6b2c42a commit 2344b99

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

sc2ts/utils.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -494,13 +494,14 @@ def summary(self):
494494
mc_nodes = np.sum(self.ts.nodes_flags == sc2ts.NODE_IS_MUTATION_OVERLAP)
495495
pr_nodes = np.sum(self.ts.nodes_flags == sc2ts.NODE_IS_REVERSION_PUSH)
496496
re_nodes = np.sum(self.ts.nodes_flags == sc2ts.NODE_IS_RECOMBINANT)
497+
exact_matches = np.sum((self.ts.nodes_flags & sc2ts.NODE_IS_EXACT_MATCH) > 0)
497498

498499
samples = self.ts.samples()
499500
nodes_with_zero_muts = np.sum(self.nodes_num_mutations == 0)
500501
sites_with_zero_muts = np.sum(self.sites_num_mutations == 0)
501502
latest_sample = self.nodes_date[samples[-1]]
502503
masked_sites_per_sample = self.nodes_num_masked_sites[samples]
503-
non_samples = self.ts.nodes_flags != tskit.NODE_IS_SAMPLE
504+
non_samples = (self.ts.nodes_flags & tskit.NODE_IS_SAMPLE) == 0
504505
max_non_sample_mutations = np.max(self.nodes_num_mutations[non_samples])
505506
insertions = np.sum(self.mutations_inherited_state == "-")
506507
deletions = np.sum(self.mutations_derived_state == "-")
@@ -509,6 +510,7 @@ def summary(self):
509510
("latest_sample", latest_sample),
510511
("samples", self.ts.num_samples),
511512
("nodes", self.ts.num_nodes),
513+
("exact_matches", exact_matches),
512514
("mc_nodes", mc_nodes),
513515
("pr_nodes", pr_nodes),
514516
("re_nodes", re_nodes),
@@ -584,7 +586,7 @@ def _node_summary(self, u, child_mutations=True):
584586
qc += status
585587
flags = self.ts.nodes_flags[u]
586588
strain = ""
587-
if flags == tskit.NODE_IS_SAMPLE:
589+
if (flags & tskit.NODE_IS_SAMPLE) != 0:
588590
strain = md["strain"]
589591
elif flags == 1 << 21:
590592
if "overlap" in md:

0 commit comments

Comments
 (0)