Points of departure#
At what dose each cell type responds, read from the benchmark doses of its genes under several rules side by side, and the benchmark doses of gene sets; Points of departure explains the rules and the random gene sets beside them.
At what dose does a cell type respond? Transcriptomic points of departure (tPODs) from the benchmark doses of its genes.
A dose series gives each responding gene a benchmark dose (BMD). A toxicologist reports
one potency per tissue, here per cell type, read from those BMDs by a rule: the most
sensitive gene set (NTP 2018; US EPA 2024), a percentile of the BMDs, their first mode
or their lowest consistent response dose (Reardon et al. 2023). Rules applied to the
same gene BMDs differed by a median of 0.84 to 1.87 log10 units per chemical (Reardon
et al. 2023), so points_of_departure() gives them side by side, with
random gene sets of the real sets’ sizes beside the gene-set rules (Costa et al. 2024).
gene_set_benchmark_doses() rolls up any table of gene BMDs into gene
sets. The rules, the null and how to read them are in
https://docs.nygen.io/CytePool/statistics/potency#points-of-departure.
References
NTP (2018). NTP research report on National Toxicology Program approach to genomic dose-response modeling. NTP Research Report 5. National Institute of Environmental Health Sciences. doi:10.22427/ntp-rr-5
US EPA (2024). Standard Methods for Development of EPA Transcriptomic Assessment Products (ETAPs). EPA/600/X-23/083, US Environmental Protection Agency, Office of Research and Development. doi:10.23645/epacomptox.25365496
Reardon AJF, Farmahin R, Williams A, Meier MJ, Addicks GC, Yauk CL, Matteo G, Atlas E, Harrill J, Everett LJ, Shah I, Judson R, Ramaiahgari S, Ferguson SS, Barton-Maclaren TS (2023). From vision toward best practices: evaluating in vitro transcriptomic points of departure for application in risk assessment using a uniform workflow. Frontiers in Toxicology 5, 1194895. doi:10.3389/ftox.2023.1194895
Costa E, Johnson KJ, Walker CA, O’Brien JM (2024). Transcriptomic point of departure determination: a comparison of distribution-based and gene set-based approaches. Frontiers in Genetics 15, 1374791. doi:10.3389/fgene.2024.1374791
- cytepool.points_of_departure(result, *, gene_sets=None, rules=None, id_column='feature_id', study_rule=None, without_top_dose=False, n_random_collections=1000, rng=None)#
Read each cell type’s transcriptomic point of departure (tPOD) from the benchmark doses of its genes, under several rules side by side.
The genes that enter, per cell type: with a rule set (
dose_response(..., rules="ntp_2018")or"etap_2024"), the genes its table"rule_set"accepts, at the document’s benchmark response; otherwise the genes that pass the gate whose BMD at the first benchmark response lies below the top dose, whose fit p-value (BMDS’s test 4,fit_p_value) lies above 0.1 and whose BMDL lies above 0, the checks both documents make (a BMDL of 0 marks a bound not estimated). The result’s own flags (flags=ofdose_response) are not read on that path: rundose_responsewithrules="ntp_2018"or"etap_2024"for a document’s acceptance. Each gene’s id comes from the cube’s features columnid_column; features without an id are left out, and features sharing an id are averaged into one gene, as ETAP averages a gene’s probes (US EPA 2024, Sec. 3.4.5.4).The rules (https://docs.nygen.io/CytePool/statistics/potency#points-of-departure):
"ntp_2018", the median BMD of the active gene set of lowest median BMD (NTP 2018), reported as “<” a tenth of the lowest dose below it;"etap_2024", the median BMDL of the set of 3 genes or more of lowest median BMD, no value when that median BMD lies more than 3-fold below the lowest dose (US EPA 2024);"5th_percentile","25th_gene","first_mode"and"lowest_consistent_response_dose"(Reardon et al. 2023), which need 25 genes (Costa et al. 2024). Beside the gene-set rules, random collections keep the number of sets and each set’s measured genes and draw the genes at random (Costa et al. 2024): a real tPOD near theirs says little about the sets. Each cell type’s 1,000 collections of 10,000 sets take about 9 s on one core.- Parameters:
result – A result of
dose_response()with benchmark doses: run withrules, or withmodelsandbmr. It must keep its cube.gene_sets – A
GeneSetsor a mapping of set name to gene ids, named asid_columnnames genes; needed by the gene-set rules.rules – A rule or a list of them among
"ntp_2018","etap_2024","5th_percentile","25th_gene","first_mode"and"lowest_consistent_response_dose"; None for each rule the inputs allow, the gene-set rules only withgene_sets.id_column – The cube’s features column that names each feature’s gene, as the sets name genes, such as
"symbol".study_rule – None for no value for the study, or
"lowest"(study): for"ntp_2018"and"etap_2024", the document’s choice across cell types, the set of lowest median BMD in any cell type, with that cell type’s limit or no value, as ETAP chooses across tissues; for the other rules, the lowest cell type’s value. A minimum over more cell types is lower in expectation, so the table counts them.without_top_dose – True runs the analysis again without each cell type’s top dose, with every setting of the result, and gives the points of departure of those runs (
without_top_dose); a cell type needs 3 treated doses.n_random_collections – The random collections per cell type, 0 for none.
rng – A numpy random generator, an integer seed, or None, for the random collections. The seed, given or drawn, is recorded in
settings["seed"]; each cell type draws from it and the CRC-32 of its name, so that its collections depend neither on the other cell types nor on the order of the features.
- Returns:
The points of departure, with each cell type’s genes and gene sets.
- Raises:
TypeError – If
resultis not aDoseResponseResult, an argument has the wrong type, or is or holds a numpy masked array.ValueError – If the result tests pathway scores or activities, has no benchmark doses or keeps no cube; a rule is unknown or repeated, or a gene-set rule is asked for without
gene_sets;id_columnis not a column of the cube’s features; no gene of any set is measured;study_ruleis unknown; orn_random_collectionsis negative.
Used in: Dose response per cell type
Explained in: Choosing a method, Potency and points of departure
- class cytepool.PointsOfDeparture(summary, tables, provenance, *, result=None, gene_sets=None, study=None, without_top_dose=None)#
Each cell type’s transcriptomic points of departure (tPODs) under several rules, from
points_of_departure().summaryhas one row per cell type and rule, cell types in the result’s order and rules as asked:group_id;rule;point_of_departure, the dose, NaN without one;status:"within the doses","below the lowest dose","below a tenth of the lowest dose"(NTP’s report of a set whose median BMD lies below a tenth of the lowest dose, given as that tenth, a limit),"no value"or"not analysed";reason, why there is no value, empty for a value;n_genes_entered, the cell type’s genes that entered the rules (NaN where not analysed);gene_set, the set a gene-set rule chose, with the sets tied with it joined by “; “, also where ETAP has no value because its median BMD lies more than 3-fold below the lowest dose, empty otherwise;n_active_gene_sets, the sets that met the rule’s criteria (NaN for the other rules);median_bmd,median_bmdlandmedian_bmdu, the chosen set’s medians as its document reports them (NaN under NTP’s report of a limit, and for the other rules);n_genes_in_first_mode, for the first mode, the genes of its peak, those below the density’s next minimum (NaN for the other rules);lowest_doseandtop_dose, the lowest positive and the highest dose of the cell type’s curves;random_collections_point_of_departure, the median of the rule’s value over random collections where at least half of them give one (Costa et al. 2024), which can be NTP’s limit of a tenth of the lowest dose;share_of_random_collections_with_a_value; andrandom_collections_p_value, (1 + b) / (1 + R) for the b of the R collections whose value is at most the real one. A collection without a value counts as above every value, and one where ETAP finds the lowest median BMD more than 3-fold below the lowest dose as below every value, so the p-value of a real set in that case is the share of collections in it; the p-value is NaN where the real rule has no value otherwise. The random columns are NaN for the rules without gene sets and without random collections.table()gives a cell type’s genes and gene sets.studygives one value per rule for the study, withstudy_rule, andwithout_top_dosethe points of departure of runs without each cell type’s top dose, when asked for. Built bypoints_of_departure(), which keeps the analysis (result) and the gene sets forpermutation_check(); immutable.- Raises:
TypeError – If
summaryis not aTable,tablesnot a mapping of (cell type, table name) toTable,provenancenot a mapping that JSON can write,resultnot aDoseResponseResult,gene_setsnot aGeneSets,studynot aTableorwithout_top_dosenot aPointsOfDeparture.ValueError – If
provenanceholds a NaN or an infinity.
Explained in: Dose response, Potency and points of departure
- property summary#
One row per cell type and rule, holding the point of departure, its status, the genes and gene set it comes from and the random collections’ values.
Explained in: Potency and points of departure
- property study#
One row per rule, the value for the study by
study_rule, holdingrule,study_rule,point_of_departure,status,reason,group_id, the cell type whose value it is,gene_set,n_cell_typesin the analysis andn_cell_types_compared, the cell types whose chosen sets, or values for the other rules, the rule compared; None without a study rule.
- property without_top_dose#
The points of departure of the analysis run again without each cell type’s top dose, with the same rules and gene sets and without random collections; None unless asked for.
- property result#
The analysis whose benchmark doses the rules read; None for the runs without the top dose and for a rebuilt object that was given none.
- property gene_sets#
The gene sets as given, None without.
- property settings#
The settings
rules,genes(whose genes entered),id_column,study_rule,without_top_dose(whether runs without the top dose were asked for),n_random_collections,seedandtop_dose_left_out, None but in the runs without the top dose, where it gives each cell type’s top dose that its run left out; 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 gene sets (their collection’s name, version, licence, file and SHA-256, the sets given, the sets with a measured gene, and the measured genes of any set); the analysis (its cube’s fingerprint and settings); and, for each cell type (
groups), whether it was analysed and why not, its doses, lowest and top dose, the features that entered, those without an id, the genes they gave, the genes of several features, the genes in a gene set, and the seconds the cell type took (run_time). It also holds the run’srun_time: its start (started_at, UTC), the seconds of the runs without the top dose (without_top_dose, when asked for) and of the whole call (total).
- table(group=None, name=None)#
Return a cell type’s genes or gene sets.
"genes": the genes that entered the rules, sorted by BMD, then id: the id column (feature_idby default),n_features(features averaged into the gene),bmd,bmdlandbmdu."gene_sets": the cell type’s roll-up, asgene_set_benchmark_doses()gives it, withbelow_a_tenth_of_lowest_dose, the sets whose median BMD NTP reports as “<” a tenth of the lowest dose.
- Parameters:
group – A cell type; it may be left out when there is one.
name –
"genes"or"gene_sets".
- Raises:
ValueError – If
groupis left out and there are several cell types, ornameis left out.TypeError – If
groupornameis not a string.KeyError – If the cell type is not in the summary or was not analysed, the table is unknown, or
"gene_sets"is asked for without gene sets.
Explained in: Potency and points of departure
- cytepool.gene_set_benchmark_doses(genes, gene_sets, *, measured_genes, id_column='feature_id')#
Roll up gene benchmark doses into gene sets: each set’s genes, coverage and median BMD, BMDL and BMDU, with NTP’s and ETAP’s criteria.
Rows that share a gene id are averaged into one gene, as ETAP (US EPA 2024, Sec. 3.4.5.4) and BMDExpress average a gene’s probes. Each set counts its genes among
measured_genes, BMDExpress’s “All Genes (Platform)”, and the genes of the table among them; a set’s coverage is the share of its measured genes in the table, NTP’s “total annotated gene number” (NTP 2018, p. 9). Sets without a measured gene are left out. https://docs.nygen.io/CytePool/statistics/potency#gene-set-benchmark-doses explains the roll-up.- Parameters:
genes – A
Tableor pandas DataFrame of the genes whose BMDs roll up, one row per feature: the columnid_column(gene ids as text),bmd(finite, above 0),bmdl(finite, above 0 and at most the BMD) andbmdu(at least the BMD; infinity where the bound reaches the search’s end).gene_sets – A
GeneSetsor a mapping of set name to gene ids, named as the id column names genes.measured_genes – The ids of every gene measured, such as the features of a platform; every id of
genesmust be among them. Missing ids (None, NaN or empty) are ignored.id_column – The column of
genesthat holds the gene ids.
- Returns:
One row per set holding a gene of the table, ordered by median BMD, then median BMDL, then more genes, then higher coverage, then the collection’s order:
gene_set,n_genes(genes of the table),n_genes_measured,percent_coverage(100n_genes/n_genes_measured),median_bmd,median_bmdl,median_bmdu(the mean of the two middle values for an even count),active_ntp_2018(at least 3 genes and at least 5% coverage),active_etap_2024(at least 3 genes) andgenes(the set’s genes of the table, in the set’s order, joined by “; “).- Raises:
TypeError – If
genesis not aTableor DataFrame,gene_setsnot aGeneSetsor mapping,id_columnnot a str, an id not text, a value not a number, or an argument is or holds a numpy masked array.ValueError – If
geneslacks a column or has no row, an id is missing, a value is out of range or out of order, an id is not amongmeasured_genes, no gene of any set is measured, orgene_setsis empty.
Explained in: Choosing a method, Potency and points of departure