Fit Dose Response Curves#

xynergy.fit.add_uncombined_drug_responses(df: DataFrame, dose_cols: list[str] = ['dose_a', 'dose_b'], response_col: str = 'response', experiment_cols: list[str] | str | None = 'experiment_id', suffix='_resp', fit: bool = True, log: str = 'all')#

Add columns that contain responses if just drug A (or drug B) alone was added at their respective dose_cols concentration.

Parameters#

df: polars.DataFrame

Usually the output from tidy

dose_cols: list, default [“dose_a”, “dose_b”]

A list of exactly two columns names that contain untransformed numeric values of agent dose

response_col: string, default “response”

The name of the column containing responses

experiment_cols: list[str], string, or None, default “experiment_id”

The names of columns that should be used to distinguish one dose pair’s response from another. If none are supplied, two rows with the same doses will be considered replicates.

suffix: string, default “_resp”

The suffix to give the uncombined drug response columns. By default, resultant columns will be of the form dose_cols + suffix

fit: bool, default True

Should the returned values should be fitted values predicted at that concentration, or just the raw, observed values at that point?

log: string, default “all”

Verbosity of function. Options include “all”, “warn”, and “none”.

  • If “all”, will emit notes and warnings.

  • If “warn”, will emit only warnings.

  • If “none”, will not emit anything (except errors)

Returns#

polars.DataFrame

Similar to input, with two additional columns dose_a_resp and dose_b_resp (name depends on the name of dose_cols as well as suffix), that correspond with expected response of drug A (or B) at that given concentration.

xynergy.fit.fit_individual_drugs(df: DataFrame, dose_cols: list[str] = ['dose_a', 'dose_b'], response_col: str = 'response', experiment_cols: str | list[str] | None = ['experiment_id'], log: str = 'all')#

Fit individual drugs per experimental group from a tidy polars.DataFrame. Preferably will fit Drug A where dose_b = 0 (and vice-versa), but if no conditions exist where dose_b = 0, chooses the lowest concentration and warns.

Parameters#

df: polars.DataFrame

Usually the output from tidy

dose_cols: list, default [“dose_a”, “dose_b”]

A list of exactly two columns names that contain untransformed numeric values of agent dose

response_col: string, default “response”

The name of the column containing responses

experiment_cols: list[str], string, or None, default “experiment_id”

The names of columns that should be used to distinguish one dose pair’s response from another. If none are supplied, two rows with the same doses will be considered replicates.

log: string, default “all”

Verbosity of function. Options include “all”, “warn”, and “none”.

  • If “all”, will emit notes and warnings.

  • If “warn”, will emit only warnings.

  • If “none”, will not emit anything (except errors)

Returns#

polars.DataFrame

Number of rows equal to the number of experimental groups in df, with the following columns:

  • Columns included in experiment_cols

  • Parameters of each fit: slope, max, min, ic50

  • drug

    Which drug the fit refers to. Will use them names provided in dose_cols.