Tools

Tools#

tl.stat_clone(df, groupby, Cgene_col, clone_col)

Compute the number of unique clones per group and optionally plot.

tl.compute_grouped_index(df, group_by, ...)

Compute a diversity index (e.g., Shannon entropy) per group.

tl.aggregate_clone_df(df, group_by, ...[, ...])

Aggregate clone counts and frequencies per group.

tl.cluster_group(cdr3_list[, threshold])

Cluster a list of CDR3 nucleotide sequences based on sequence identity.

tl.process_group_with_neighbor_count(group)

Process a grouped BCR dataframe to assign clusters and neighbor counts.

tl.cluster_bcrs(igh_df[, threshold, ...])

Cluster BCR sequences across an entire dataset and compute neighbor degrees.

tl.shannon_entropy(p)

Compute Shannon entropy of a probability vector.

tl.normalize_shannon_entropy(p)

Compute normalized Shannon entropy (range 0-1).

tl.Clonality(p)

Compute clonality metric from Shannon entropy.

tl.renyi_entropy(probabilities[, alpha_values])

Calculate the Rényi entropy for a given probability distribution and alpha.

tl.gini_index(data)

Compute Gini index of a distribution.

tl.Clonal_family_diversification(df[, ...])

Compute clonal family diversification (Gini index of clone sizes per sample).

tl.compute_migraIdx(df[, sample_col, ...])

Compute migration index between spatial clusters for BCR clones.

tl.calculate_clone_niche(df, sample, ...[, ...])

Calculate spatial niche composition around a target BCR clone.

tl.calculate_qc_clones(df, group_by, ...[, ...])

Compute per-group clone counts and per-spatial-location clone counts.

tl.calculate_qc_umis(df, group_by, ...[, ...])

Compute per-group and per-spatial-location UMI counts for clones.

tl.filter_clones(df, clone_col[, min_clone])

Filter dataframe by minimum clone count.

tl.filter_clones_spatial(df, clone_spatial_col)

Filter dataframe by minimum spatial clone count.

tl.filter_umi(df, umi_key[, min_umi])

Filter dataframe by minimum UMI count per clone.

tl.filter_umi_spatial(df, clone_umi_key[, ...])

Filter dataframe by minimum spatial UMI count per clone.

tl.calculate_cdr3_length(df, sample_col, ...)

Calculate the CDR3 length for each clone and optionally plot the distribution.