liana.mt.process_scores#
- liana.mt.process_scores(liana_res, score_key, inverse_fn=<function DefaultValues.inverse_fn>)#
Processes and outputs a given score.
- Parameters:
- liana_res
DataFrame liana_resaDataFramein liana’s format.- score_key
str Column name of the score in
liana_res. If None, the score is inferred from the method.- inverse_fn
Callable[[Series],Series] (default:<function DefaultValues.inverse_fn at 0x7e3fdb8699e0>) Function applied to scores for which a lower value is the stronger one – p-values and aggregate ranks such as
magnitude_rank– so that “higher is stronger” holds throughout. Defaults to-log10(x + eps). Which scores are inverted is decided byliana.mt.get_method_scores, so this is handled automatically for liana’s own scores.
- liana_res
- Return type:
- Returns:
A
DataFramewith the processed scores.
Examples
magnitude_rankis one of the scores for which a lower value is the stronger one, so it is inverted withinverse_fn. A score that is already “higher is stronger” is returned unchanged:>>> import liana as li >>> adata = li.ds.generate_toy_adata() >>> li.mt.rank_aggregate(adata, groupby="bulk_labels", n_perms=None) >>> res = li.mt.process_scores(adata.uns["liana_res"], score_key="magnitude_rank")