Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
d4a6641
fix(opentargets): give drug synonyms a GraphQL sub-selection (HTTP 40…
Elarwei001 Jun 24, 2026
080045f
fix(archs4): tolerate missing 'color' column in tissue expression (#d…
Elarwei001 Jun 25, 2026
2d63b41
fix(opentargets): use baselineExpression for the expression resource
Elarwei001 Jun 25, 2026
6bc958e
test(opentargets): loosen live-data assertions to structural/invarian…
Elarwei001 Jun 25, 2026
73ba759
test: assert live-data contracts for CI repair
Elarwei001 Jun 25, 2026
daea285
test: retry ELM live setup downloads
Elarwei001 Jun 25, 2026
2a8a2b7
test: keep OpenTargets expression semantics out of CI repair
Elarwei001 Jun 25, 2026
d1e6636
test(opentargets): add semantic anchors + score tolerance to live-dat…
Elarwei001 Jun 26, 2026
330f662
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jun 26, 2026
0bb52d4
test(opentargets): rewrite live-data tests as explicit IL13 assertion…
Elarwei001 Jun 26, 2026
ae871e3
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jun 26, 2026
bf7a25e
test(opentargets): read gene from fixture + guard to IL13; drop dupli…
Elarwei001 Jun 26, 2026
3347a25
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jun 26, 2026
3b686b0
test(archs4): rewrite live tissue tests as concrete fixture-driven ch…
Elarwei001 Jun 26, 2026
6b40955
fix(archs4): deterministic tissue sort via id tiebreaker; restore exa…
Elarwei001 Jun 26, 2026
aa1f148
Drop opentargets fixes from this PR (now covered by #256)
lauraluebbert Jun 26, 2026
d640bff
test(archs4): drop the redundant with-color companion test
lauraluebbert Jun 26, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/src/en/updates.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
- [`gget pdb`](pdb.md): Added support for the PDBx/mmCIF structure format (fixes [issue 178](https://github.com/scverse/gget/issues/178) and [issue 177](https://github.com/scverse/gget/issues/177)).
- New `resource="mmcif"` option downloads the structure in PDBx/mmCIF format (`.cif`).
- The default `resource="pdb"` now automatically falls back to PDBx/mmCIF when the legacy PDB file is unavailable (e.g. for large structures), since the legacy PDB format is being phased out by RCSB. A warning is logged and saved files use the correct extension (`.cif`).
- [`gget archs4`](archs4.md) (tissue mode): No longer crashes with `KeyError: ['color'] not found in axis` when ARCHS4 intermittently omits the optional `color` column from its CSV response. The column is now dropped only if present. Output also has a deterministic row order (sorted by `median` descending, with `id` as tiebreaker) so equal-median tissues no longer flip order between requests.


**Version ≥ 0.30.7** (Jun 21, 2026):
Expand Down
14 changes: 9 additions & 5 deletions gget/gget_archs4.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,11 +200,15 @@ def archs4(
# Drop NaN rows
tissue_exp_df = tissue_exp_df.dropna()

# Drop color columns
tissue_exp_df = tissue_exp_df.drop(["color"], axis=1)

# Sort data frame by median expression
tissue_exp_df = tissue_exp_df.sort_values("median", ascending=False)
# Drop the "color" column if present (only used for plotting upstream, not by gget).
# ARCHS4 intermittently omits this column; use errors="ignore" so a missing
# "color" column does not raise a KeyError and crash the request.
tissue_exp_df = tissue_exp_df.drop(columns=["color"], errors="ignore")

# Sort data frame by median expression. Use "id" as a stable tiebreaker so the row
# order is deterministic when several tissues share the same median (ARCHS4 returns
# tied rows in a varying order between requests otherwise).
tissue_exp_df = tissue_exp_df.sort_values(["median", "id"], ascending=[False, True])
tissue_exp_df = tissue_exp_df.reset_index(drop=True)

if json:
Expand Down
162 changes: 81 additions & 81 deletions tests/fixtures/test_archs4.json
Original file line number Diff line number Diff line change
Expand Up @@ -598,14 +598,6 @@
7.62057,
8.60009
],
[
"System.Nervous System.CNS.THALAMUS",
3.29066,
5.995,
7.14836,
7.83426,
8.71165
],
[
"System.Nervous System.CNS.HYPOTHALAMUS",
3.44188,
Expand All @@ -614,6 +606,14 @@
7.99022,
8.81727
],
[
"System.Nervous System.CNS.THALAMUS",
3.29066,
5.995,
7.14836,
7.83426,
8.71165
],
[
"System.Immune System.Lymphoid.BLYMPHOCYTE",
5.57377,
Expand Down Expand Up @@ -678,14 +678,6 @@
7.42671,
8.89625
],
[
"System.Immune System.Lymphoid.TLYMPHOCYTE",
5.60813,
6.60849,
6.9754,
7.26685,
7.85409
],
[
"System.Connective Tissue.Bone marrow.CHONDROCYTE",
5.93985,
Expand All @@ -694,6 +686,14 @@
7.44552,
8.78176
],
[
"System.Immune System.Lymphoid.TLYMPHOCYTE",
5.60813,
6.60849,
6.9754,
7.26685,
7.85409
],
[
"System.Immune System.Myeloid.MACROPHAGE",
0.113644,
Expand All @@ -702,14 +702,6 @@
7.38198,
8.46912
],
[
"System.Respiratory System.Lung.LUNG",
0.113644,
5.88569,
6.95675,
7.7752,
9.18212
],
[
"System.Nervous System.CNS.ASTROCYTE",
1.20968,
Expand All @@ -718,6 +710,14 @@
7.42671,
8.33012
],
[
"System.Respiratory System.Lung.LUNG",
0.113644,
5.88569,
6.95675,
7.7752,
9.18212
],
[
"System.Connective Tissue.Adipose tissue.ADIPOSE",
4.26947,
Expand Down Expand Up @@ -766,14 +766,6 @@
7.98803,
9.42561
],
[
"System.Immune System.Myeloid.DENDRITIC CELL",
4.2942,
6.48802,
6.88087,
7.39734,
8.09957
],
[
"System.Connective Tissue.Adipose tissue.ADIPOCYTE",
4.86561,
Expand All @@ -782,6 +774,14 @@
7.13293,
7.71929
],
[
"System.Immune System.Myeloid.DENDRITIC CELL",
4.2942,
6.48802,
6.88087,
7.39734,
8.09957
],
[
"System.Immune System.Myeloid.MICROGLIA",
0.113644,
Expand All @@ -798,14 +798,6 @@
7.10033,
7.57266
],
[
"System.Integumentary System.Skin.FIBROBLAST",
0.113644,
6.35023,
6.8453,
7.43403,
9.31767
],
[
"System.Digestive System.Esophagus.ESOPHAGUS",
0.113644,
Expand All @@ -814,6 +806,14 @@
8.1174,
9.13015
],
[
"System.Integumentary System.Skin.FIBROBLAST",
0.113644,
6.35023,
6.8453,
7.43403,
9.31767
],
[
"System.Immune System.Myeloid.KUPFFER CELL",
6.16327,
Expand Down Expand Up @@ -1184,14 +1184,6 @@
"q3": 7.62057,
"max": 8.60009
},
{
"id": "System.Nervous System.CNS.THALAMUS",
"min": 3.29066,
"q1": 5.995,
"median": 7.14836,
"q3": 7.83426,
"max": 8.71165
},
{
"id": "System.Nervous System.CNS.HYPOTHALAMUS",
"min": 3.44188,
Expand All @@ -1200,6 +1192,14 @@
"q3": 7.99022,
"max": 8.81727
},
{
"id": "System.Nervous System.CNS.THALAMUS",
"min": 3.29066,
"q1": 5.995,
"median": 7.14836,
"q3": 7.83426,
"max": 8.71165
},
{
"id": "System.Immune System.Lymphoid.BLYMPHOCYTE",
"min": 5.57377,
Expand Down Expand Up @@ -1264,14 +1264,6 @@
"q3": 7.42671,
"max": 8.89625
},
{
"id": "System.Immune System.Lymphoid.TLYMPHOCYTE",
"min": 5.60813,
"q1": 6.60849,
"median": 6.9754,
"q3": 7.26685,
"max": 7.85409
},
{
"id": "System.Connective Tissue.Bone marrow.CHONDROCYTE",
"min": 5.93985,
Expand All @@ -1280,6 +1272,14 @@
"q3": 7.44552,
"max": 8.78176
},
{
"id": "System.Immune System.Lymphoid.TLYMPHOCYTE",
"min": 5.60813,
"q1": 6.60849,
"median": 6.9754,
"q3": 7.26685,
"max": 7.85409
},
{
"id": "System.Immune System.Myeloid.MACROPHAGE",
"min": 0.113644,
Expand All @@ -1288,14 +1288,6 @@
"q3": 7.38198,
"max": 8.46912
},
{
"id": "System.Respiratory System.Lung.LUNG",
"min": 0.113644,
"q1": 5.88569,
"median": 6.95675,
"q3": 7.7752,
"max": 9.18212
},
{
"id": "System.Nervous System.CNS.ASTROCYTE",
"min": 1.20968,
Expand All @@ -1304,6 +1296,14 @@
"q3": 7.42671,
"max": 8.33012
},
{
"id": "System.Respiratory System.Lung.LUNG",
"min": 0.113644,
"q1": 5.88569,
"median": 6.95675,
"q3": 7.7752,
"max": 9.18212
},
{
"id": "System.Connective Tissue.Adipose tissue.ADIPOSE",
"min": 4.26947,
Expand Down Expand Up @@ -1352,14 +1352,6 @@
"q3": 7.98803,
"max": 9.42561
},
{
"id": "System.Immune System.Myeloid.DENDRITIC CELL",
"min": 4.2942,
"q1": 6.48802,
"median": 6.88087,
"q3": 7.39734,
"max": 8.09957
},
{
"id": "System.Connective Tissue.Adipose tissue.ADIPOCYTE",
"min": 4.86561,
Expand All @@ -1368,6 +1360,14 @@
"q3": 7.13293,
"max": 7.71929
},
{
"id": "System.Immune System.Myeloid.DENDRITIC CELL",
"min": 4.2942,
"q1": 6.48802,
"median": 6.88087,
"q3": 7.39734,
"max": 8.09957
},
{
"id": "System.Immune System.Myeloid.MICROGLIA",
"min": 0.113644,
Expand All @@ -1384,14 +1384,6 @@
"q3": 7.10033,
"max": 7.57266
},
{
"id": "System.Integumentary System.Skin.FIBROBLAST",
"min": 0.113644,
"q1": 6.35023,
"median": 6.8453,
"q3": 7.43403,
"max": 9.31767
},
{
"id": "System.Digestive System.Esophagus.ESOPHAGUS",
"min": 0.113644,
Expand All @@ -1400,6 +1392,14 @@
"q3": 8.1174,
"max": 9.13015
},
{
"id": "System.Integumentary System.Skin.FIBROBLAST",
"min": 0.113644,
"q1": 6.35023,
"median": 6.8453,
"q3": 7.43403,
"max": 9.31767
},
{
"id": "System.Immune System.Myeloid.KUPFFER CELL",
"min": 6.16327,
Expand Down Expand Up @@ -2614,4 +2614,4 @@
},
"expected_result": "ValueError"
}
}
}
23 changes: 23 additions & 0 deletions tests/test_archs4.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import json
import unittest
from unittest.mock import patch

from gget.gget_archs4 import archs4

Expand All @@ -12,3 +13,25 @@

class TestArchs4(unittest.TestCase, metaclass=from_json(archs4_dict, archs4)):
pass # all tests are loaded from json


class _FakeResponse:
def __init__(self, text):
self.ok = True
self.content = text.encode("utf-8")


class TestArchs4MissingColor(unittest.TestCase):
"""Network-free regression tests: ARCHS4 intermittently omits the 'color' column from
the tissue-expression CSV. gget must not crash with a KeyError when it is absent
(the 'color' column is dropped and never used)."""

_CSV_NO_COLOR = "id,min,q1,median,q3,max\nTissueA,0,1,5,9,10\nTissueB,0,2,8,12,15\n"

def test_tissue_missing_color_does_not_crash(self):
with patch("gget.gget_archs4.requests.post", return_value=_FakeResponse(self._CSV_NO_COLOR)):
df = archs4("STAT4", which="tissue", verbose=False)
# Returns a valid, sorted data frame without a 'color' column (no KeyError).
self.assertEqual(len(df), 2)
self.assertNotIn("color", df.columns)
self.assertEqual(df.iloc[0]["id"], "TissueB") # sorted by median descending
10 changes: 9 additions & 1 deletion tests/test_elm.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import json
import time
import unittest

from gget.gget_elm import elm
Expand All @@ -8,7 +9,14 @@
with open("./tests/fixtures/test_elm.json") as json_file:
elm_dict = json.load(json_file)

gget_setup(module="elm")
for attempt in range(3):
try:
gget_setup(module="elm")
break
except RuntimeError as exc:
if "ELM database files download failed" not in str(exc) or attempt == 2:
raise
time.sleep(30)


class TestELM(unittest.TestCase):
Expand Down
Loading