pyproteonet.metrics.ratios.calculate_sample_pair_ratios
- pyproteonet.metrics.ratios.calculate_sample_pair_ratios(dataset: Dataset, molecule: str, columns: str | List[str], numerator_samples: List[str], denominator_samples: List[str], calculate_log2_ratio: bool = False, ids: Index | None = None, is_log: bool = False) DataFrame
- Given a set of numerator and denominator samples, calculate the ratio of the numerator to the denominator for each possible pair of samples.
Can be used to calculate abundance ratios or fold changes between pairs of two samples.
- Parameters:
dataset (Dataset) – The dataset to calculate ratios for.
molecule (str) – The molecule type to calculate ratios for.
columns (Union[str, List[str]]) – The value column(s) to calculate ratios for.
numerator_samples (List[str]) – List of samples names to use as nominator when computing ratios.
denominator_samples (List[str]) – List of samples names to use as denominator when computing ratios.
calculate_log2_ratio (bool, optional) – Whether to calculate the log2 ratio instead of the ratio. Defaults to False.
ids (Optional[pd.Index], optional) – If given, only consider molecules with these ids. Defaults to None.
is_log (bool, optional) – Whether the given columns are log transformed and need to be transformed back for ratio calculation. Defaults to False.
- Returns:
The calculated ratios.
- Return type:
pd.DataFrame