This is a test version of Biostars. For the public version, visit https://www.biostars.org.
MG-RAST API - Problem with space characters in gene names at URL

The MG-RAST API gives you the option to download organisms abundance for specific genes from the "Matrix" section, using always the linux command 'curl'. Example at the taxonomic level 'class' for the gene called 'Integrase':

curl -X GET -H "auth: user_key" "http://api.metagenomics.anl.gov/1/matrix/organism?id=mgm_1_number&id=mgm_2_number&group_level=class&result_type=abundance&filter=Integrase&filter_level=function&filter_source=Subsystems" > file_name.biom

The problem comes when the gene name you need has space characters, e.g., filter=DNA Polymerase. It is an URL, so I tried filter=DNA%20Polymerase and filter=DNA+Polymerase, but it didn't work. The output was always: {"ERROR":"no data found for the given combination of ids and paramaters"}

Any help will be very appreciated. All the best, fibar

mg-rast matrix abundance api

What about if you use single quotes instead of double quotes for the url?

It ended up being an MG-RAST problem, which was solved later by them.

Using %20 as space character is correct. Thanks for the comments.

1 answer

%20 should work. Alternatively, you could also try the --data-urlencode option of curl. Also, the error message says there is no data for the given request so have you considered that there may be no data matching your request ?

Log in to answer this question.