Benchmark

MiTo on data whose clones are known independently of the mitochondrial signal:

  1. Simulated MAESTER-like data: flat and nested clonal trees, 5 to 50 clones.

  2. MAESTER: MDA-MB-231 cells carrying 8 lentiviral barcodes (MiTo paper, MDA_clones).

  3. ReDeeM vs mtscATAC on the same cells: the pL1000 10x Multiome dataset of the MitoDrift paper, where ReDeeM and mgatk were run on the same libraries, scored against LARRY lineage barcodes.

Every dataset runs through the same calls with package defaults. The scores are the adjusted Rand index (ARI) of the clones against the ground truth, on the cells MiTo assigns, and on all cells, counting those MiTo leaves unassigned (or removes for carrying no variant) as singletons. “All cells” are the cells passing filter_cells, except on pL1000, where they are all 1,362 barcoded cells, as in the MitoDrift paper. The “MiTo clones” column counts the clones among the cells that are scored.

[1]:
import logging
import os
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import scanpy as sc
import mito as mt

logging.getLogger().setLevel(logging.WARNING)   # MiTo logs every stage at INFO level


def run(afm, cell_filter='filter1'):
    """The pipeline, with package defaults. Returns the tree and the cells passing filter_cells."""
    mt.pp.filter_cells(afm, cell_filter=cell_filter)
    qc_cells = afm.obs_names.copy()
    mt.pp.filter_afm(afm)
    tree = mt.tl.build_tree(afm)
    mt.tl.annotate_clones(tree, afm)
    return tree, qc_cells


def scores(afm, truth):
    """
    ARI on the assigned cells and on all the cells of `truth`: those MiTo leaves
    unassigned or removes count as singletons.
    """
    truth = truth.dropna().astype(str)
    lab = afm.obs['MiTo_clone'].astype(str).reindex(truth.index).fillna('unassigned')
    ok = lab != 'unassigned'
    lab_all = lab.where(ok, pd.Series([f'single_{i}' for i in range(lab.size)], index=lab.index))
    return {'cells assigned': f'{ok.mean():.0%}', 'true clones': truth.nunique(), 'MiTo clones': lab[ok].nunique(),
            'ARI (assigned)': round(mt.ut.custom_ARI(truth[ok], lab[ok]), 3),
            'ARI (all cells)': round(mt.ut.custom_ARI(truth, lab_all), 3)}


def make_axes(nrows, height=4.5):
    """Rows of (heatmap, cell tree, clone tree) axes; a thin spacer evens the gaps despite the colorbar."""
    fig = plt.figure(figsize=(13.5, height * nrows))
    gs = fig.add_gridspec(nrows, 4, width_ratios=[2, .1, 2, 2])
    return fig, [[fig.add_subplot(gs[i, j]) for j in (0, 2, 3)] for i in range(nrows)]


def show_trees(tree, axs, lw=.4):
    """Collapsed clones (fans, with gaps) and the clone tree (circle = cells)."""
    labels = tree.cell_meta['MiTo_clone'].astype(str)
    mt.pl.plot_tree(tree, ax=axs[0], collapse_clones='MiTo_clone', clone_style='full', gap_by='MiTo_clone',
                    branches=dict(annot='MiTo_clone', linewidth=lw))
    mt.pl.plot_clone_tree(tree, ax=axs[1])
    axs[0].set_title(f'Cell tree (n={len(tree.leaves)})', fontsize=9)
    axs[1].set_title(f'Clone tree (n={labels[labels != "unassigned"].nunique()})', fontsize=9)
    for ax in axs:
        ax.set_aspect('equal')

1. Simulated data

24 datasets of 1,000 cells: 5, 10, 30 or 50 clones, either all branching from the root (polytomy) or nested three levels deep, three seeds each, at MAESTER-like depth.

[2]:
maester_like = dict(
    n_cells=1000, frac_double_variants=.3, frac_noisy_variants=.2,
    af_beta=(3, 57), af_beta_min=.04, af_depth_decay=.85, af_beta_noise=(2, 1500),
    af_negative_frac=.002, mean_coverage=200, coverage_cell_cv=.2, coverage_site_cv=.8,
    mean_molecules=40, molecule_cv=.5, molecule_coverage_exponent=0.,
    overdispersion_background=1.2, overdispersion_noise_frac=.5, noise_prevalence=(.05, .2),
)

rows, examples = [], {}
for n in (5, 10, 30, 50):
    for topology in ('polytomy', 'nested'):
        for seed in (0, 1, 2):
            shape = dict(n_root_clones=n, max_depth=1) if topology == 'polytomy' else \
                    dict(n_root_clones=max(2, n // 3), max_depth=3)
            afm = mt.ut.simulate_afm(n_clones=n, random_seed=seed, **shape, **maester_like)
            truth = afm.obs['clone'].astype(str)
            tree, qc = run(afm, cell_filter='filter2')
            rows.append({'clones': n, 'topology': topology, 'seed': seed, **scores(afm, truth[qc])})
            if n == 30 and seed == 0:
                examples[topology] = (afm, tree)

sim = pd.DataFrame(rows)
sim.pivot_table(index='clones', columns='topology', values=['ARI (assigned)', 'ARI (all cells)']).round(2)
[2]:
ARI (all cells) ARI (assigned)
topology nested polytomy nested polytomy
clones
5 0.37 0.81 0.98 0.99
10 0.43 0.66 0.70 0.97
30 0.40 0.72 0.45 0.91
50 0.41 0.73 0.45 0.89

Flat trees are recovered well on the cells MiTo assigns. Nested trees are harder: a sub-clone shares its parent’s variants, and its own markers are carried by fewer cells. The all-cells score is lower everywhere because some simulated cells drop out every marker of their clone (molecule sampling at MAESTER depth): they carry no variant to place them, and MiTo removes them rather than guess. With 30 clones:

[3]:
fig, rows = make_axes(2)
for row, topology in zip(rows, ('polytomy', 'nested')):
    afm, tree = examples[topology]
    mt.pl.heatmap_variants(afm, tree=tree, ax=row[0])
    row[0].set_title(f'{topology}: cells x variants', fontsize=9)
    show_trees(tree, row[1:])
fig.tight_layout()
_images/benchmark_5_0.png

2. MAESTER: MDA_clones

558 MDA-MB-231 cells carrying 8 lentiviral clones, profiled with MAESTER (the MiTo paper’s ground-truth benchmark). The AFM is in the paper’s test data (Zenodo), written by an earlier MiTo: migrate_afm brings it to the current format.

wget https://zenodo.org/records/17225334/files/data_test.tar.gz && tar -xzf data_test.tar.gz
[4]:
mda = sc.read('data_test/afm_unfiltered.h5ad')
mt.io.migrate_afm(mda)
gbc = mda.obs['GBC'].astype(str)
tree_mda, qc = run(mda, cell_filter='filter2')
print(f'{len(qc)} of {len(gbc)} cells pass the MT coverage QC; {len(tree_mda.leaves)} are left in the tree, '
      'the others carry no variant and are removed by filter_afm')
pd.DataFrame([scores(mda, gbc[qc])], index=['MDA_clones'])
375 of 558 cells pass the MT coverage QC; 337 are left in the tree, the others carry no variant and are removed by filter_afm
[4]:
cells assigned true clones MiTo clones ARI (assigned) ARI (all cells)
MDA_clones 86% 8 10 0.903 0.754
[5]:
fig, (row,) = make_axes(1)
mt.pl.heatmap_variants(mda, tree=tree_mda, ax=row[0])
row[0].set_title('cells x variants', fontsize=9)
show_trees(tree_mda, row[1:])
fig.tight_layout()
_images/benchmark_8_0.png

3. ReDeeM vs mtscATAC, same cells

pL1000 (Weng et al. 2024; MitoDrift, 2025) is a 10x Multiome library of human hematopoietic cells with LARRY lineage barcodes. Its mtDNA was profiled both with ReDeeM (consensus molecules, RedeemV) and as plain mtscATAC reads (mgatk), on the same cells. 1,362 cells carry a LARRY barcode, in 256 clones, most of them of 2-10 cells.

The deposit (5.6 GB, figshare) is fetched with python benchmarks/fetch_pl1000.py from the MiTo repository. The LARRY clone of each cell, with its ATAC barcode (the one RedeemV and mgatk use), is in data/pL1000_LARRY.csv.

[6]:
PL1000 = os.environ.get('MITO_PL1000', '../../data_test/bench/pL1000')
larry = pd.read_csv('data/pL1000_LARRY.csv').set_index('atac')['LARRY']

pl1000 = {}
for assay, method in (('ReDeeM', 'redeem-v'), ('mtscATAC', 'mgatk')):
    afm = mt.io.make_afm(PL1000, scLT_system=assay, pp_method=method)
    afm.obs_names = afm.obs_names.str.replace('-1$', '', regex=True)
    afm.obs['LARRY'] = larry.reindex(afm.obs_names).values
    pl1000[assay] = (afm, run(afm)[0])

pd.DataFrame({assay: scores(afm, larry) for assay, (afm, _) in pl1000.items()}).T
2026-10-16 15:00:31,318 - WARNING - 1048 candidate MT-SNVs: keeping the 1000 most over-dispersed (max_candidates). Raise it to test more, at a cost in time and memory.
[6]:
cells assigned true clones MiTo clones ARI (assigned) ARI (all cells)
ReDeeM 66% 256 166 0.84 0.66
mtscATAC 56% 256 122 0.841 0.629

For reference, MitoDrift (a Bayesian tree on the ReDeeM data) scores, by the same all-cells convention, 0.632 (ARI 0.679 on assigned cells, confidence cut 0.125) and 0.635 (0.800, cut 0.25).

The two assays agree with each other on the cells both of them assign:

[7]:
(r, _), (a, _) = pl1000['ReDeeM'], pl1000['mtscATAC']
both = r.obs_names.intersection(a.obs_names)
both = both[(r.obs.loc[both, 'MiTo_clone'] != 'unassigned').values & (a.obs.loc[both, 'MiTo_clone'] != 'unassigned').values]
print(f'{len(both)} cells assigned by both assays: ARI ReDeeM vs mtscATAC '
      f'{mt.ut.custom_ARI(r.obs.loc[both, "MiTo_clone"].astype(str), a.obs.loc[both, "MiTo_clone"].astype(str)):.2f}')
1587 cells assigned by both assays: ARI ReDeeM vs mtscATAC 0.92

mtscATAC is as accurate on the cells it assigns, but assigns fewer: without UMIs, a molecule seen once is weaker evidence. ReDeeM resolves more of the small clones.

In the table, cells and clones are those of the 1,362 barcoded cells, as the scores are. The trees below hold every cell the library has left after filter_cells and filter_afm (cells with no called variant are removed), barcoded or not: 2,413 of 3,686 cells for ReDeeM and 1,966 of 3,811 for mtscATAC, with 217 and 156 clones. This is also why 1,587 cells are assigned by both assays above, more than the barcoded cells either assay assigns. Allele frequencies, collapsed clones and clone tree of each assay:

[8]:
fig, rows = make_axes(2)
for row, (assay, (afm, tree)) in zip(rows, pl1000.items()):
    mt.pl.heatmap_variants(afm, tree=tree, ax=row[0])
    row[0].set_title(f'{assay}: cells x variants', fontsize=9)
    show_trees(tree, row[1:], lw=.12)
fig.tight_layout()
_images/benchmark_14_0.png