biocore / redbiom

Sample search by metadata and features
Other
44 stars 20 forks source link

A particular sample always crashes for me #117

Closed BenKaehler closed 1 year ago

BenKaehler commented 2 years ago

Hi folks, sorry to leave another bug, but I seem to be having trouble fetching some samples. Many thousands of others I have downloaded over the past couple of weeks were fine, but specifically human oral (or Animal secretion) samples with ids matching '\.raw' fail. Perhaps not all of them, but excluding all 172 of them seems to make the other ~17k (~24k for Animal secretion) samples download without problems. This was the first example I found:

$ redbiom --version
redbiom, version 0.3.8
$ echo $context 
Deblur_2021.09-Illumina-16S-V4-150nt-ac8c0b
$ redbiom fetch samples --context $context --output samples.biom 11896.A2.raw
Traceback (most recent call last):
  File "/home/ben/miniconda3/envs/qiime2-2022.2/bin/redbiom", line 10, in <module>
    sys.exit(cli())
  File "/home/ben/miniconda3/envs/qiime2-2022.2/lib/python3.8/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/home/ben/miniconda3/envs/qiime2-2022.2/lib/python3.8/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/home/ben/miniconda3/envs/qiime2-2022.2/lib/python3.8/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/ben/miniconda3/envs/qiime2-2022.2/lib/python3.8/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/ben/miniconda3/envs/qiime2-2022.2/lib/python3.8/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/ben/miniconda3/envs/qiime2-2022.2/lib/python3.8/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/home/ben/miniconda3/envs/qiime2-2022.2/lib/python3.8/site-packages/redbiom/commands/fetch.py", line 203, in fetch_samples_from_samples
    table, ambig = redbiom.fetch.data_from_samples(context, iterable,
  File "/home/ben/miniconda3/envs/qiime2-2022.2/lib/python3.8/site-packages/redbiom/fetch.py", line 306, in data_from_samples
    return _biom_from_samples(context, samples, skip_taxonomy=skip_taxonomy)
  File "/home/ben/miniconda3/envs/qiime2-2022.2/lib/python3.8/site-packages/redbiom/fetch.py", line 367, in _biom_from_samples
    data = se(fetch_sample, 0, context, id_)
  File "/home/ben/miniconda3/envs/qiime2-2022.2/lib/python3.8/site-packages/redbiom/_requests.py", line 110, in f
    return json.loads(_parse_validate_request(s.get(url), 'EVALSHA'))
  File "/home/ben/miniconda3/envs/qiime2-2022.2/lib/python3.8/site-packages/redbiom/_requests.py", line 6, in _parse_validate_request
    return req.json()[command]
  File "/home/ben/miniconda3/envs/qiime2-2022.2/lib/python3.8/site-packages/requests/models.py", line 899, in json
    return complexjson.loads(
  File "/home/ben/miniconda3/envs/qiime2-2022.2/lib/python3.8/json/__init__.py", line 357, in loads
    return _default_decoder.decode(s)
  File "/home/ben/miniconda3/envs/qiime2-2022.2/lib/python3.8/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/home/ben/miniconda3/envs/qiime2-2022.2/lib/python3.8/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Thanks very much for looking at this!

wasade commented 2 years ago

Thanks! What's happening is this, see also here for command structure. What I suspect is needed is to switch the script exec call to POST and place the arguments in the body. We've done this for some but apparently not all queries.

sscansan commented 1 year ago

This is what I was looking for, had the same problem, and deleted the issue I opened. Thanks

wasade commented 1 year ago

Thanks for the bump, @sscansan! It's on my radar, but I haven't yet had bandwidth to resolve outstanding issues with redbiom. A new release is clearly needed.