Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible missing keys in esearch response results #194

Open
andrewdavidsmith opened this issue Jun 5, 2023 · 1 comment
Open

Possible missing keys in esearch response results #194

andrewdavidsmith opened this issue Jun 5, 2023 · 1 comment

Comments

@andrewdavidsmith
Copy link
Collaborator

n_records = int(esearch_response["esearchresult"]["count"])

I can't reproduce this, but I had a random event of:

File "/Users/aaaaaa/.venv/lib/python3.11/site-packages/pysradb/sraweb.py", line 339, in get_efetch_response
    n_records = int(esearch_response["esearchresult"]["count"])
                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
KeyError: 'count'

line numbers are off by one from the current repo, so I might be slightly behind on this error. Rerunning immediately after worked fine.

@dpbastedo
Copy link

I have encountered a similar error when using pysradb metadata <accession list> --detailed > SRA_info.txt to query batches of multiple accessions at once:
File "/home/[user]/.conda/envs/pySRAdb/lib/python3.11/site-packages/pysradb/sraweb.py", line 437, in sra_metadata exp_summary = exp_json["Summary"] ~~~~~~~~^^^^^^^^^^^ KeyError: 'Summary'

In this case the error is caused by inclusion of SRR8866477 in the accession list, presumably because the record is not public. It would be preferable to return a nan instead of an error here so that it would still be possible to query in batches even if not all keys are found for each query accession in the batch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants