mantispy.tl.dose_response#
- mantispy.tl.dose_response(adata, compound_key='Metadata_Compound', dose_key='Metadata_Concentration', response='hits_distance', min_doses=4, min_r_squared=0.8, key_added='dose_response', copy=False)[source]#
Test whether each compound’s response grows with concentration.
Each compound gets two results. The Spearman correlation between dose and response tests for a monotonic trend, makes no assumption about shape and works with three doses. A four-parameter logistic fit adds an EC50 and a Hill slope, and is only attempted with at least
min_dosesdistinct doses.fit_okis True only when the fit succeeded, the curve explains the data (r_squared >= min_r_squared) and the EC50 lies inside the tested dose range. Four parameters converge on almost any five or six points. On pure noise the optimizer succeeds 59 times in 60, and these checks reduce that to 12 in 200 without losing real curves. Readspearmanand its q-value first.- Parameters:
adata (
AnnData) – Object carrying a compound, a dose and a per-row response.compound_key (
str(default:'Metadata_Compound')) –obscolumn holding the compound identity.dose_key (
str(default:'Metadata_Concentration')) –obscolumn holding the concentration. Doses must be positive; rows with a zero dose, such as vehicle, are dropped, since the fit is in log dose.response (
str(default:'hits_distance')) –obscolumn holding the per-row response, normally the distance written byhit_calling().min_doses (
int(default:4)) – Distinct doses below which the curve is skipped and only the trend is reported.min_r_squared (
float(default:0.8)) – Coefficient of determination a fit needs before it is marked ok.key_added (
str(default:'dose_response')) – Name for the output table.copy (
bool(default:False)) – Return a modified copy instead of mutating in place.
- Return type:
- Returns:
None, or the modified copy. Writesuns["mantispy"][key_added]withcompound,n_doses,spearman,pvalue,qvalue,ec50,hill_slope,bottom,top,r_squaredandfit_ok.bottomandtopare the fitted asymptotes. For a decreasing response, such as an inhibitor’s,bottomis greater thantop.
Notes
Compounds with fewer than two usable doses are left out of the table.
An EC50 outside the tested doses is an extrapolation, usually from a curve that has not plateaued within the tested range, and its row has
fit_ok=False. Compareec50against the dose range before quoting it.