Leave-one-out checks#
How far each cell type’s points of departure move when its analysis runs again without each of its samples, and which samples’ runs give the lowest and the highest values; Does one sample drive a point of departure? explains the check and how to read it.
Does one sample drive a point of departure? Each cell type’s analysis run again without each of its samples.
Genes enter a cell type’s point of departure through a gate and the checks of its
curves, so the value can rest on genes that one animal’s profile pushes through.
Filtering genes on significance before modelling shifted benchmark doses lower, and
filters after the fit can bias the distribution of benchmark doses that the rules
read (Webster et al. 2015; O’Brien et al. 2025), so bounds computed from the genes
that survived, as if they had been chosen at random, are too narrow.
leave_one_out_check() runs each cell type’s whole analysis again
without each sample it used, with every setting of the result, reads the same rules,
and gives how far each point of departure moves and without which sample
(https://docs.nygen.io/CytePool/statistics/potency#leave-one-out-check).
References
Webster AF, Chepelev N, Gagné R, Kuo B, Recio L, Williams A, Yauk CL (2015). Impact of genomics platform and statistical filtering on transcriptional benchmark doses (BMD) and multiple approaches for selection of chemical point of departure (PoD). PLOS ONE 10, e0136764. doi:10.1371/journal.pone.0136764
O’Brien JM, Mitchell CA, Auerbach SS, et al. (2025). Bioinformatic workflows for deriving transcriptomic points of departure: current status, data gaps, and research priorities. Toxicological Sciences 203, 147-159. doi:10.1093/toxsci/kfae145
Ewald JD, Basu N, Crump D, Boulanger E, Head J (2022). Characterizing variability and uncertainty associated with transcriptomic dose-response modeling. Environmental Science & Technology 56, 15960-15968. doi:10.1021/acs.est.2c04665
- cytepool.leave_one_out_check(points_of_departure, *, groups=None, samples=None)#
Run each cell type’s analysis again without each of its samples, and give how far its points of departure move and without which sample.
The genes that enter a point of departure pass a gate and the checks of their curves, and the rules read the few of them with the lowest benchmark doses, so a value can rest on genes that one animal’s profile pushes through. Filtering genes on significance before modelling shifted benchmark doses lower, and filters after the fit can bias the distribution of benchmark doses that the rules read (Webster et al. 2015; O’Brien et al. 2025), so bounds computed from the genes that survived, as if they had been chosen at random, are too narrow. For each cell type, the check runs
dose_response()again on the design’s samples without one of the samples the cell type used, with every setting of the result (its gate, its curves, benchmark responses and averaging, or its rule set, and its seed and batch), reads the same rules with the same gene sets and id column, without random collections, and does so for each sample in turn (https://docs.nygen.io/CytePool/statistics/potency#leave-one-out-check). The summary gives, for each cell type and rule, the lowest and the highest value of the runs and the samples whose runs gave them, and how often the runs give a value. Before the runs, each cell type runs once with every sample and must give its points of departure again: the same number of genes entered, values equal up to a relative 1e-9 and the same statuses, so that the runs are the analysis the points record.Each run is the analysis of real samples, so a run whose remaining samples alias a dose with the batch, lose the vehicle, or fall short of a rule set’s minimums reads as the analysis would: under ETAP, a run without one of 3 vehicle samples is not modelled, and a run without one sample of a pair at a dose leaves that dose out, so the runs without either sample of the pair are the same analysis. Such runs show how close the design sits to the minimums, which
check_dose_design()reports without any run, and the table gives each run’s dose groups, lowest and top dose, so that a run whose curves lack a dose shows it. A run whose remaining doses cannot hold a recorded setting (aspline_df, or the gate’s spline or MCP test) is not made, and counts as a run without a value, with the reason.The range of the runs is not a confidence interval: leaving out one sample measures each sample’s influence through every stage, the gate’s calls included, and not the spread of repeated studies. A sample whose run moves a value more than the others, or removes it, is one to inspect, with its cells and counts and its profile in
plot_dose_response(), and to leave out only for a reason recorded apart from the value: choosing the samples by the value they give moves the value towards the end chosen. Under a rule set Williams’ permutations, and underaveraging="akaike"the bootstrap of bounds, add Monte Carlo error to each run’s values: run the analysis at anotherrngto see how far that alone moves a value before reading a move as a sample’s. Each sample is taken as one replicate, a profile of one animal or well; several libraries of one animal would each be left out alone, which understates the animal’s influence.A cell type of n samples costs n + 1 analyses of it. On two threads one analysis takes about 40 s per 10,000 genes on the gate’s path; about 90 s per cell type of the guide’s TCDD livers under ETAP, whose Williams’ permutations run again in each run; and about 3 minutes per 200 genes through the gate with
averaging="akaike"and"epa", whose bootstrap runs again.samplesruns the samples named alone.- Parameters:
points_of_departure – The
PointsOfDepartureof a result ofdose_response(), aspoints_of_departure()returned them, keeping their analysis.groups – A cell type of the points of departure or a list of them; all by default. A cell type whose points of departure were not analysed is not checked, with the reason.
samples – A sample id of the analysis’s design or a list of them, each left out in a run of its own; None (default) for every sample each cell type used. A sample named that a cell type did not use is skipped there, and a cell type that used none of the samples named is not checked, with the reason.
- Returns:
The summary of each cell type and rule, each cell type’s runs, and a provenance record.
- Raises:
TypeError – If
points_of_departureis not aPointsOfDeparture, orgroupsorsamplesis not text or a list of text, or is or holds a numpy masked array.ValueError – If the points of departure keep no analysis,
groupsorsamplesis empty or names one twice, or a cell type run with every sample does not give its points of departure again.KeyError – If
groupsnames a cell type the points of departure do not hold, orsamplesa sample that is not in the analysis’s design.
Used in: Dose response per cell type
Explained in: Choosing a method, Potency and points of departure
- class cytepool.LeaveOneOutCheck(summary, tables, provenance)#
How far each cell type’s points of departure move when its analysis runs again without each of its samples, from
leave_one_out_check().summaryhas one row per cell type asked for and rule, cell types in the result’s order and rules in the order of the points of departure:group_id;rule;checked, whether the cell type ran without its samples;reason, why not, empty when checked;point_of_departure, the value checked, as the summary of thePointsOfDeparturegives it;n_dose_groups, the dose groups of the analysis’s curves, the vehicle included, andlowest_doseandtop_dose, their lowest positive and highest dose;n_runs, the samples left out, one run each (0 where not checked);share_of_runs_with_a_point_of_departure, the runs with a finite value over all runs;lowest_point_of_departureandhighest_point_of_departure, the lowest and the highest value of the runs; andsamples_left_out_at_lowestandsamples_left_out_at_highest, the sample left out in the run of that value, several joined by “; “ in the order of the runs where runs tie, empty without.A value is NaN without one. Where ETAP gives no value because the lowest median BMD of its sets lies more than 3-fold below the lowest dose,
point_of_departureis NaN, as in the points of departure, while the runs and the two ends give -inf: a potency below the doses, which random collections and permutation runs count below every value, so that such a run is a cell type’s lowest. The ends read every run that is not NaN; statistics of cell types not checked are NaN.table()gives a cell type’s runs, one row per sample left out, in the order of the cube’s samples, as the fit orders them:sample_id;dose;n_genes_passing_gate, NaN where the run’s gate did not run;n_genes_entered, the genes that entered the run’s rules, NaN where they read none;n_dose_groups,lowest_doseandtop_doseof the run’s curves, whose dose groups lack the dose of the sample left out where it was that dose’s only sample, or where ETAP leaves out a dose of fewer than 2 samples;reason, why no rule of the run has a value: why the run was not made, why its rules read no genes, or why no gene entered them, empty otherwise; and for each rule,point_of_departure_<rule>andreason_<rule>, why the rule has no value in the run, ETAP’s case of -inf included, empty for a value. Built byleave_one_out_check(); immutable.- Raises:
TypeError – If
summaryis not aTable,tablesnot a mapping of cell type toTable, orprovenancenot a mapping that JSON can write.ValueError – If
provenanceholds a NaN or an infinity.
Explained in: Potency and points of departure
- property summary#
One row per cell type and rule, with the value checked, the analysis’s doses, the runs, how often they give a value, and the lowest and highest value with the samples whose runs gave them.
Used in: Dose response per cell type
Explained in: Potency and points of departure
- property settings#
The settings
groupsandsamples, as given, as a new dict, also in the provenance.
- property provenance#
A JSON-serialisable record of what produced every number, as a new dict.
It holds the versions of the software; the settings; the result checked (
result): its cube’s fingerprint, its gate and its seed, which every run takes, and its settings and the analysis’s settings, the dose axis and its unit among them; the rules, the genes that enter them, the id column and the gene sets of the points of departure (points_of_departure); for every cell type asked for (groups), whether it was checked and why not, and for one whose points of departure were analysed, the samples it used (samples); for a cell type checked, the samples left out (left_out) and the seconds of the run with every sample and of the runs without one (run_time); and the check’srun_time.
- table(group=None)#
Return the runs of a cell type, one row per sample left out, with the columns the class documentation lists.
- Parameters:
group – A cell type that was checked; it may be left out when one cell type was asked for.
- Raises:
ValueError – If
groupis left out and several cell types were asked for.TypeError – If
groupis not a string.KeyError – If the cell type was not asked for or not checked; the message says why.
Used in: Dose response per cell type
Explained in: Potency and points of departure