Data and fitting#

The core workflow starts with validated dose-response observations and passes them to a registered model through the fitting interface.

DoseResponseData#

class bindcurve.DoseResponseData[source]#

Bases: object

Validated long-form dose-response observations.

__init__(table, metadata=None)[source]#
Parameters:
Return type:

None

property table: DataFrame#

Return an isolated copy of the validated canonical table.

property metadata: dict#

Return an isolated copy of dataset metadata.

classmethod from_dataframe(df, *, format='long', compound_col='compound_id', concentration_col='concentration', response_col='response', experiment_col='experiment_id', replicate_col='replicate_id', sigma_col='sigma', weight_col='weight', replicate_cols=None, replicate_prefix='response_', metadata=None)[source]#

Create a validated data object from a long- or wide-form DataFrame.

Parameters:
  • df (DataFrame)

  • format (Literal['long', 'wide'])

  • compound_col (str)

  • concentration_col (str)

  • response_col (str)

  • experiment_col (str)

  • replicate_col (str)

  • sigma_col (str | None)

  • weight_col (str | None)

  • replicate_cols (list[str] | None)

  • replicate_prefix (str)

  • metadata (dict | None)

Return type:

DoseResponseData

classmethod from_csv(path, *, format='long', compound_col='compound_id', concentration_col='concentration', response_col='response', experiment_col='experiment_id', replicate_col='replicate_id', sigma_col='sigma', weight_col='weight', replicate_cols=None, replicate_prefix='response_', metadata=None, **read_csv_kwargs)[source]#

Create data from a CSV file.

Supported formats are "long" and "wide".

Parameters:
  • path (str)

  • format (Literal['long', 'wide'])

  • compound_col (str)

  • concentration_col (str)

  • response_col (str)

  • experiment_col (str)

  • replicate_col (str)

  • sigma_col (str | None)

  • weight_col (str | None)

  • replicate_cols (list[str] | None)

  • replicate_prefix (str)

  • metadata (dict | None)

Return type:

DoseResponseData

classmethod from_json(source, *, format=None, compound_col='compound_id', concentration_col='concentration', response_col='response', experiment_col='experiment_id', replicate_col='replicate_id', sigma_col='sigma', weight_col='weight', replicate_cols=None, replicate_prefix='response_', metadata=None)[source]#

Create data from a JSON string or JSON file.

Parameters:
  • source (str | Path)

  • format (Literal['long', 'wide'] | None)

  • compound_col (str)

  • concentration_col (str)

  • response_col (str)

  • experiment_col (str)

  • replicate_col (str)

  • sigma_col (str | None)

  • weight_col (str | None)

  • replicate_cols (list[str] | None)

  • replicate_prefix (str)

  • metadata (dict | None)

Return type:

DoseResponseData

to_dataframe(*, format='long', compound_col='compound_id', concentration_col='concentration', response_col='response', experiment_col='experiment_id', replicate_col='replicate_id', replicate_prefix='response_')[source]#

Serialize the data object to a long- or wide-form DataFrame.

Parameters:
  • format (Literal['long', 'wide'])

  • compound_col (str)

  • concentration_col (str)

  • response_col (str)

  • experiment_col (str)

  • replicate_col (str)

  • replicate_prefix (str)

Return type:

DataFrame

to_csv(path=None, *, format='long', compound_col='compound_id', concentration_col='concentration', response_col='response', experiment_col='experiment_id', replicate_col='replicate_id', replicate_prefix='response_', index=False, **to_csv_kwargs)[source]#

Serialize the data object to CSV.

Parameters:
  • path (str | Path | None)

  • format (Literal['long', 'wide'])

  • compound_col (str)

  • concentration_col (str)

  • response_col (str)

  • experiment_col (str)

  • replicate_col (str)

  • replicate_prefix (str)

  • index (bool)

Return type:

str | None

to_json(path=None, *, format='long', compound_col='compound_id', concentration_col='concentration', response_col='response', experiment_col='experiment_id', replicate_col='replicate_id', replicate_prefix='response_', **json_kwargs)[source]#

Serialize the data object to JSON.

Parameters:
  • path (str | Path | None)

  • format (Literal['long', 'wide'])

  • compound_col (str)

  • concentration_col (str)

  • response_col (str)

  • experiment_col (str)

  • replicate_col (str)

  • replicate_prefix (str)

Return type:

str | None

summary()[source]#

Represent compound-level dataset summaries as a DataFrame.

Return type:

DataFrame

keep_only(selectors)[source]#

Return a new dataset containing only the selected compounds.

Parameters:

selectors (str | int | Iterable[str | int])

Return type:

DoseResponseData

remove(selectors)[source]#

Return a new dataset with the selected compounds removed.

Parameters:

selectors (str | int | Iterable[str | int])

Return type:

DoseResponseData

classmethod concatenate(*datasets)[source]#

Return a new dataset created by concatenating multiple datasets.

Parameters:

datasets (DoseResponseData)

Return type:

DoseResponseData

quality_report(*, compounds=None, thresholds=None)[source]#

Return compound-level quality-control metrics for the dataset.

Parameters:
Return type:

DataFrame

quality_dashboard(*, compounds=None, thresholds=None, figsize=None)[source]#

Return a graphical dashboard summarizing data-level QC.

Parameters:
Return type:

matplotlib.figure.Figure

property compounds: list[str]#

Return sorted compound identifiers.

resolve_compounds(selectors=None)[source]#

Resolve, validate, and stably deduplicate compound selectors.

Parameters:

selectors (str | int | Iterable[str | int] | None)

Return type:

list[str]

select_compound(compound_id)[source]#

Return a view containing observations for one compound.

Parameters:

compound_id (str)

Return type:

CompoundData

validate()[source]#

Validate the dose-response data schema and basic numerical assumptions.

Return type:

None

FitSettings#

class bindcurve.FitSettings[source]#

Bases: object

Settings controlling dose-response fitting.

__init__(lmfit_method='leastsq', errors='raise', max_nfev=None)#
Parameters:
  • lmfit_method (str)

  • errors (Literal['raise', 'collect'])

  • max_nfev (int | None)

Return type:

None

fit#

bindcurve.fit(data, *, model='ic50', settings=None, compounds=None, fixed=None, bounds=None)[source]#

Convenience function for fitting a registered model to dose-response data.

Parameters:
Return type:

FitResults