cospar.tl.get_normalized_covariance¶
-
cospar.tl.
get_normalized_covariance
(data, method='Weinreb')¶ Compute the normalized correlation of the data matrix.
For a given data matrix \(X_{il}\), where \(i\) can be a state id or a barcode id, while \(l\) is a id for fate cluster. We want to compute the coupling \(Y_{ll'}\) between two fate clusters.
If method=’SW’: we first obtain \(Y_{ll'}=\sum_i X_{il}X_{il'}\). Then, we normalize the the coupling: \(Y_{ll'}\leftarrow Y_{ll'}/\sqrt{Y_{ll}Y_{l'l'}}\).
If method=’Weinreb’, we first compute the mean over variable \(i\), i.e., \(X^*_l\). Then, the covariance: \(Y_{ll'}=\sum_i (X_{il}-X^*_l)(X_{il'}-X^*_{l'})\). Finally, normalization by mean: \(Y_{ll'}\leftarrow Y_{ll'}/(X^*_lX^*_{l'})\). This method is developed to infer lineage coupling from clonal data (Weinreb & Klein, 2021, PNAS).
- Parameters
- data : np.array, shape (n_obs, n_fates)
An observation matrix for the fate distribution. The observable could be the number of barcodes in each fate, or the probability of a cell to enter a fate.
- method : str, optional (default: ‘Weinreb’)
Method for computing the normalized covariance. Choice: {‘Weinreb’, ‘SW’}
- Returns
Normalized covariance matrix.