fecpool 1.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,7 @@
1
+ __pycache__/
2
+ *.egg-info/
3
+ dist/
4
+ build/
5
+ .pytest_cache/
6
+ .venv/
7
+ _site/
@@ -0,0 +1,14 @@
1
+ # Changelog
2
+
3
+ ## 1.1.0 - 2026-11-30
4
+
5
+ - Web page that runs the package in the browser (Pyodide), with one tab per
6
+ command, tables, charts and the equivalent command; deployed to GitHub Pages
7
+ after browser tests that compare every tab with the command line.
8
+ - Joanna Dąbrowska added as author; Zenodo DOI in the README and the citation
9
+ files; `.zenodo.json` with authors, affiliations and related works.
10
+
11
+ ## 1.0.0 - 2026-11-30
12
+
13
+ First release: `plan`, `check`, `negative`, `farm` and `targets`; validation by
14
+ simulation and on published egg counts of individual pigs.
@@ -0,0 +1,69 @@
1
+ cff-version: 1.2.0
2
+ message: "If you use this software, please cite it and the article it accompanies."
3
+ title: "fecpool"
4
+ abstract: >-
5
+ Pooled (composite) faecal samples for finding parasite eggs with a McMaster
6
+ count: the number of pools and of animals per pool needed to find eggs when
7
+ at least a given share of the animals excretes at least a given number of
8
+ eggs per gram, the probability that a given plan finds them, and what
9
+ all-negative pools exclude. No distribution of egg counts among animals is
10
+ assumed; egg loss and dispersion of the counting method come from
11
+ mcmaster-epg method profiles. Includes a sampling sheet for pig farms based
12
+ on Kochanowski et al. 2017 and a web page that runs the package in the
13
+ browser.
14
+ type: software
15
+ version: "1.1.0"
16
+ date-released: "2026-11-30"
17
+ doi: "10.5281/zenodo.24699361"
18
+ identifiers:
19
+ - type: doi
20
+ value: "10.5281/zenodo.24699361"
21
+ description: "All versions (concept DOI)"
22
+ - type: doi
23
+ value: "10.5281/zenodo.24699362"
24
+ description: "fecpool 1.0.0"
25
+ - type: url
26
+ value: "https://maciejkochanowski.github.io/fecpool/"
27
+ description: "Web page that runs fecpool in the browser"
28
+ license: MIT
29
+ repository-code: "https://github.com/maciejkochanowski/fecpool"
30
+ keywords:
31
+ - faecal egg count
32
+ - pooled samples
33
+ - McMaster
34
+ - pigs
35
+ - veterinary parasitology
36
+ - survey design
37
+ authors:
38
+ - family-names: Kochanowski
39
+ given-names: Maciej
40
+ email: maciej.kochanowski@piwet.pulawy.pl
41
+ orcid: "https://orcid.org/0000-0002-9982-3028"
42
+ affiliation: "Department of Bacteriology and Bacterial Animal Diseases, National Veterinary Research Institute, 57 Partyzantów Avenue, 24-100 Puławy, Poland"
43
+ - family-names: Dąbrowska
44
+ given-names: Joanna
45
+ orcid: "https://orcid.org/0000-0003-2249-9829"
46
+ affiliation: "Department of Virology and Viral Diseases of Animals, National Veterinary Research Institute, 57 Partyzantów Avenue, 24-100 Puławy, Poland"
47
+ references:
48
+ - type: article
49
+ title: "Occurrence of intestinal parasites in pigs in Poland - the influence of factors related to the production system"
50
+ authors:
51
+ - family-names: Kochanowski
52
+ given-names: Maciej
53
+ - family-names: Karamon
54
+ given-names: Jacek
55
+ - family-names: Dąbrowska
56
+ given-names: Joanna
57
+ - family-names: Dors
58
+ given-names: Arkadiusz
59
+ - family-names: Czyżewska-Dors
60
+ given-names: Ewelina
61
+ - family-names: Cencek
62
+ given-names: Tomasz
63
+ journal: "Journal of Veterinary Research"
64
+ year: 2017
65
+ volume: 61
66
+ issue: 4
67
+ start: 459
68
+ end: 466
69
+ doi: "10.1515/jvetres-2017-0053"
fecpool-1.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Maciej Kochanowski
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
fecpool-1.1.0/PKG-INFO ADDED
@@ -0,0 +1,233 @@
1
+ Metadata-Version: 2.5
2
+ Name: fecpool
3
+ Version: 1.1.0
4
+ Summary: Pooled faecal samples: how many pools, of how many animals, to find parasite eggs with a McMaster count, without assumptions about the distribution of egg counts among animals
5
+ Project-URL: Repository, https://github.com/maciejkochanowski/fecpool
6
+ Project-URL: Homepage, https://maciejkochanowski.github.io/fecpool/
7
+ Project-URL: DOI, https://doi.org/10.5281/zenodo.24699361
8
+ Author: Joanna Dąbrowska
9
+ Author-email: Maciej Kochanowski <maciej.kochanowski@piwet.pulawy.pl>
10
+ License: MIT
11
+ License-File: LICENSE
12
+ Keywords: McMaster,composite samples,faecal egg count,herd sensitivity,parasitology,pigs,pooled samples,survey design,veterinary
13
+ Classifier: Intended Audience :: Science/Research
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
17
+ Requires-Python: >=3.10
18
+ Requires-Dist: mcmaster-epg>=1.1.0
19
+ Requires-Dist: scipy>=1.8
20
+ Provides-Extra: test
21
+ Requires-Dist: numpy; extra == 'test'
22
+ Requires-Dist: pytest; extra == 'test'
23
+ Provides-Extra: validation
24
+ Requires-Dist: numpy; extra == 'validation'
25
+ Provides-Extra: web
26
+ Requires-Dist: playwright; extra == 'web'
27
+ Requires-Dist: pytest; extra == 'web'
28
+ Description-Content-Type: text/markdown
29
+
30
+ # fecpool
31
+
32
+ [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.24699361.svg)](https://doi.org/10.5281/zenodo.24699361)
33
+
34
+ Pooled (composite) faecal samples for finding parasite eggs with a McMaster
35
+ count: how many pools, of how many animals each, are needed; how likely a
36
+ given plan is to find eggs; and what all-negative pools exclude. Made for
37
+ pig farms, where faeces are usually pooled by pen or age group, and usable
38
+ for any host.
39
+
40
+ The question is put as in a survey for freedom from infection: *if at least
41
+ 10% of the animals of a group excrete at least 200 eggs per gram (EPG), with
42
+ what probability are eggs found?* No distribution of EPG among the animals is
43
+ assumed. Egg loss and the dispersion of counts come from the method profiles
44
+ of [mcmaster-epg](https://github.com/maciejkochanowski/mcmaster-epg).
45
+
46
+ The age group to sample for each parasite of pigs is taken from Kochanowski
47
+ et al. 2017 (https://doi.org/10.1515/jvetres-2017-0053), the survey of 70
48
+ Polish farms that this software accompanies.
49
+
50
+ ## Run in the browser
51
+
52
+ No installation needed: https://maciejkochanowski.github.io/fecpool/
53
+
54
+ The page runs the fecpool package itself inside the browser (Pyodide,
55
+ WebAssembly), so its results are those of the command line. It has one tab per
56
+ command (`plan`, `check`, `negative`, `farm`, `targets`), shows the result as
57
+ tables and charts with the program output, and gives the equivalent command
58
+ under each result. Nothing you enter or upload leaves your device: the page
59
+ sends no data to any server and uses no cookies or analytics. The first visit
60
+ downloads the Python runtime from cdn.jsdelivr.net (about 10 to 20 seconds;
61
+ later visits use the browser cache).
62
+
63
+ The site is built from `main` by `.github/workflows/pages.yml`, which first
64
+ runs the browser tests in `web/tests/`: every tab is calculated in the page
65
+ and its record compared with that of the command line for the same arguments.
66
+ To run them locally, `pip install .[web]`, `python -m playwright install
67
+ chromium` and `python -m pytest web/tests` (add `--pyodide-dir PATH` to use a
68
+ local copy of Pyodide instead of the CDN).
69
+
70
+ ## Installation
71
+
72
+ ```bash
73
+ pip install git+https://github.com/maciejkochanowski/fecpool
74
+ ```
75
+
76
+ Python 3.10 or later; mcmaster-epg, NumPy and SciPy are installed with it.
77
+
78
+ ## Commands
79
+
80
+ ```bash
81
+ fecpool plan --prevalence 0.1 --threshold 200 --variant whole_chamber --species ascaris_suum
82
+ # Method: factor 15, recovery 0.74, Poisson counts (least favourable end of the 95% ranges of recovery and dispersion used)
83
+ # Aim: eggs found with probability 0.95 if at least 10% of the animals excrete 200 EPG or more
84
+ # Animals per pool One pool positive Pools needed Animals sampled Probability reached
85
+ # 1 0.100 29 29 0.953
86
+ # 3 0.258 11 33 0.963
87
+ # 5 0.353 7 35 0.953
88
+ # 10 0.460 5 50 0.954
89
+ # 20 0.527 5 100 0.976
90
+ # One pool of very many animals is positive with probability 0.600 at most: its EPG tends to 20
91
+
92
+ fecpool check --pools 6 --pool-size 5 --prevalence 0.1 --threshold 200 --variant whole_chamber --species ascaris_suum
93
+ # 6 pools of 5: eggs found with probability at least 0.927 if at least 10% of the animals excrete 200 EPG or more
94
+
95
+ fecpool negative --pools 6 --pool-size 5 --threshold 200 --variant whole_chamber --species ascaris_suum
96
+ # All 6 pools of 5 negative: at most 11.4% of the animals excrete 200 EPG or more (95% confidence)
97
+
98
+ fecpool farm --prevalence 0.1 --threshold 200 --variant whole_chamber --pool-size 5
99
+ # Age group Pools Animals Parasites looked for
100
+ # suckling piglets 7 35 coccidia, Strongyloides spp.
101
+ # fatteners 7 35 Ascaris suum
102
+ # sows 7 35 Oesophagostomum spp., Trichuris suis
103
+
104
+ fecpool targets # positive samples and mean counts by age group in the Polish survey
105
+ ```
106
+
107
+ `--group-size N` (plan, check, negative) draws the pools from a group of N
108
+ animals without replacement, for a pen or a small herd. `--json` prints every
109
+ result as JSON.
110
+
111
+ The counting method is given as in mcmaster-epg: `--variant` (Raynaud's
112
+ modification: `one_grid`, `two_grids`, `whole_chamber`, `flotation_slide`,
113
+ factors 100, 50, 15, 7) or `--multiplier`; egg loss and dispersion from
114
+ `--species` (built-in validated profile; `--matrix pig` is the default),
115
+ `--profile FILE` (a profile calibrated with `mcmaster-epg calibrate`) or
116
+ `--recovery` and `--k` with their intervals. Without them the nominal method
117
+ is used (no egg loss, Poisson counts), which overstates detection; the output
118
+ says so.
119
+
120
+ ## What the numbers mean
121
+
122
+ A pooled sample holds equal amounts of faeces from `pool size` different
123
+ animals, mixed and counted once. If j of them excrete at least the threshold
124
+ T, the EPG of the pool is at least j x T / pool size, whatever the others
125
+ excrete, and the probability of counting at least one egg rises with the EPG.
126
+ The least favourable group is therefore the one in which exactly the stated
127
+ share excretes exactly T and the others nothing. Every probability is computed
128
+ for that group, so it is a lower limit for any group that meets the condition;
129
+ the number of animals at the threshold in a pool is binomial, or
130
+ hypergeometric with `--group-size`. When the method profile carries the
131
+ uncertainty of recovery and dispersion, the least favourable end of their 95%
132
+ ranges is used.
133
+
134
+ Two consequences for practice:
135
+
136
+ - Pooling saves counts, not animals: in the example 29 single samples become
137
+ 7 pools of 5 (35 animals, 7 counts).
138
+ - Larger pools stop helping. The EPG of a very large pool tends to
139
+ share x T (20 EPG in the example), so one pool cannot be positive more often
140
+ than a single sample of that EPG. When share x T is far below the limit of
141
+ detection of the method, take more pools or a more sensitive variant, not
142
+ larger pools.
143
+
144
+ `negative` gives the upper confidence limit of the share of animals with at
145
+ least T: a larger share would have given a positive pool with a probability
146
+ above the confidence level. It says nothing about animals that excrete less
147
+ than T.
148
+
149
+ ## Pig farms
150
+
151
+ `farm` lists the pools per age group for five parasites. Each parasite is
152
+ looked for in the age group with the highest percentage of positive samples
153
+ in Kochanowski et al. 2017 (Results; `fecpool targets` prints the table):
154
+ coccidia and *Strongyloides* spp. in suckling piglets, *Ascaris suum* in
155
+ fatteners, *Oesophagostomum* spp. and *Trichuris suis* in sows. One pooled
156
+ sample is read for all parasites, so an age group needs the largest number of
157
+ pools among its parasites. (The abstract of the article names fatteners for
158
+ *T. suis*; the Results give 3.0% of positive samples in sows and 1.4% in
159
+ fatteners, and the Results are used.)
160
+
161
+ A validated method profile for pig faeces exists only for *A. suum* eggs
162
+ (Kochanowski et al. 2013, https://doi.org/10.14411/fp.2013.030). For the
163
+ other parasites `farm` uses the nominal method and marks it; calibrate your
164
+ own profile with `mcmaster-epg calibrate` and use `plan --profile` for them.
165
+
166
+ ## Validation
167
+
168
+ `validation/BOUND_REPORT.md` (`python validation/run_bound_validation.py`):
169
+ 162 combinations of method, pool size, share and threshold, each with four
170
+ distributions of EPG among animals and every corner of the parameter ranges,
171
+ 40,000 simulated pools each. No simulated share of positive pools was below
172
+ the limit by more than four standard errors, and for the least favourable
173
+ group the simulation met the limit within 0.007, so the limit cannot be
174
+ raised without an assumption on the distribution. Plans in small groups
175
+ (pools drawn without replacement) agreed with the simulation within 0.002.
176
+
177
+ `validation/PIG_DATA_REPORT.md` (`python validation/run_pig_data_validation.py`):
178
+ pools of five made on the computer from the published egg counts of
179
+ individual pigs of Fischer et al. 2024 (German outdoor farms, FLOTAC; 38
180
+ combinations of group, parasite and threshold). No plan fell below the limit.
181
+ Real groups were found more easily than the limit says: one pool was positive
182
+ 1.5 times as often in the median (1.04 to 6.25 times), and where both numbers
183
+ exist the limit asked for one pool more in the median (0 to 4 more).
184
+
185
+ ## Limits
186
+
187
+ - Equal amounts of faeces from different animals and thorough mixing are
188
+ assumed. Droppings collected from a pen floor may come from the same animal,
189
+ and the mixing of faeces was not tested: in the validation the EPG of a pool
190
+ is computed from the animals' counts, not measured in a mixed sample.
191
+ - The count of a pool is assumed to follow the method profile obtained from
192
+ spiked single samples.
193
+ - The limit is cautious by construction (see the pig data above).
194
+ - Only detection is covered. The mean EPG of a group from pooled counts and
195
+ the egg count reduction test are not; for the latter see `eggCounts`,
196
+ `bayescount` or fecrt.com.
197
+ - A positive count is taken as a true finding. Low counts of *A. suum* and
198
+ other eggs can come from eggs that pass through the gut after being eaten;
199
+ Kochanowski et al. 2017 attributed the eggs of *A. suum*, *T. suis* and
200
+ *Oesophagostomum* spp. in suckling piglets to this.
201
+ - Models of composite egg counts exist for other hosts and questions
202
+ (Morgan et al. 2005 for the mean count of sheep flocks; Levecke et al. 2015
203
+ for human helminths); fecpool addresses detection with a validated count
204
+ model and without a distribution of EPG.
205
+
206
+ ## Python
207
+
208
+ ```python
209
+ from fecpool import method_profile, pools_needed, plan_detection, excluded_prevalence
210
+
211
+ pig = method_profile(variant="whole_chamber", species="ascaris_suum")
212
+ pools_needed(pig, pool_size=5, prevalence=0.1, threshold=200) # 7
213
+ plan_detection(pig, pools=6, pool_size=5, prevalence=0.1, threshold=200) # 0.927
214
+ excluded_prevalence(pig, pools=6, pool_size=5, threshold=200) # 0.114
215
+ ```
216
+
217
+ ## Citation
218
+
219
+ Kochanowski M, Dąbrowska J. fecpool, version 1.1.0. Zenodo; 2026.
220
+ https://doi.org/10.5281/zenodo.24699361 (this DOI covers all versions; each
221
+ version has its own DOI on Zenodo)
222
+
223
+ Kochanowski M, Karamon J, Dąbrowska J, Dors A, Czyżewska-Dors E, Cencek T.
224
+ Occurrence of intestinal parasites in pigs in Poland - the influence of
225
+ factors related to the production system. J Vet Res 2017;61(4):459-466.
226
+ https://doi.org/10.1515/jvetres-2017-0053
227
+
228
+ Data used in the validation: Fischer HRM et al. Porcine Health Manag
229
+ 2024;10:33. https://doi.org/10.1186/s40813-024-00384-8 (CC BY 4.0).
230
+
231
+ ## Licence
232
+
233
+ MIT.
@@ -0,0 +1,204 @@
1
+ # fecpool
2
+
3
+ [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.24699361.svg)](https://doi.org/10.5281/zenodo.24699361)
4
+
5
+ Pooled (composite) faecal samples for finding parasite eggs with a McMaster
6
+ count: how many pools, of how many animals each, are needed; how likely a
7
+ given plan is to find eggs; and what all-negative pools exclude. Made for
8
+ pig farms, where faeces are usually pooled by pen or age group, and usable
9
+ for any host.
10
+
11
+ The question is put as in a survey for freedom from infection: *if at least
12
+ 10% of the animals of a group excrete at least 200 eggs per gram (EPG), with
13
+ what probability are eggs found?* No distribution of EPG among the animals is
14
+ assumed. Egg loss and the dispersion of counts come from the method profiles
15
+ of [mcmaster-epg](https://github.com/maciejkochanowski/mcmaster-epg).
16
+
17
+ The age group to sample for each parasite of pigs is taken from Kochanowski
18
+ et al. 2017 (https://doi.org/10.1515/jvetres-2017-0053), the survey of 70
19
+ Polish farms that this software accompanies.
20
+
21
+ ## Run in the browser
22
+
23
+ No installation needed: https://maciejkochanowski.github.io/fecpool/
24
+
25
+ The page runs the fecpool package itself inside the browser (Pyodide,
26
+ WebAssembly), so its results are those of the command line. It has one tab per
27
+ command (`plan`, `check`, `negative`, `farm`, `targets`), shows the result as
28
+ tables and charts with the program output, and gives the equivalent command
29
+ under each result. Nothing you enter or upload leaves your device: the page
30
+ sends no data to any server and uses no cookies or analytics. The first visit
31
+ downloads the Python runtime from cdn.jsdelivr.net (about 10 to 20 seconds;
32
+ later visits use the browser cache).
33
+
34
+ The site is built from `main` by `.github/workflows/pages.yml`, which first
35
+ runs the browser tests in `web/tests/`: every tab is calculated in the page
36
+ and its record compared with that of the command line for the same arguments.
37
+ To run them locally, `pip install .[web]`, `python -m playwright install
38
+ chromium` and `python -m pytest web/tests` (add `--pyodide-dir PATH` to use a
39
+ local copy of Pyodide instead of the CDN).
40
+
41
+ ## Installation
42
+
43
+ ```bash
44
+ pip install git+https://github.com/maciejkochanowski/fecpool
45
+ ```
46
+
47
+ Python 3.10 or later; mcmaster-epg, NumPy and SciPy are installed with it.
48
+
49
+ ## Commands
50
+
51
+ ```bash
52
+ fecpool plan --prevalence 0.1 --threshold 200 --variant whole_chamber --species ascaris_suum
53
+ # Method: factor 15, recovery 0.74, Poisson counts (least favourable end of the 95% ranges of recovery and dispersion used)
54
+ # Aim: eggs found with probability 0.95 if at least 10% of the animals excrete 200 EPG or more
55
+ # Animals per pool One pool positive Pools needed Animals sampled Probability reached
56
+ # 1 0.100 29 29 0.953
57
+ # 3 0.258 11 33 0.963
58
+ # 5 0.353 7 35 0.953
59
+ # 10 0.460 5 50 0.954
60
+ # 20 0.527 5 100 0.976
61
+ # One pool of very many animals is positive with probability 0.600 at most: its EPG tends to 20
62
+
63
+ fecpool check --pools 6 --pool-size 5 --prevalence 0.1 --threshold 200 --variant whole_chamber --species ascaris_suum
64
+ # 6 pools of 5: eggs found with probability at least 0.927 if at least 10% of the animals excrete 200 EPG or more
65
+
66
+ fecpool negative --pools 6 --pool-size 5 --threshold 200 --variant whole_chamber --species ascaris_suum
67
+ # All 6 pools of 5 negative: at most 11.4% of the animals excrete 200 EPG or more (95% confidence)
68
+
69
+ fecpool farm --prevalence 0.1 --threshold 200 --variant whole_chamber --pool-size 5
70
+ # Age group Pools Animals Parasites looked for
71
+ # suckling piglets 7 35 coccidia, Strongyloides spp.
72
+ # fatteners 7 35 Ascaris suum
73
+ # sows 7 35 Oesophagostomum spp., Trichuris suis
74
+
75
+ fecpool targets # positive samples and mean counts by age group in the Polish survey
76
+ ```
77
+
78
+ `--group-size N` (plan, check, negative) draws the pools from a group of N
79
+ animals without replacement, for a pen or a small herd. `--json` prints every
80
+ result as JSON.
81
+
82
+ The counting method is given as in mcmaster-epg: `--variant` (Raynaud's
83
+ modification: `one_grid`, `two_grids`, `whole_chamber`, `flotation_slide`,
84
+ factors 100, 50, 15, 7) or `--multiplier`; egg loss and dispersion from
85
+ `--species` (built-in validated profile; `--matrix pig` is the default),
86
+ `--profile FILE` (a profile calibrated with `mcmaster-epg calibrate`) or
87
+ `--recovery` and `--k` with their intervals. Without them the nominal method
88
+ is used (no egg loss, Poisson counts), which overstates detection; the output
89
+ says so.
90
+
91
+ ## What the numbers mean
92
+
93
+ A pooled sample holds equal amounts of faeces from `pool size` different
94
+ animals, mixed and counted once. If j of them excrete at least the threshold
95
+ T, the EPG of the pool is at least j x T / pool size, whatever the others
96
+ excrete, and the probability of counting at least one egg rises with the EPG.
97
+ The least favourable group is therefore the one in which exactly the stated
98
+ share excretes exactly T and the others nothing. Every probability is computed
99
+ for that group, so it is a lower limit for any group that meets the condition;
100
+ the number of animals at the threshold in a pool is binomial, or
101
+ hypergeometric with `--group-size`. When the method profile carries the
102
+ uncertainty of recovery and dispersion, the least favourable end of their 95%
103
+ ranges is used.
104
+
105
+ Two consequences for practice:
106
+
107
+ - Pooling saves counts, not animals: in the example 29 single samples become
108
+ 7 pools of 5 (35 animals, 7 counts).
109
+ - Larger pools stop helping. The EPG of a very large pool tends to
110
+ share x T (20 EPG in the example), so one pool cannot be positive more often
111
+ than a single sample of that EPG. When share x T is far below the limit of
112
+ detection of the method, take more pools or a more sensitive variant, not
113
+ larger pools.
114
+
115
+ `negative` gives the upper confidence limit of the share of animals with at
116
+ least T: a larger share would have given a positive pool with a probability
117
+ above the confidence level. It says nothing about animals that excrete less
118
+ than T.
119
+
120
+ ## Pig farms
121
+
122
+ `farm` lists the pools per age group for five parasites. Each parasite is
123
+ looked for in the age group with the highest percentage of positive samples
124
+ in Kochanowski et al. 2017 (Results; `fecpool targets` prints the table):
125
+ coccidia and *Strongyloides* spp. in suckling piglets, *Ascaris suum* in
126
+ fatteners, *Oesophagostomum* spp. and *Trichuris suis* in sows. One pooled
127
+ sample is read for all parasites, so an age group needs the largest number of
128
+ pools among its parasites. (The abstract of the article names fatteners for
129
+ *T. suis*; the Results give 3.0% of positive samples in sows and 1.4% in
130
+ fatteners, and the Results are used.)
131
+
132
+ A validated method profile for pig faeces exists only for *A. suum* eggs
133
+ (Kochanowski et al. 2013, https://doi.org/10.14411/fp.2013.030). For the
134
+ other parasites `farm` uses the nominal method and marks it; calibrate your
135
+ own profile with `mcmaster-epg calibrate` and use `plan --profile` for them.
136
+
137
+ ## Validation
138
+
139
+ `validation/BOUND_REPORT.md` (`python validation/run_bound_validation.py`):
140
+ 162 combinations of method, pool size, share and threshold, each with four
141
+ distributions of EPG among animals and every corner of the parameter ranges,
142
+ 40,000 simulated pools each. No simulated share of positive pools was below
143
+ the limit by more than four standard errors, and for the least favourable
144
+ group the simulation met the limit within 0.007, so the limit cannot be
145
+ raised without an assumption on the distribution. Plans in small groups
146
+ (pools drawn without replacement) agreed with the simulation within 0.002.
147
+
148
+ `validation/PIG_DATA_REPORT.md` (`python validation/run_pig_data_validation.py`):
149
+ pools of five made on the computer from the published egg counts of
150
+ individual pigs of Fischer et al. 2024 (German outdoor farms, FLOTAC; 38
151
+ combinations of group, parasite and threshold). No plan fell below the limit.
152
+ Real groups were found more easily than the limit says: one pool was positive
153
+ 1.5 times as often in the median (1.04 to 6.25 times), and where both numbers
154
+ exist the limit asked for one pool more in the median (0 to 4 more).
155
+
156
+ ## Limits
157
+
158
+ - Equal amounts of faeces from different animals and thorough mixing are
159
+ assumed. Droppings collected from a pen floor may come from the same animal,
160
+ and the mixing of faeces was not tested: in the validation the EPG of a pool
161
+ is computed from the animals' counts, not measured in a mixed sample.
162
+ - The count of a pool is assumed to follow the method profile obtained from
163
+ spiked single samples.
164
+ - The limit is cautious by construction (see the pig data above).
165
+ - Only detection is covered. The mean EPG of a group from pooled counts and
166
+ the egg count reduction test are not; for the latter see `eggCounts`,
167
+ `bayescount` or fecrt.com.
168
+ - A positive count is taken as a true finding. Low counts of *A. suum* and
169
+ other eggs can come from eggs that pass through the gut after being eaten;
170
+ Kochanowski et al. 2017 attributed the eggs of *A. suum*, *T. suis* and
171
+ *Oesophagostomum* spp. in suckling piglets to this.
172
+ - Models of composite egg counts exist for other hosts and questions
173
+ (Morgan et al. 2005 for the mean count of sheep flocks; Levecke et al. 2015
174
+ for human helminths); fecpool addresses detection with a validated count
175
+ model and without a distribution of EPG.
176
+
177
+ ## Python
178
+
179
+ ```python
180
+ from fecpool import method_profile, pools_needed, plan_detection, excluded_prevalence
181
+
182
+ pig = method_profile(variant="whole_chamber", species="ascaris_suum")
183
+ pools_needed(pig, pool_size=5, prevalence=0.1, threshold=200) # 7
184
+ plan_detection(pig, pools=6, pool_size=5, prevalence=0.1, threshold=200) # 0.927
185
+ excluded_prevalence(pig, pools=6, pool_size=5, threshold=200) # 0.114
186
+ ```
187
+
188
+ ## Citation
189
+
190
+ Kochanowski M, Dąbrowska J. fecpool, version 1.1.0. Zenodo; 2026.
191
+ https://doi.org/10.5281/zenodo.24699361 (this DOI covers all versions; each
192
+ version has its own DOI on Zenodo)
193
+
194
+ Kochanowski M, Karamon J, Dąbrowska J, Dors A, Czyżewska-Dors E, Cencek T.
195
+ Occurrence of intestinal parasites in pigs in Poland - the influence of
196
+ factors related to the production system. J Vet Res 2017;61(4):459-466.
197
+ https://doi.org/10.1515/jvetres-2017-0053
198
+
199
+ Data used in the validation: Fischer HRM et al. Porcine Health Manag
200
+ 2024;10:33. https://doi.org/10.1186/s40813-024-00384-8 (CC BY 4.0).
201
+
202
+ ## Licence
203
+
204
+ MIT.
@@ -0,0 +1,46 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "fecpool"
7
+ version = "1.1.0"
8
+ description = "Pooled faecal samples: how many pools, of how many animals, to find parasite eggs with a McMaster count, without assumptions about the distribution of egg counts among animals"
9
+ readme = "README.md"
10
+ requires-python = ">=3.10"
11
+ license = { text = "MIT" }
12
+ authors = [
13
+ { name = "Maciej Kochanowski", email = "maciej.kochanowski@piwet.pulawy.pl" },
14
+ { name = "Joanna Dąbrowska" },
15
+ ]
16
+ keywords = ["faecal egg count", "pooled samples", "composite samples", "McMaster", "pigs", "parasitology", "veterinary", "survey design", "herd sensitivity"]
17
+ classifiers = [
18
+ "Programming Language :: Python :: 3",
19
+ "License :: OSI Approved :: MIT License",
20
+ "Intended Audience :: Science/Research",
21
+ "Topic :: Scientific/Engineering :: Bio-Informatics",
22
+ ]
23
+ dependencies = ["mcmaster-epg>=1.1.0", "scipy>=1.8"]
24
+
25
+ [project.optional-dependencies]
26
+ test = ["pytest", "numpy"]
27
+ web = ["pytest", "playwright"]
28
+ validation = ["numpy"]
29
+
30
+ [project.scripts]
31
+ fecpool = "fecpool.cli:main"
32
+
33
+ [project.urls]
34
+ Repository = "https://github.com/maciejkochanowski/fecpool"
35
+ Homepage = "https://maciejkochanowski.github.io/fecpool/"
36
+ DOI = "https://doi.org/10.5281/zenodo.24699361"
37
+
38
+ [tool.hatch.build.targets.wheel]
39
+ packages = ["src/fecpool"]
40
+
41
+ [tool.hatch.build.targets.sdist]
42
+ include = ["src", "tests", "validation", "web", "README.md", "LICENSE", "CITATION.cff", "CHANGELOG.md"]
43
+
44
+ [tool.pytest.ini_options]
45
+ testpaths = ["tests"]
46
+ pythonpath = ["src"]
@@ -0,0 +1,11 @@
1
+ """Pooled faecal samples: how many pools, of how many animals, to find parasite eggs."""
2
+
3
+ __version__ = "1.1.0"
4
+
5
+ from .core import (ceiling, compare_pool_sizes, detection, excluded_prevalence, plan_detection,
6
+ pool_detection, pools_needed)
7
+ from .method import method_profile
8
+ from .pigs import farm_sheet, target_group
9
+
10
+ __all__ = ["ceiling", "compare_pool_sizes", "detection", "excluded_prevalence", "plan_detection",
11
+ "pool_detection", "pools_needed", "method_profile", "farm_sheet", "target_group", "__version__"]
@@ -0,0 +1,5 @@
1
+ import sys
2
+
3
+ from .cli import main
4
+
5
+ sys.exit(main())