cospar.tl.fate_bias

cospar.tl.fate_bias(adata, selected_fates=None, source='transition_map', map_backward=True, method='norm-sum', sum_fate_prob_thresh=0, pseudo_count=0)

Compute fate bias to given two fate clusters (A, B).

Given a fate map \(P_i\) towards two fate clusters \(\{\mathcal{A}, \mathcal{B}\}\), constructed according to fate_map(), we compute the fate bias of state \(i\) as \([P(\mathcal{A})+c_0]/[P(\mathcal{A})+P(\mathcal{B})+2c_0]\), where \(c_0=a * \max_{i,\mathcal{C}} P_i(\mathcal{C})\) is a re-scaled pseudocount, with \(a\) given by pseudo_count.

Parameters
adata : AnnData object

Assume to contain transition maps at adata.uns.

selected_fates : list

List of cluster ids consistent with adata.obs[‘state_info’]. It allows a nested structure. If so, we merge clusters within each sub-list into a mega-fate cluster.

source : str

The transition map to be used for plotting: {‘transition_map’, ‘intraclone_transition_map’,…}. The actual available map depends on adata itself, which can be accessed at adata.uns[‘available_map’]

map_backward : bool, optional (default: True)

If map_backward=True, show fate properties of initial cell states \(i\); otherwise, show progenitor properties of later cell states \(j\). This is used for building the fate map \(P_i(\mathcal{C})\). See fate_map().

method : str, optional (default: ‘norm-sum’)

Method to obtain the fate probability map \(P_i(\mathcal{C})\) towards a set of states annotated with fate \(\mathcal{C}\). Available options: {‘sum’, ‘norm-sum’}. See fate_map().

sum_fate_prob_thresh : float, optional (default: 0.05)

The fate bias of a state is plotted only when it has a cumulative fate probability to the combined cluster (A+B) larger than this threshold, i.e., P(i->A)+P(i+>B) > sum_fate_prob_thresh.

Returns

Results updated at adata.obs[f’fate_bias_{source}_{fate_1}_{fate_2}’]