liana.method.process_scores#
- liana.method.process_scores(liana_res, score_key, inverse_fun=<function DefaultValues.inverse_fun>)#
Processes and outputs a given score.
- Parameters:
liana_res (
DataFrame) –liana_resaDataFramein liana’s format.score_key (
str) – Column name of the score inliana_res. If None, the score is inferred from the method.inverse_fun (
Callable(default:<function DefaultValues.inverse_fun at 0x760ec1da6520>)) – Function applied to scores for which a lower value is the stronger one – p-values and aggregate ranks such asmagnitude_rank– so that “higher is stronger” holds throughout. Defaults to-log10(x + eps). Which scores are inverted is decided byliana.method.get_method_scores, so this is handled automatically for liana’s own scores.
- Return type:
DataFrame- 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_fun. A score that is already “higher is stronger” is returned unchanged:>>> import liana as li >>> adata = li.testing.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')