#!/usr/bin/env python3 """Table 1 of Mannino, Caldo and Maffei (2026), J. Plant Physiol. 326, 154872 (p. 3), re-checked from its printed numbers, under RULES_table1_fulltext.txt and, for C6, RULES_table1_addendum.txt (written after a fresh review, post hoc). Standard library only; nothing is fetched or read. The paper is CC BY 4.0. The numbers below are typed from its Table 1 as printed: essential oil in mg per g dry weight, mean and SD, for the coil (hMF) and control (GMF) groups, each compound's share of the identified oil (Rel %) and the printed hMF/GMF ratio. Table 1 prints no n; the methods describe six plants per group (p. 2), so the tests are run at n = 6, and at n = 3 as a sensitivity case. The tests are for two independent groups, Student's t and Welch's t, two-sided; the paper doesn't say which of its tests Table 1 used (p. 3). A row is tested only if both its SDs are printed as numbers ("<0.01" isn't one): ten compound rows and the two totals. Run: python3 -I table1_recheck.py """ import json import math import sys # C1: all 20 compound rows, in the table's order: mass hMF, mass GMF (mg/g dry weight), Rel % hMF, Rel % GMF, and # the printed hMF/GMF ratio MASS_HMF = [0.57, 0.09, 0.02, 0.89, 0.07, 0.01, 0.01, 0.04, 0.03, 3.08, 0.07, 0.34, 0.02, 0.01, 0.20, 0.09, 0.07, 0.04, 0.04, 0.06] MASS_GMF = [0.42, 0.04, 0.02, 0.82, 0.06, 0.01, 0.01, 0.02, 0.02, 2.41, 0.05, 0.19, 0.02, 0.01, 0.13, 0.06, 0.05, 0.03, 0.03, 0.04] REL_HMF = [9.9, 1.6, 0.3, 15.5, 1.2, 0.2, 0.2, 0.7, 0.5, 53.6, 1.2, 5.9, 0.3, 0.2, 3.5, 1.6, 1.2, 0.7, 0.7, 1.0] REL_GMF = [9.5, 0.9, 0.5, 18.5, 1.4, 0.2, 0.2, 0.5, 0.5, 54.3, 1.1, 4.3, 0.5, 0.2, 2.9, 1.4, 1.1, 0.7, 0.7, 0.9] RATIO = [1.35, 2.19, 1.25, 1.09, 1.07, 1.05, 1.18, 1.47, 1.29, 1.28, 1.37, 1.79, 1.23, 1.04, 1.52, 1.67, 1.35, 1.27, 1.33, 1.34] # The totals: mass hMF, SD, mass GMF, SD, printed ratio; and Rel % of "Total identified" in "Total analysis" TOTALS = [ ("Total identified", 5.75, 0.53, 4.44, 0.38, 1.29), ("Total analysis", 7.53, 1.39, 5.97, 0.48, 1.26), ] IDENTIFIED_SHARE_PRINTED = (76.4, 74.4) # C2: rows tested: name, hMF mean, hMF SD, GMF mean, GMF SD TESTED = [ ("1,8-Cineole", 0.57, 0.02, 0.42, 0.04), ("cis-Ocimene", 0.09, 0.01, 0.04, 0.02), ("Linalool", 0.89, 0.17, 0.82, 0.12), ("Camphor", 0.07, 0.01, 0.06, 0.01), ("Eugenol", 3.08, 0.15, 2.41, 0.10), ("beta-Elemene", 0.07, 0.01, 0.05, 0.01), ("Methyl eugenol", 0.34, 0.05, 0.19, 0.02), ("trans-alpha-Bisabolene", 0.20, 0.04, 0.13, 0.02), ("beta-Cubebene", 0.09, 0.02, 0.06, 0.01), ("T-Cadinol", 0.06, 0.01, 0.04, 0.01), ] NOT_TESTABLE = ["trans-Sabinene hydrate", "alpha-Terpineol", "beta-Citronellol", "Bornyl acetate", "Bicycloelemene", "alpha-Bergamotene", "beta-Copaene", "gamma-Cadinene", "trans-Isoeugenol", "Cubenol"] # C3: the rows whose ratio Table 1 sets in bold, "significant (P < 0.05)" by its caption (read from the PDF's fonts) BOLD = {"1,8-Cineole", "cis-Ocimene", "Linalool", "Eugenol", "beta-Elemene", "Methyl eugenol", "trans-alpha-Bisabolene", "beta-Cubebene", "T-Cadinol", "Total identified", "Total analysis"} def betacf(a, b, x): """Continued fraction for the incomplete beta function (modified Lentz).""" m_max, eps, fpmin = 400, 3e-14, 1e-300 qab, qap, qam = a + b, a + 1.0, a - 1.0 c, d = 1.0, 1.0 - qab * x / qap d = fpmin if abs(d) < fpmin else d d = 1.0 / d h = d for m in range(1, m_max + 1): m2 = 2 * m aa = m * (b - m) * x / ((qam + m2) * (a + m2)) d = 1.0 + aa * d d = fpmin if abs(d) < fpmin else d c = 1.0 + aa / c c = fpmin if abs(c) < fpmin else c d = 1.0 / d h *= d * c aa = -(a + m) * (qab + m) * x / ((a + m2) * (qap + m2)) d = 1.0 + aa * d d = fpmin if abs(d) < fpmin else d c = 1.0 + aa / c c = fpmin if abs(c) < fpmin else c d = 1.0 / d de = d * c h *= de if abs(de - 1.0) < eps: break return h def betai(a, b, x): """Regularised incomplete beta function.""" if x <= 0.0: return 0.0 if x >= 1.0: return 1.0 bt = math.exp(math.lgamma(a + b) - math.lgamma(a) - math.lgamma(b) + a * math.log(x) + b * math.log(1.0 - x)) if x < (a + 1.0) / (a + b + 2.0): return bt * betacf(a, b, x) / a return 1.0 - bt * betacf(b, a, 1.0 - x) / b def p_two_sided(t, df): return betai(df / 2.0, 0.5, df / (df + t * t)) def student(m1, s1, m2, s2, n): t = abs(m1 - m2) / math.sqrt((s1 * s1 + s2 * s2) / n) return p_two_sided(t, 2 * n - 2) def welch(m1, s1, m2, s2, n): v1, v2 = s1 * s1 / n, s2 * s2 / n t = abs(m1 - m2) / math.sqrt(v1 + v2) df = (v1 + v2) ** 2 / (v1 * v1 / (n - 1) + v2 * v2 / (n - 1)) return p_two_sided(t, df) def worst_p(m1, s1, m2, s2, n, test): """C6: the largest P over the 16 corners of the rounding box (means and SDs +/- 0.005, no SD below 0.001).""" worst = 0.0 for dm1 in (-0.005, 0.005): for dm2 in (-0.005, 0.005): for ds1 in (-0.005, 0.005): for ds2 in (-0.005, 0.005): worst = max(worst, test(m1 + dm1, max(s1 + ds1, 0.001), m2 + dm2, max(s2 + ds2, 0.001), n)) return worst def bh(ps, q=0.05): """Benjamini-Hochberg at q: the indices of the rows that survive.""" m = len(ps) order = sorted(range(m), key=lambda i: ps[i]) k_max = 0 for rank, i in enumerate(order, 1): if ps[i] <= q * rank / m: k_max = rank return {order[r] for r in range(k_max)} def holm(ps, a=0.05): """Holm at a: the indices of the rows that survive.""" m = len(ps) out = set() for rank, i in enumerate(sorted(range(m), key=lambda i: ps[i])): if ps[i] <= a / (m - rank): out.add(i) else: break return out def main(): res = {"rules": "RULES_table1_fulltext.txt", "source": "Mannino, Caldo and Maffei (2026), J. Plant Physiol. 326, 154872, Table 1 (p. 3), as printed", "C1": {}, "C2": {}, "C4": {}} # C1 (a): printed ratios against the range rounding allows; rows numbered in the table's order off = [] rows = [(f"compound row {i + 1}", MASS_HMF[i], MASS_GMF[i], RATIO[i]) for i in range(len(RATIO))] rows += [(name, m1, m2, ratio) for name, m1, s1, m2, s2, ratio in TOTALS] for name, m1, m2, ratio in rows: lo, hi = (m1 - 0.005) / (m2 + 0.005), (m1 + 0.005) / (m2 - 0.005) if not lo - 1e-9 <= ratio <= hi + 1e-9: off.append([name, ratio, round(lo, 3), round(hi, 3)]) res["C1"]["printed_ratios_outside_rounding"] = off # (b) masses against "Total identified"; (c) Rel % sums; (d) each Rel % against mass over the total; (e) the share res["C1"]["mass_sums"] = {"hMF": round(sum(MASS_HMF), 2), "GMF": round(sum(MASS_GMF), 2), "printed_total_identified": [TOTALS[0][1], TOTALS[0][3]]} res["C1"]["rel_percent_sums"] = {"hMF": round(sum(REL_HMF), 1), "GMF": round(sum(REL_GMF), 1)} res["C1"]["rel_percent_mismatches"] = [ [f"compound row {i + 1}", grp, round(100 * m / tot, 2), r] for grp, masses, rels, tot in (("hMF", MASS_HMF, REL_HMF, TOTALS[0][1]), ("GMF", MASS_GMF, REL_GMF, TOTALS[0][3])) for i, (m, r) in enumerate(zip(masses, rels)) if abs(100 * m / tot - r) > 0.1 + 100 * 0.005 / tot] res["C1"]["identified_share_percent"] = {"hMF": round(100 * TOTALS[0][1] / TOTALS[1][1], 1), "GMF": round(100 * TOTALS[0][3] / TOTALS[1][3], 1), "printed": list(IDENTIFIED_SHARE_PRINTED)} # C2: the tests, at n = 6 and n = 3 res["C2"]["compound_rows_tested"] = len(TESTED) res["C2"]["not_testable"] = NOT_TESTABLE for n in (6, 3): out = [] for name, m1, s1, m2, s2 in TESTED + [(t[0], t[1], t[2], t[3], t[4]) for t in TOTALS]: out.append({"row": name, "P_student": round(student(m1, s1, m2, s2, n), 6), "P_welch": round(welch(m1, s1, m2, s2, n), 6), "rounding_dominates": abs(m1 - m2) <= 0.0100001}) res["C2"][f"n={n}"] = out # C4: Benjamini-Hochberg and Holm, over the compound rows, and over the compound rows with the totals comp = out[:len(TESTED)] for test in ("P_student", "P_welch"): ps = [r[test] for r in comp] res["C4"][f"n={n} {test} compounds BH"] = sorted(comp[i]["row"] for i in bh(ps)) res["C4"][f"n={n} {test} compounds Holm"] = sorted(comp[i]["row"] for i in holm(ps)) ps2 = [r[test] for r in out] res["C4"][f"n={n} {test} with totals BH"] = sorted(out[i]["row"] for i in bh(ps2)) res["C4"][f"n={n} {test} with totals Holm"] = sorted(out[i]["row"] for i in holm(ps2)) # C6 (post hoc): the same tests and corrections on each row's largest P over its rounding box res["C6"] = {"rules": "RULES_table1_addendum.txt, written after a fresh review; post hoc"} for n in (6, 3): rows_all = TESTED + [(t[0], t[1], t[2], t[3], t[4]) for t in TOTALS] worst = [{"row": name, "worst_P_student": round(worst_p(m1, s1, m2, s2, n, student), 6), "worst_P_welch": round(worst_p(m1, s1, m2, s2, n, welch), 6)} for name, m1, s1, m2, s2 in rows_all] block = {"rows": worst} comp = worst[:len(TESTED)] for test in ("worst_P_student", "worst_P_welch"): ps = [r[test] for r in comp] block[f"{test} compounds BH"] = sorted(comp[i]["row"] for i in bh(ps)) block[f"{test} compounds Holm"] = sorted(comp[i]["row"] for i in holm(ps)) ps2 = [r[test] for r in worst] block[f"{test} with totals BH"] = sorted(worst[i]["row"] for i in bh(ps2)) block[f"{test} with totals Holm"] = sorted(worst[i]["row"] for i in holm(ps2)) res["C6"][f"n={n}"] = block # C3: rows whose P < 0.05 disagrees with the paper's bold mark, at each n and test res["C3"] = {f"n={n}": {test: [r["row"] for r in res["C2"][f"n={n}"] if (r[test] < 0.05) != (r["row"] in BOLD)] for test in ("P_student", "P_welch")} for n in (6, 3)} # C5: each bold row not significant under Student's t at n = 6, and the n per group it would need res["C5"] = {} for name, m1, s1, m2, s2 in TESTED + [(t[0], t[1], t[2], t[3], t[4]) for t in TOTALS]: if name in BOLD and student(m1, s1, m2, s2, 6) >= 0.05: res["C5"][name] = next((n for n in range(2, 201) if student(m1, s1, m2, s2, n) < 0.05), ">200") text = json.dumps(res, indent=1, ensure_ascii=False) + "\n" with open(sys.argv[1], "w", encoding="utf-8", newline="\n") as fh: fh.write(text) sys.stdout.reconfigure(encoding="utf-8") print(text) if __name__ == "__main__": main()