cospar.tl.fate_map

cospar.tl.fate_map(adata, selected_fates=None, source='transition_map', map_backward=True, method='norm-sum', fate_count=False, force_run=False)

Compute transition probability to given fate/ancestor clusters.

Given a transition map \(T_{ij}\), we explore build the fate map \(P_i(\mathcal{C})\) towards a set of states annotated with fate \(\mathcal{C}\) in the following ways.

Step 1: Map normalization: \(T_{ij}\leftarrow T_{ij}/\sum_j T_{ij}\).

Step 2: If map_backward=False, perform matrix transpose \(T_{ij} \leftarrow T_{ji}\).

Step 3: aggregate fate probabiliteis within a given cluster \(\mathcal{C}\):

  • method=’sum’: \(P_i(\mathcal{C})=\sum_{j\in \mathcal{C}} T_{ij}\). This gives the intuitive meaning of fate probability.

  • method=’norm-sum’: We normalize the map from ‘sum’ method within a cluster, i.e. \(P_i(\mathcal{C})\leftarrow P_i(\mathcal{C})/\sum_j P_j(\mathcal{C})\). This gives the probability that a fate cluster \(\mathcal{C}\) originates from an initial state \(i\).

Parameters
adata : AnnData object

Assume to contain transition maps at adata.uns.

selected_fates : list, optional (default: all fates)

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

source : str, optional (default: ‘transition_map’)

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().

fate_count : bool, optional (default: False)

Used to determine the method for computing the fate potential of a state. If ture, just to count the number of possible fates; otherwise, use the Shannon entropy.

force_run : bool, optional (default: False)

Re-compute the fate map.

Returns

  • Fate map for each targeted fate cluster is updated at adata.obs[f’fate_map_{source}_{fate_name}’].

  • The accompanying parameters are saved at adata.uns[f”fate_map_{source}_{fate}”]