Skip to content

Commit

Permalink
Handle missing VALUE in value_x dict (#223)
Browse files Browse the repository at this point in the history
* pysradb/sraweb.py: adding a default None value when VALUE is not a key in the value_x dict; this works for the test case in issue #222

* Drop Python 3.7, 3.8

* Update release notes

* Update release notes

* Suppress ena search test

---------

Co-authored-by: Saket Choudhary <[email protected]>
  • Loading branch information
andrewdavidsmith and saketkc authored Oct 25, 2024
1 parent 35dbf24 commit 85abf88
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.7, 3.8, 3.9, '3.10', '3.11']
python-version: [3.9, '3.10', '3.11']

steps:
- uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.7, 3.8, 3.9, '3.10', '3.11']
python-version: [3.9, '3.10', '3.11']

steps:
- uses: actions/checkout@v2
Expand Down
3 changes: 3 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# History

# UNRELEASED
- Fix for handling missing metadata keys [#223](https://github.com/saketkc/pysradb/pull/223). Thanks [@andrewdavidsmith](https://github.com/andrewdavidsmith)

# 2.2.2 (2024-10-03)
- Fix for handling ENA urls for paired end data

Expand Down
4 changes: 1 addition & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ dynamic = ["version"]
description = "A Python package for interacting with SRAdb and downloading datasets from SRA/ENA/GEO"
readme = "README.md"
license = {file = "LICENSE"}
requires-python = ">=3.7"
requires-python = ">=3.9"
authors = [
{ name = "Saket Choudhary", email = "[email protected]" },
]
Expand All @@ -22,8 +22,6 @@ classifiers = [
"License :: OSI Approved :: BSD License",
"Natural Language :: English",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
Expand Down
2 changes: 1 addition & 1 deletion pysradb/sraweb.py
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,7 @@ def sra_metadata(
if not isinstance(value_x, dict):
continue
tag = value_x["TAG"].lower()
value = value_x["VALUE"]
value = value_x["VALUE"] if "VALUE" in value_x else None
detailed_record[tag] = value
lib_record = exp_record["DESIGN"]["LIBRARY_DESCRIPTOR"]
for key, value in lib_record.items():
Expand Down
4 changes: 2 additions & 2 deletions tests/test_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -1074,7 +1074,7 @@ def _test_ena_search_3(capsys):
)


def test_valid_search_query_1_ena(valid_search_inputs_1):
def _test_valid_search_query_1_ena(valid_search_inputs_1):
expected_query = [
'(experiment_title="*covid-19*" OR study_accession="COVID-19" OR secondary_study_accession="COVID-19" OR'
' sample_accession="COVID-19" OR secondary_sample_accession="COVID-19" OR experiment_accession="COVID-19" OR'
Expand Down Expand Up @@ -1102,7 +1102,7 @@ def test_valid_search_query_1_ena(valid_search_inputs_1):
)


def test_valid_search_query_2_ena(valid_search_inputs_2):
def _test_valid_search_query_2_ena(valid_search_inputs_2):
expected_query = [
'library_layout="TRIPLE"',
'(experiment_title="*Escherichia coli*") AND (study_accession="SRS6898222" OR '
Expand Down

0 comments on commit 85abf88

Please sign in to comment.