Closed mobiusklein closed 8 months ago
Thank you! It appears that on Python 2, psims
0.1.45 is installed, which is allowed by the current test-requirements
and seems to include OBOCache
and fallback files (although outdated, I imagine), but no load
method on OBOCache
. It appears that load
does some kind of dispatching to a resolver which can be done directly here? I don't have a proper understanding of this but if I can help, I'll be happy to try.
Thank you for pointing out the older version. Apparently the earlier APIs of OBOCache
weren't as consistent. I've updated the code to work with the older API. Fortunately, most of the other loader functions already wrap this behavior up, and it was only the custom loader for Unimod that wasn't working the way I expected it to.
Thank you! I tried it locally, and the proforma
tests now pass even without Internet connection.
I do get some warnings from within psims
when testing offline, which don't get raised when online:
return GzipFile(fileobj=_load(__name__, "unimod_tables.xml.gz"))
/home/lev/.virtualenvs/pyteomics/lib/python3.11/site-packages/psims/controlled_vocabulary/controlled_vocabulary.py:622: ResourceWarning: unclosed file <_io.BufferedReader name='/home/lev/.virtualenvs/pyteomics/lib/python3.11/site-packages/psims/controlled_vocabulary/vendor/unimod_tables.xml.gz'>
return unimod.Unimod(None, _use_vendored_unimod_xml())
ResourceWarning: Enable tracemalloc to get the object allocation traceback
../home/lev/.virtualenvs/pyteomics/lib/python3.11/site-packages/psims/controlled_vocabulary/vendor/__init__.py:17: DeprecationWarning: open_binary is deprecated. Use files() instead. Refer to https://importlib-resources.readthedocs.io/en/latest/using.html#migrating-from-legacy for migration advice.
return GzipFile(fileobj=_load(__name__, "psi-mod.obo.gz"))
/home/lev/.virtualenvs/pyteomics/lib/python3.11/site-packages/psims/controlled_vocabulary/controlled_vocabulary.py:694: ResourceWarning: unclosed file <_io.BufferedReader name='/home/lev/.virtualenvs/pyteomics/lib/python3.11/site-packages/psims/controlled_vocabulary/vendor/psi-mod.obo.gz'>
cv = obo_cache.load("https://raw.githubusercontent.com/HUPO-PSI/psi-mod-CV/master/PSI-MOD.obo")
ResourceWarning: Enable tracemalloc to get the object allocation traceback
./home/lev/py/pyteomics/pyteomics/proforma.py:1315: UserWarning: Slice bisecting interval (4-12)None
warnings.warn("Slice bisecting interval %s" % (self, ))
......./home/lev/.virtualenvs/pyteomics/lib/python3.11/site-packages/psims/controlled_vocabulary/vendor/__init__.py:45: DeprecationWarning: open_binary is deprecated. Use files() instead. Refer to https://importlib-resources.readthedocs.io/en/latest/using.html#migrating-from-legacy for migration advice.
return GzipFile(fileobj=_load(__name__, "gno.obo.gz"))
/home/lev/.virtualenvs/pyteomics/lib/python3.11/site-packages/psims/controlled_vocabulary/controlled_vocabulary.py:699: ResourceWarning: unclosed file <_io.BufferedReader name='/home/lev/.virtualenvs/pyteomics/lib/python3.11/site-packages/psims/controlled_vocabulary/vendor/gno.obo.gz'>
cv = obo_cache.load("http://purl.obolibrary.org/obo/gno.obo")
ResourceWarning: Enable tracemalloc to get the object allocation traceback
.../home/lev/py/pyteomics/pyteomics/proforma.py:1315: UserWarning: Slice bisecting interval (4-12)[MassModification(19.0523, None, None)]
warnings.warn("Slice bisecting interval %s" % (self, ))
......
----------------------------------------------------------------------
Ran 19 tests in 7.930s
OK
With Internet, only the last warning is displayed. Just thought I'd let you know.
Thank you once more for your contributions.
Fixes #128
If available,
proforma
will usepsims
's Unimod API instead. This way applications and users can usepsims
's caching features and have access to a fallback copy of the supported controlled vocabularies when the internet is inaccessible.