mantispy.tl.transport#
- mantispy.tl.transport(adata, by='Metadata_Plate', groupby='Metadata_Perturbation', reference='negcon', use_rep=None, weight='activity', min_shared=3, threshold=0.05, key_added='transport', copy=False)#
Test whether each perturbation’s effect reproduces across settings.
- Parameters:
adata (
AnnData) – Well-level profiles. Each setting needs its own reference wells, since effects are measured against them; settings with fewer than two are left out.by (
str|list[str] (default:'Metadata_Plate')) –obscolumn defining the setting, or a list of columns from coarsest to finest.["Metadata_Source", "Metadata_Plate"]reports agreement between plates of one source separately from agreement between sources, and the difference shows what a change of laboratory costs beyond a change of plate. The finest level defines the units that are compared.groupby (
str(default:'Metadata_Perturbation')) – The perturbation column.reference (
str|None(default:'negcon')) – Which rows are the negative controls, per setting.use_rep (
str|None(default:None)) – Scoreobsm[use_rep]instead ofX.weight (
str(default:'activity')) –"activity"weights each comparison by the smaller of the two effect magnitudes, since the correlation of an inactive perturbation is noise."equal"weights all comparisons the same.min_shared (
int(default:3)) – Minimum number of shared perturbations for a pair of units to be compared.threshold (
float(default:0.05)) – q-value cutoff fortransports. The null uses every mismatched pair of perturbations, so there is no null size or seed to set.key_added (
str(default:'transport')) – Name for the outputs.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]with one row pergroupandleveland the columnsn_pairs,agreement,pvalue,qvalueandtransports. Writesuns["mantispy"][key_added + "_units"], the units-by-units agreement matrix drawn bysetting_agreement(), and joins the finest level’s agreement back onto the rows asobs[key_added + "_agreement"].- Raises:
ValueError –
weightis not one ofWEIGHTS, the unit column has a single level, or fewer than two settings have at least two reference rows.KeyError –
obshas no column named byby.
Notes
The null pairs a perturbation at one unit with a different perturbation at another, so a screen in which all effects look alike does not count as reproducing. This matters on screens with few mechanisms. The mismatched null centers at +0.26 on BBBC021 and at +0.03 on JUMP.
The null is computed in full rather than sampled. Standardizing the effect vectors turns all group-against-group correlations into one matrix product, so 301 groups over 48 unit pairs give 90,300 null values in about a second. A sampled null would floor the p-values at
1/(n + 1), too coarse for Benjamini-Hochberg over every(group, level)row, and the number of groups called would depend on the number of draws.This is an observational measure. It shows whether an effect reproduced at another site, not what the effect would have been there.