forked from DAWells/scrapeAF
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from BarinthusBio/revert-7-HLAF-8-better_tests
Revert "HLAF-8 better tests"
- Loading branch information
Showing
12 changed files
with
152 additions
and
263 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,5 +5,4 @@ writeup/ | |
envs/.venv | ||
build/ | ||
dist/ | ||
src/*.egg-info/ | ||
.coverage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
Metadata-Version: 2.1 | ||
Name: HLAfreq | ||
Version: 0.0.2 | ||
Summary: Download and combine HLA frequency data from multiple studies | ||
Home-page: https://github.com/Vaccitech/HLAfreq | ||
Author: David Wells | ||
Author-email: david.wells@vaccitech.co.uk | ||
Project-URL: Tracker, https://github.com/Vaccitech/HLAfreq/issues | ||
Classifier: Programming Language :: Python :: 3 | ||
Classifier: Operating System :: OS Independent | ||
Description-Content-Type: text/markdown | ||
License-File: LICENSE | ||
|
||
# HLAfreq | ||
|
||
`HLAfreq` allows you to download and combine HLA allele | ||
frequencies from multiple datasets, e.g. combine data from | ||
several studies within a country or combine countries. | ||
Useful for studying regional diversity in immune genes | ||
and, when paired with epitope prediction, estimating a population's | ||
ability to mount an immune response to specific epitopes. | ||
|
||
Automated download of allele frequency data download from | ||
[allele frequencies.net](http://www.allelefrequencies.net/). | ||
|
||
## Details | ||
Estimates are combined by modelling allele frequency as a | ||
Dirichlet distribution which defines the probability of drawing each | ||
allele. When combining studies their estimates are weighted as 2x sample size by | ||
default. Sample size is doubled as each person in the study | ||
contributes two alleles. Alternative weightings can be used | ||
for example population size when averaging across countries. | ||
|
||
When selecting a panel of HLA alleles to represent a population, | ||
allele frequency is not the only thing to consider. Depending on | ||
the purpose of the panel, you should include a range of loci and | ||
supertypes (groups alleles sharing binding specificies). | ||
|
||
## Install | ||
``` | ||
pip install HLAfreq | ||
``` | ||
|
||
## Minimal example | ||
Download HLA data using `makeURL()` and `getAFdata()`. | ||
All arguments that can be specified in the webpage form are available, | ||
see `help(HLAfreq.makeURL)` for details (press `q` to exit). | ||
``` | ||
import HLAfreq | ||
base_url = HLAfreq.makeURL("Uganda", locus="A") | ||
aftab = HLAfreq.getAFdata(base_url) | ||
``` | ||
|
||
After downloading the data, it must be filtered so that all studies | ||
sum to allele frequency 1 (within tolerence). Then we must ensure | ||
that all studies report alleles at the same resolution. | ||
Finaly we can combine frequency estimates. | ||
``` | ||
aftab = HLAfreq.only_complete(aftab) | ||
aftab = HLAfreq.decrease_resolution(aftab, 2) | ||
caf = HLAfreq.combineAF(aftab) | ||
``` | ||
|
||
## Detailed examples | ||
For more detailed walkthroughs see [HLAfreq/examples](https://github.com/Vaccitech/HLAfreq/tree/main/examples). | ||
|
||
- [Single country](https://github.com/Vaccitech/HLAfreq/blob/main/examples/single_country.ipynb) download and combine | ||
- [Multi-country](https://github.com/Vaccitech/HLAfreq/blob/main/examples/multi_country.ipynb) download and combine, weight by population coverage | ||
- [Using priors](https://github.com/Vaccitech/HLAfreq/blob/main/examples/working_with_priors.ipynb) | ||
- [Credible intervals](https://github.com/Vaccitech/HLAfreq/blob/main/examples/credible_intervals.ipynb) | ||
|
||
## Docs | ||
For help on specific functions view the docstring, `help(function_name)`. | ||
Full documentation API at [HLAfreq/docs](https://github.com/Vaccitech/HLAfreq/blob/main/docs/HLAfreq.md) | ||
created with pdoc3 in pdf mode. | ||
|
||
<!-- ## Developer notes | ||
# Install in dev mode | ||
pip install -e HLAfreq | ||
|
||
Update version in setup.py | ||
|
||
Update documentation with `pdoc --pdf -o docs/ src/HLAfreq/ > docs/HLAfreq.md`. | ||
|
||
Run tests `pytest` | ||
|
||
# Clear old build info | ||
rm -rf build dist src/*.egg-info | ||
|
||
Build with `python -m build`. | ||
|
||
twine check dist/* | ||
|
||
# Upload to test pypi | ||
twine upload --repository testpypi dist/* | ||
|
||
# Install from test pypi | ||
python3 -m pip install --extra-index-url https://test.pypi.org/simple/ HLAfreq | ||
|
||
# Upload to pypi | ||
twine upload dist/* | ||
--> | ||
|
||
## Citation | ||
*In prep.* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
LICENSE | ||
MANIFEST.in | ||
README.md | ||
pyproject.toml | ||
setup.py | ||
src/HLAfreq/HLAfreq.py | ||
src/HLAfreq/HLAfreq_data.py | ||
src/HLAfreq/HLAfreq_pymc.py | ||
src/HLAfreq/__init__.py | ||
src/HLAfreq/examples.py | ||
src/HLAfreq.egg-info/PKG-INFO | ||
src/HLAfreq.egg-info/SOURCES.txt | ||
src/HLAfreq.egg-info/dependency_links.txt | ||
src/HLAfreq.egg-info/requires.txt | ||
src/HLAfreq.egg-info/top_level.txt | ||
src/HLAfreq/data/HLA1supertypes_Sidney2008.csv | ||
src/HLAfreq/data/countries.csv | ||
tests/test_single_country_caf.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
bs4 | ||
requests | ||
pandas | ||
numpy | ||
matplotlib | ||
scipy | ||
pymc>=3 | ||
arviz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
HLAfreq |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.