Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions sc2ts/debug.py
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,7 @@ def _preprocess_nodes(self, show_progress):
total=ts.num_nodes,
disable=not show_progress,
)
group_id_prefix_map = {}
for node in iterator:
md = node.metadata
self.nodes_metadata[node.id] = md
Expand All @@ -468,6 +469,14 @@ def _preprocess_nodes(self, show_progress):
if group_id is not None:
# Shorten key for readability.
gid = group_id[: self.sample_group_id_prefix_len]
if gid not in group_id_prefix_map:
group_id_prefix_map[gid] = group_id
if group_id != group_id_prefix_map[gid]:
raise ValueError(
"Sample group ID prefix collision. "
"Increase sample_group_id_prefix_len "
"(default=10)"
)
self.sample_group_nodes[gid].append(node.id)
if node.is_sample():
self.nodes_date[node.id] = md["date"]
Expand Down
6 changes: 3 additions & 3 deletions sc2ts/inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -932,15 +932,15 @@ def __post_init__(self):

@property
def strains(self):
return [s.strain for s in self.samples]
return [str(s.strain) for s in self.samples]

@property
def date_count(self):
return collections.Counter([s.date for s in self.samples])
return collections.Counter([str(s.date) for s in self.samples])

@property
def pango_count(self):
return collections.Counter([s.pango for s in self.samples])
return collections.Counter([str(s.pango) for s in self.samples])

def __len__(self):
return len(self.samples)
Expand Down
Loading