Skip to content

Commit

Permalink
Normalize gene ids in extract summary
Browse files Browse the repository at this point in the history
  • Loading branch information
axdanbol committed Aug 24, 2023
1 parent da42287 commit dce8873
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion containers/extract-summary/context/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ def compute_summary_rows(
) -> t.List[CellSummaryRow]:
rowsById: t.Dict[t.Tuple[str, str], CellSummaryRow] = {}
cell_id_transform = lambda val: val
gene_id_transform = lambda val: val
total = 0

if cell_id_column is None:
Expand All @@ -89,14 +90,15 @@ def compute_summary_rows(

if gene_id_column is None:
gene_id_column = gene_label_column
gene_id_transform = normalize_id

for item in items:
id = (item[cell_id_column], item[gene_id_column])
if id not in rowsById:
rowsById[id] = _CellSummaryRow(
cell_id_transform(item[cell_id_column]),
item[cell_label_column],
item[gene_id_column],
gene_id_transform(item[gene_id_column]),
item[gene_label_column],
)
rowsById[id]["count"] += 1
Expand Down

0 comments on commit dce8873

Please sign in to comment.