Error during the command "redbiom fetch samples"

Greetings!

I wanted to check out the redbiom tool to extract the soil data and sort by abundance in order to get the top 50 genera in the data.

From that, I can create an artificial community with known composition. From there, I can proceed with InSilicoSeq to benchmark my parameters in qiime2.

But during the process, I kept getting this error:

Traceback (most recent call last):
File "/home/quan/miniconda3/bin/redbiom", line 10, in
sys.exit(cli())
^^^^^
File "/home/quan/miniconda3/lib/python3.12/site-packages/click/core.py", line 1442, in call
return self.main(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/quan/miniconda3/lib/python3.12/site-packages/click/core.py", line 1363, in main
rv = self.invoke(ctx)
^^^^^^^^^^^^^^^^
File "/home/quan/miniconda3/lib/python3.12/site-packages/click/core.py", line 1830, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/quan/miniconda3/lib/python3.12/site-packages/click/core.py", line 1830, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/quan/miniconda3/lib/python3.12/site-packages/click/core.py", line 1226, in invoke
return ctx.invoke(self.callback, **ctx.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/quan/miniconda3/lib/python3.12/site-packages/click/core.py", line 794, in invoke
return callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/quan/miniconda3/lib/python3.12/site-packages/redbiom/commands/fetch.py", line 225, in fetch_samples_from_samples
table, ambig = redbiom.fetch.data_from_samples(context, iterable,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/quan/miniconda3/lib/python3.12/site-packages/redbiom/fetch.py", line 306, in data_from_samples
return _biom_from_samples(context, samples, skip_taxonomy=skip_taxonomy)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/quan/miniconda3/lib/python3.12/site-packages/redbiom/fetch.py", line 399, in _biom_from_samples
table.update_ids(rimap)
File "/home/quan/miniconda3/lib/python3.12/site-packages/biom/table.py", line 1425, in update_ids
max_str_len = max([len(v) for v in id_map.values()])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: max() iterable argument is empty

The command I used was:

export CTX=Deblur_2021.09-Illumina-16S-V3-V4-250nt-8b2bff
redbiom search metadata "where empo_3=='Soil (non-saline)'" > soil_samples.txt
redbiom fetch samples --from soil_samples.txt --context $CTX --output soil_samples.biom

I also tried to change the context:
Deblur_2021.09-Illumina-16S-V3-V4-150nt-ac8c0b
Pick_closed-reference_OTUs-Greengenes-ILLUMINA-16S-V3-V4-150nt-bd7d4d

I also tried the context in the Redbiom github:

export ctx=Pick_closed-reference_OTUs-Greengenes-Illumina-16S-V4-5c6506
redbiom search metadata beer | redbiom fetch samples --context $ctx --output example.biom

The result is also an error: Traceback (most recent call last):
File "/home/quan/miniconda3/bin/redbiom", line 10, in
sys.exit(cli())
^^^^^
File "/home/quan/miniconda3/lib/python3.12/site-packages/click/core.py", line 1442, in call
return self.main(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/quan/miniconda3/lib/python3.12/site-packages/click/core.py", line 1363, in main
rv = self.invoke(ctx)
^^^^^^^^^^^^^^^^
File "/home/quan/miniconda3/lib/python3.12/site-packages/click/core.py", line 1830, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/quan/miniconda3/lib/python3.12/site-packages/click/core.py", line 1830, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/quan/miniconda3/lib/python3.12/site-packages/click/core.py", line 1226, in invoke
return ctx.invoke(self.callback, **ctx.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/quan/miniconda3/lib/python3.12/site-packages/click/core.py", line 794, in invoke
return callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/quan/miniconda3/lib/python3.12/site-packages/redbiom/commands/fetch.py", line 225, in fetch_samples_from_samples
table, ambig = redbiom.fetch.data_from_samples(context, iterable,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/quan/miniconda3/lib/python3.12/site-packages/redbiom/fetch.py", line 306, in data_from_samples
return _biom_from_samples(context, samples, skip_taxonomy=skip_taxonomy)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/quan/miniconda3/lib/python3.12/site-packages/redbiom/fetch.py", line 367, in biom_from_samples
data = se(fetch_sample, 0, context, id
)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/quan/miniconda3/lib/python3.12/site-packages/redbiom/_requests.py", line 112, in f
return json.loads(req.json()['EVALSHA'])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/quan/miniconda3/lib/python3.12/json/init.py", line 339, in loads
raise TypeError(f'the JSON object must be str, bytes or bytearray, '
TypeError: the JSON object must be str, bytes or bytearray, not list

I'm kinda stuck with this. I also don't know if my approach toward my matter is correct or not as well :frowning:

Hello @Shinthotrang,

First of all, an apology for the ridiculous slow reply.

That error normally means that no samples were found and in this case is because those samples do not exist in those contexts you tested. If you use: export CTX=Deblur_2021.09-Illumina-16S-V4-100nt-50b3a2, you should found the samples.

As a reminder, context are created based on the metadata (preparation) and processing provided in Qiita; this might help: An explanation of contexts in redbiom and Qiita. — qiita 2025.07 documentation .

Best,

1 Like

Greetings @antgonza,

Thank you for your answer! I tried another approach and it kinda work out for me in the end. But still, I appreciate for enlightening me about contexts and providing me resources to read more about them <3.

Once again, thank you, and I wish you a nice day.

1 Like