biom_to_tab KeyError: 'matrix_type'
Xiaoyu2425 opened this issue · 5 comments
Hi there,
I use "mg-compare-functions.py" to retrieve functional abundance matrix for multiple metagenomes.
My commands
export PYTHONHTTPSVERIFY=0
mg-compare-functions.py --ids "mgm4440826.3,mgm4440595.4,mgm4440616.3,mgm4440824.3,mgm4440611.3,mgm4440452.7,mgm4440613.3,mgm4440461.5,mgm4440639.3,mgm4440823.3,mgm4440462.5,mgm4440610.3,mgm4440825.3,mgm4440614.3,mgm4440640.3,mgm4440453.6,mgm4440460.5,mgm4440615.3" --level level2 --source KO --evalue 5 --identity 65 --format text --length 50 --output level2_output
The output
Making request https://api.mg-rast.org//matrix/function?group_level=level2&source=KO&evalue=5&identity=65&length=50&version=1&result_type=abundance&asynchronous=1&id=mgm4440826.3&id=mgm4440595.4&id=mgm4440616.3&id=mgm4440824.3&id=mgm4440611.3&id=mgm4440452.7&id=mgm4440613.3&id=mgm4440461.5&id=mgm4440639.3&id=mgm4440823.3&id=mgm4440462.5&id=mgm4440610.3&id=mgm4440825.3&id=mgm4440614.3&id=mgm4440640.3&id=mgm4440453.6&id=mgm4440460.5&id=mgm4440615.3
Making request https://api.mg-rast.org//status/bcc90edf-80e6-445e-895f-c3a36b679659
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/2.7/bin/mg-compare-functions.py", line 4, in
import('pkg_resources').run_script('mglib==1.1', 'mg-compare-functions.py')
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pkg_resources/init.py", line 664, in run_script
self.require(requires)[0].run_script(script_name, ns)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pkg_resources/init.py", line 1451, in run_script
exec(script_code, namespace, namespace)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/mglib-1.1-py2.7.egg/EGG-INFO/scripts/mg-compare-functions.py", line 176, in
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/mglib-1.1-py2.7.egg/EGG-INFO/scripts/mg-compare-functions.py", line 169, in main
File "build/bdist.macosx-10.9-x86_64/egg/mglib/mglib.py", line 217, in biom_to_tab
KeyError: 'matrix_type'
More information
The computer I use is Mac 10.14.3.
I tried the same commands for many times. Mysteriously, it successfully returned an expected txt file for abundance matrix for once. But for all the other times this matrix_type KeyError happened repeatedly.
I also tried to specify the format as "--format biom" but it didn't work either.
Could you please kindly help take a look at what goes wrong there? Thank you so much!
I think I see two problems; one is a problem handling slow responses from the server, which results in incomplete data giving the error you report above, and another problem where the data that does come back is not parsed properly. An update fixing these will come soon.
Sounds very likely - Thank you so much for you quick response and I look forward to the update version.
Looking into it, there was just the one problem, interpreting slow server responses. This should be fixed by #206. Can you test and let us know if it works for you?
Thank you for fixing this! I tried the updated version and found this message show up repeatedly for hundreds of times
Making request https://api.mg-rast.org//status/979e2183-347f-4bee-b91b-424f0cc632cd
Making request https://api.mg-rast.org//status/979e2183-347f-4bee-b91b-424f0cc632cd
Making request https://api.mg-rast.org//status/979e2183-347f-4bee-b91b-424f0cc632cd
Making request https://api.mg-rast.org//status/979e2183-347f-4bee-b91b-424f0cc632cd
Making request https://api.mg-rast.org//status/979e2183-347f-4bee-b91b-424f0cc632cd
Making request https://api.mg-rast.org//status/979e2183-347f-4bee-b91b-424f0cc632cd
Is this because there is problem in the server?
These are informational messages that say that the client is waiting for a response from the server. Some server responses are not instantaneous, and can't be handled before a single HTTP request times out. So the client asks again and again until the data is ready.