Skip to content

Commit dc2f309

Browse files
committed
merge: resolve conflicts with master in anopheles.py
2 parents 8bd4e6c + 38059ff commit dc2f309

55 files changed

Lines changed: 3595 additions & 693 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
.idea
22
.vscode
33
__pycache__
4+
.mypy_cache
45
*.pyc
56
dist
7+
.venv/
68
.coverage
79
coverage.xml
810
.ipynb_checkpoints/

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ To get setup for development, see [this video if you prefer VS Code](https://you
4949
For detailed setup instructions, see:
5050
- [Linux setup guide](LINUX_SETUP.md)
5151
- [macOS setup guide](MACOS_SETUP.md)
52+
- [Windows setup guide](WINDOWS_SETUP.md)
53+
- [Google Colab (TPU) setup guide](docs/source/colab_tpu_runtime.rst)
5254
Detailed instructions can be found in the [Contributors guide](https://github.com/malariagen/malariagen-data-python/blob/master/CONTRIBUTING.md).
5355

5456
## AI use policy and guidelines

WINDOWS_SETUP.md

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
# Windows Setup Guide
2+
3+
To get setup for development on Windows, see
4+
[this video if you prefer VS Code](https://youtu.be/zddl3n1DCFM),
5+
or [this older video if you prefer PyCharm](https://youtu.be/QniQi-Hoo9A),
6+
and the instructions below.
7+
8+
## 1. Fork and clone this repo
9+
```bash
10+
git clone https://github.com/[username]/malariagen-data-python.git
11+
cd malariagen-data-python
12+
```
13+
14+
## 2. Install Python
15+
16+
Download and install Python 3.10 from the official website:
17+
https://www.python.org/downloads/windows/
18+
19+
During installation, check the box that says Add Python to PATH
20+
before clicking Install.
21+
22+
Verify the installation worked:
23+
```bash
24+
python --version
25+
```
26+
27+
## 3. Install pipx and poetry
28+
```bash
29+
python -m pip install --user pipx
30+
python -m pipx ensurepath
31+
pipx install poetry
32+
```
33+
34+
After running ensurepath, close and reopen PowerShell before continuing.
35+
36+
## 4. Create and activate development environment
37+
```bash
38+
poetry install
39+
poetry shell
40+
```
41+
42+
## 5. Install pre-commit hooks
43+
```bash
44+
pipx install pre-commit
45+
pre-commit install
46+
```
47+
48+
## 6. Add upstream remote and get latest code
49+
```bash
50+
git remote add upstream https://github.com/malariagen/malariagen-data-python
51+
git pull upstream master
52+
```
53+
54+
Note: On Windows the default branch is called master, not main.
55+
56+
## 7. Verify everything works
57+
```bash
58+
python -c "import malariagen_data; print('Setup successful!')"
59+
```
60+
61+
## Common Issues on Windows
62+
63+
**poetry not found after install**
64+
65+
Close and reopen PowerShell, then try again.
66+
67+
**git not recognized**
68+
69+
Install Git from https://git-scm.com/download/win
70+
and restart PowerShell.
71+
72+
**python not recognized**
73+
74+
Reinstall Python and make sure to check
75+
Add Python to PATH during installation.
76+
77+
**fatal: not a git repository**
78+
79+
Make sure you are inside the malariagen-data-python
80+
folder before running any git commands.
81+
```bash
82+
cd malariagen-data-python
83+
```
84+
85+
**error: pathspec main did not match**
86+
87+
On Windows use master instead of main.
88+
```bash
89+
git checkout master
90+
```

docs/source/colab_tpu_runtime.rst

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
Google Colab Installation Guide
2+
===============================
3+
Prerequisites
4+
-------------
5+
6+
Before installing the package, configure the runtime environment
7+
correctly:
8+
9+
1. Open a new notebook in Google Colab.
10+
2. Navigate to ``Runtime → Change runtime type``.
11+
3. Set the runtime configuration as follows:
12+
13+
- **Runtime type:** Python 3
14+
- **Hardware accelerator:** TPU
15+
- **TPU type:** v2-8
16+
17+
4. Click **Save** to apply the configuration.
18+
19+
Using the recommended TPU configuration ensures compatibility with
20+
workflows that may require TPU-based computation.
21+
22+
23+
Installation Procedure
24+
----------------------
25+
26+
In a new notebook cell, install the package:
27+
28+
.. code-block:: bash
29+
30+
!pip install malariagen_data
31+
32+
After installation completes, verify that the package is available:
33+
34+
.. code-block:: python
35+
36+
import malariagen_data
37+
38+
If the import executes without errors, the installation was successful.
39+
40+
If dependency-related warnings or conflicts occur, follow one of the
41+
resolution options described below.
42+
43+
44+
Resolution Options
45+
------------------
46+
47+
Resolution Option 1: Uninstall Panel
48+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
49+
50+
If your notebook does not require ``panel``, uninstall it before
51+
installing ``malariagen_data``.
52+
53+
.. code-block:: bash
54+
55+
!pip uninstall -y panel
56+
!pip install malariagen_data
57+
58+
Verify installation:
59+
60+
.. code-block:: python
61+
62+
import malariagen_data
63+
64+
65+
Resolution Option 2: Install Compatible Panel Version
66+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
67+
68+
If your workflow depends on ``panel``, install a compatible version:
69+
70+
.. code-block:: bash
71+
72+
!pip install panel==1.7.0
73+
!pip install malariagen_data
74+
75+
Restart the runtime:
76+
77+
``Runtime → Restart runtime``
78+
79+
Then verify:
80+
81+
.. code-block:: python
82+
83+
import malariagen_data
84+
85+
86+
Resolution Option 3: Install Required Blinker Version
87+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
88+
89+
If a ``blinker`` version conflict occurs:
90+
91+
.. code-block:: bash
92+
93+
!pip install blinker==1.9.0 --ignore-installed
94+
!pip install malariagen_data
95+
96+
Restart the runtime and verify:
97+
98+
.. code-block:: python
99+
100+
import malariagen_data
101+
102+
103+
Final Verification
104+
------------------
105+
106+
After completing any of the procedures above:
107+
108+
- Ensure that ``malariagen_data`` installs without dependency errors.
109+
- Confirm that ``import malariagen_data`` runs successfully.
110+
- Restart the runtime whenever core dependencies are modified.
111+
- Avoid mixing incompatible package versions within the same Colab session.

malariagen_data/adar1.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,6 @@ def __init__(
130130
tqdm_class=tqdm_class,
131131
taxon_colors=TAXON_COLORS,
132132
virtual_contigs=None,
133-
gene_names=None,
134133
inversion_tag_path=None,
135134
unrestricted_use_only=unrestricted_use_only,
136135
surveillance_use_only=surveillance_use_only,
@@ -182,7 +181,7 @@ def _repr_html_(self):
182181
<th style="text-align: left">
183182
Data releases available
184183
</th>
185-
<td>{', '.join(self._available_releases)}</td>
184+
<td>{", ".join(self._available_releases)}</td>
186185
</tr>
187186
<tr>
188187
<th style="text-align: left">
@@ -230,7 +229,7 @@ def _repr_html_(self):
230229
<th style="text-align: left">
231230
Relevant data releases
232231
</th>
233-
<td>{', '.join(self.releases)}</td>
232+
<td>{", ".join(self.releases)}</td>
234233
</tr>
235234
</tbody>
236235
</table>

malariagen_data/adir1.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,6 @@ def __init__(
130130
tqdm_class=tqdm_class,
131131
taxon_colors=TAXON_COLORS,
132132
virtual_contigs=None,
133-
gene_names=None,
134133
inversion_tag_path=None,
135134
unrestricted_use_only=unrestricted_use_only,
136135
surveillance_use_only=surveillance_use_only,
@@ -182,7 +181,7 @@ def _repr_html_(self):
182181
<th style="text-align: left">
183182
Data releases available
184183
</th>
185-
<td>{', '.join(self._available_releases)}</td>
184+
<td>{", ".join(self._available_releases)}</td>
186185
</tr>
187186
<tr>
188187
<th style="text-align: left">
@@ -230,7 +229,7 @@ def _repr_html_(self):
230229
<th style="text-align: left">
231230
Relevant data releases
232231
</th>
233-
<td>{', '.join(self.releases)}</td>
232+
<td>{", ".join(self.releases)}</td>
234233
</tr>
235234
</tbody>
236235
</table>

malariagen_data/af1.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,6 @@ def __init__(
132132
tqdm_class=tqdm_class,
133133
taxon_colors=TAXON_COLORS,
134134
virtual_contigs=None,
135-
gene_names=None,
136135
inversion_tag_path=None,
137136
unrestricted_use_only=unrestricted_use_only,
138137
surveillance_use_only=surveillance_use_only,
@@ -184,7 +183,7 @@ def _repr_html_(self):
184183
<th style="text-align: left">
185184
Data releases available
186185
</th>
187-
<td>{', '.join(self._available_releases)}</td>
186+
<td>{", ".join(self._available_releases)}</td>
188187
</tr>
189188
<tr>
190189
<th style="text-align: left">
@@ -232,7 +231,7 @@ def _repr_html_(self):
232231
<th style="text-align: left">
233232
Relevant data releases
234233
</th>
235-
<td>{', '.join(self.releases)}</td>
234+
<td>{", ".join(self.releases)}</td>
236235
</tr>
237236
</tbody>
238237
</table>

malariagen_data/ag3.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ def _repr_html_(self):
278278
<th style="text-align: left">
279279
Data releases available
280280
</th>
281-
<td>{', '.join(self._available_releases)}</td>
281+
<td>{", ".join(self._available_releases)}</td>
282282
</tr>
283283
<tr>
284284
<th style="text-align: left">
@@ -332,7 +332,7 @@ def _repr_html_(self):
332332
<th style="text-align: left">
333333
Relevant data releases
334334
</th>
335-
<td>{', '.join(self.releases)}</td>
335+
<td>{", ".join(self.releases)}</td>
336336
</tr>
337337
</tbody>
338338
</table>

malariagen_data/amin1.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,6 @@ def __init__(
130130
tqdm_class=tqdm_class,
131131
taxon_colors=TAXON_COLORS,
132132
virtual_contigs=None,
133-
gene_names=None,
134133
inversion_tag_path=None,
135134
unrestricted_use_only=unrestricted_use_only,
136135
surveillance_use_only=surveillance_use_only,
@@ -182,7 +181,7 @@ def _repr_html_(self):
182181
<th style="text-align: left">
183182
Data releases available
184183
</th>
185-
<td>{', '.join(self.releases)}</td>
184+
<td>{", ".join(self.releases)}</td>
186185
</tr>
187186
<tr>
188187
<th style="text-align: left">
@@ -230,7 +229,7 @@ def _repr_html_(self):
230229
<th style="text-align: left">
231230
Relevant data releases
232231
</th>
233-
<td>{', '.join(self.releases)}</td>
232+
<td>{", ".join(self.releases)}</td>
234233
</tr>
235234
</tbody>
236235
</table>

malariagen_data/anoph/aim_data.py

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,24 @@ def __init__(
4040
# to the superclass constructor.
4141
super().__init__(**kwargs)
4242

43-
# Store possible values for the `aims` parameter.
44-
# TODO Consider moving this to data resource configuration.
45-
self._aim_ids = aim_ids
46-
self._aim_palettes = aim_palettes
43+
# Read AIM parameters from the JSON config, falling back to
44+
# constructor args for backward compatibility.
45+
config = self.config
46+
_aim_ids = config.get("AIM_IDS", None)
47+
if _aim_ids is not None:
48+
self._aim_ids: Optional[aim_params.aim_ids] = tuple(_aim_ids)
49+
else:
50+
self._aim_ids = aim_ids
51+
52+
_aim_palettes = config.get("AIM_PALETTES", None)
53+
if _aim_palettes is not None:
54+
# Convert lists to tuples for each palette entry.
55+
self._aim_palettes: Optional[aim_params.aim_palettes] = {
56+
k: tuple(v)
57+
for k, v in _aim_palettes.items() # type: ignore
58+
}
59+
else:
60+
self._aim_palettes = aim_palettes
4761

4862
# Set up caches.
4963
self._cache_aim_variants: Dict[str, xr.Dataset] = dict()
@@ -341,6 +355,4 @@ def plot_aim_heatmap(
341355

342356
if show: # pragma: no cover
343357
fig.show(renderer=renderer)
344-
return None
345-
else:
346-
return fig
358+
return fig

0 commit comments

Comments
 (0)