Skip to content

Commit

Permalink
Merge pull request #394 from malariagen/xpehh
Browse files Browse the repository at this point in the history
Adding XPEHH
  • Loading branch information
jonbrenas authored Jun 22, 2023
2 parents aea9c90 + 3cf92c1 commit 415eae2
Show file tree
Hide file tree
Showing 6 changed files with 692 additions and 0 deletions.
2 changes: 2 additions & 0 deletions malariagen_data/af1.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
H12_CALIBRATION_CACHE_NAME = "af1_h12_calibration_v1"
H12_GWSS_CACHE_NAME = "af1_h12_gwss_v1"
G123_GWSS_CACHE_NAME = "af1_g123_gwss_v1"
XPEHH_GWSS_CACHE_NAME = "af1_xpehh_gwss_v1"
G123_CALIBRATION_CACHE_NAME = "af1_g123_calibration_v1"
H1X_GWSS_CACHE_NAME = "af1_h1x_gwss_v1"
IHS_GWSS_CACHE_NAME = "af1_ihs_gwss_v1"
Expand Down Expand Up @@ -75,6 +76,7 @@ class Af1(AnophelesDataResource):
_h12_calibration_cache_name = H12_CALIBRATION_CACHE_NAME
_h12_gwss_cache_name = H12_GWSS_CACHE_NAME
_g123_gwss_cache_name = G123_GWSS_CACHE_NAME
_xpehh_gwss_cache_name = XPEHH_GWSS_CACHE_NAME
_g123_calibration_cache_name = G123_CALIBRATION_CACHE_NAME
_h1x_gwss_cache_name = H1X_GWSS_CACHE_NAME
_ihs_gwss_cache_name = IHS_GWSS_CACHE_NAME
Expand Down
2 changes: 2 additions & 0 deletions malariagen_data/ag3.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
H12_GWSS_CACHE_NAME = "ag3_h12_gwss_v1"
G123_CALIBRATION_CACHE_NAME = "ag3_g123_calibration_v1"
G123_GWSS_CACHE_NAME = "ag3_g123_gwss_v1"
XPEHH_GWSS_CACHE_NAME = "ag3_xpehh_gwss_v1"
H1X_GWSS_CACHE_NAME = "ag3_h1x_gwss_v1"
IHS_GWSS_CACHE_NAME = "ag3_ihs_gwss_v1"

Expand Down Expand Up @@ -138,6 +139,7 @@ class Ag3(AnophelesDataResource):
_h12_calibration_cache_name = H12_CALIBRATION_CACHE_NAME
_h12_gwss_cache_name = H12_GWSS_CACHE_NAME
_g123_gwss_cache_name = G123_GWSS_CACHE_NAME
_xpehh_gwss_cache_name = XPEHH_GWSS_CACHE_NAME
_g123_calibration_cache_name = G123_CALIBRATION_CACHE_NAME
_h1x_gwss_cache_name = H1X_GWSS_CACHE_NAME
_ihs_gwss_cache_name = IHS_GWSS_CACHE_NAME
Expand Down
75 changes: 75 additions & 0 deletions malariagen_data/anoph/xpehh_params.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
"""Parameter definitions for XPEHH analysis functions."""

from typing import Tuple, Union

import numpy as np
from typing_extensions import Annotated, TypeAlias

from . import base_params

window_size: TypeAlias = Annotated[
int,
"""
The size of window in number of SNPs used to summarise XP-EHH over.
If None, per-variant XP-EHH values are returned.
""",
]
window_size_default: window_size = 200
min_cohort_size_default: base_params.min_cohort_size = 15
max_cohort_size_default: base_params.max_cohort_size = 50
percentiles: TypeAlias = Annotated[
Union[int, Tuple[int, ...]],
"""
If window size is specified, this returns the XP-EHH percentiles
for each window.
""",
]
percentiles_default: percentiles = (50, 75, 100)
filter_min_maf: TypeAlias = Annotated[
float,
"""
Minimum minor allele frequency to use for filtering prior to passing
haplotypes to allel.xpehh function
""",
]
filter_min_maf_default: filter_min_maf = 0.05
map_pos: TypeAlias = Annotated[
np.ndarray,
"""
Variant positions (genetic map distance).
""",
]
min_ehh: TypeAlias = Annotated[
float,
"""
Minimum EHH beyond which to truncate integrated haplotype homozygosity
calculation.
""",
]
min_ehh_default: min_ehh = 0.05
max_gap: TypeAlias = Annotated[
int,
"""
Do not report scores if EHH spans a gap larger than this number of
base pairs.
""",
]
max_gap_default: max_gap = 200_000
gap_scale: TypeAlias = Annotated[
int, "Rescale distance between variants if gap is larger than this value."
]
gap_scale_default: gap_scale = 20_000
include_edges: TypeAlias = Annotated[
bool,
"""
If True, report scores even if EHH does not decay below min_ehh at the
end of the chromosome.
""",
]
use_threads: TypeAlias = Annotated[
bool, "If True, use multiple threads to compute XP-EHH."
]
palette: TypeAlias = Annotated[
str, "Name of bokeh palette to use for plotting multiple percentiles."
]
palette_default: palette = "Blues"
Loading

0 comments on commit 415eae2

Please sign in to comment.