BAITS.VDJ.tl.compute_migraIdx#
- BAITS.VDJ.tl.compute_migraIdx(df, sample_col='sample', clone_col='clone', chain_col='Cgene', cluster_col='spatial_cluster', x_col='X', y_col='Y')#
Compute migration index between spatial clusters for BCR clones.
This metric quantifies the degree of clonal overlap between two clusters in a given sample and chain, weighted by Shannon entropy of clone distribution.
- Parameters:
df (pandas.DataFrame) – Input dataframe containing clone, chain, cluster, and coordinate info.
sample_col (str, default='sample') – Column name for sample identifier.
clone_col (str, default='clone') – Column name for clone identifier.
chain_col (str, default='Cgene') – Column name for BCR chain.
cluster_col (str, default='spatial_cluster') – Column name for spatial cluster.
x_col (str, default='X') – Column name for x-coordinate.
y_col (str, default='Y') – Column name for y-coordinate.
- Returns:
Dataframe with columns: [‘sample’, ‘chain’, ‘cluster_source’, ‘cluster_target’, ‘BCR_cross’] representing migration index between cluster pairs.
- Return type:
pandas.DataFrame