Skip to content

Commit 64eb5ea

Browse files
committed
Changed the error for Af
1 parent 19e99bc commit 64eb5ea

File tree

5 files changed

+12
-9
lines changed

5 files changed

+12
-9
lines changed

malariagen_data/af1.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ def __init__(
123123
taxon_colors=TAXON_COLORS,
124124
virtual_contigs=None,
125125
gene_names=None,
126+
inversion_tag_path=None,
126127
)
127128

128129
def __repr__(self):

malariagen_data/ag3.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import malariagen_data
88
from .anopheles import AnophelesDataResource
99

10-
from typing import Literal, Annotated, TypeAlias
1110

1211
# silence dask performance warnings
1312
dask.config.set(**{"array.slicing.split_native_chunks": False}) # type: ignore
@@ -29,6 +28,7 @@
2928
GENE_NAMES = {
3029
"AGAP004707": "Vgsc/para",
3130
}
31+
INVERSION_TAG_PATH = "karyotype_tag_snps.csv"
3232

3333

3434
def _setup_aim_palettes():
@@ -77,12 +77,6 @@ def _setup_aim_palettes():
7777
}
7878

7979

80-
inversion_param: TypeAlias = Annotated[
81-
Literal["2La", "2Rb", "2Rc_gam", "2Rc_col", "2Rd", "2Rj"],
82-
"Name of inversion to infer karyotype for.",
83-
]
84-
85-
8680
class Ag3(AnophelesDataResource):
8781
"""Provides access to data from Ag3.x releases.
8882
@@ -197,6 +191,7 @@ def __init__(
197191
taxon_colors=TAXON_COLORS,
198192
virtual_contigs=VIRTUAL_CONTIGS,
199193
gene_names=GENE_NAMES,
194+
inversion_tag_path=INVERSION_TAG_PATH,
200195
)
201196

202197
# set up caches

malariagen_data/anoph/karyotype.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,18 @@
1515
class AnophelesKaryotypeData(AnophelesSnpData):
1616
def __init__(
1717
self,
18+
inversion_tag_path: Optional[str] = None,
1819
**kwargs,
1920
):
2021
# N.B., this class is designed to work cooperatively, and
2122
# so it's important that any remaining parameters are passed
2223
# to the superclass constructor.
2324
super().__init__(**kwargs)
2425

26+
# If provided, this analysis version will override the
27+
# default value provided in the release configuration.
28+
self._inversion_tag_path = inversion_tag_path
29+
2530
@check_types
2631
@doc(
2732
summary="Load tag SNPs for a given inversion in Ag.",
@@ -31,7 +36,7 @@ def load_inversion_tags(self, inversion: inversion_param) -> pd.DataFrame:
3136
import importlib.resources
3237
from .. import resources
3338

34-
with importlib.resources.path(resources, "karyotype_tag_snps.csv") as path:
39+
with importlib.resources.path(resources, self._inversion_tag_path) as path:
3540
df_tag_snps = pd.read_csv(path, sep=",")
3641
return df_tag_snps.query(f"inversion == '{inversion}'").reset_index()
3742

malariagen_data/anopheles.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ def __init__(
140140
taxon_colors: Optional[Mapping[str, str]],
141141
virtual_contigs: Optional[Mapping[str, Sequence[str]]],
142142
gene_names: Optional[Mapping[str, str]],
143+
inversion_tag_path: Optional[str],
143144
):
144145
super().__init__(
145146
url=url,
@@ -173,6 +174,7 @@ def __init__(
173174
taxon_colors=taxon_colors,
174175
virtual_contigs=virtual_contigs,
175176
gene_names=gene_names,
177+
inversion_tag_path=inversion_tag_path,
176178
)
177179

178180
@property

tests/integration/test_af1.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def test_karyotyping(inversion):
9090
inversion=inversion, sample_sets="AG1000G-GH", sample_query=None
9191
)
9292
else:
93-
with pytest.raises(ValueError):
93+
with pytest.raises(FileNotFoundError):
9494
af1.karyotype(
9595
inversion=inversion,
9696
sample_sets="1229-VO-GH-DADZIE-VMF00095",

0 commit comments

Comments
 (0)