Splitting Cells Into ClonesΒΆ

An approximate subclone assignment can be derived from the hierarchical clustering using pyEpiAneufinder.split_subclones().

import pandas as pd
import pyEpiAneufinder as pea

res = pd.read_csv(
    "results_sample_data/outs/result_table.tsv.gz",
    sep="\t",
    index_col=0,
)
clones = pea.split_subclones(res, split_val=4)

These clone labels can be shown as an annotation bar in pyEpiAneufinder.karyo_gainloss(). The annotation table must be indexed by cell barcode and must contain a column named annot.

annot_dt = clones.copy()
annot_dt.index = annot_dt.barcode
annot_dt["annot"] = pd.Categorical("clone" + annot_dt.subclone.astype(str))

pea.karyo_gainloss(
    res,
    outdir="results_sample_data/karyo_annot.png",
    title="Karyogram with annotation",
    annot_dt=annot_dt,
)
Karyogram with clone annotations