Skip to content

Commit

Permalink
Silence pronto warnings when importing ontologies
Browse files Browse the repository at this point in the history
  • Loading branch information
althonos committed Oct 13, 2022
1 parent 0c75831 commit 5eba77a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
10 changes: 6 additions & 4 deletions mzml2isa/imzml.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from __future__ import unicode_literals

import copy
import warnings

import pronto
import pkg_resources
Expand All @@ -34,10 +35,11 @@ class ImzMLFile(MzMLFile):
}
)

_VOCABULARY = pronto.Ontology(
pkg_resources.resource_stream("mzml2isa", "ontologies/imagingMS.obo"),
# import_depth=1,
)
with warnings.catch_warnings(record=True):
warnings.simplefilter('ignore', pronto.warnings.SyntaxWarning)
_VOCABULARY = pronto.Ontology(
pkg_resources.resource_filename("mzml2isa", "ontologies/imagingMS.obo"),
)

@classmethod
def _assay_parameters(cls):
Expand Down
11 changes: 6 additions & 5 deletions mzml2isa/mzml.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,12 @@ class MzMLFile(object):
"ref_binary": "{scanList}/s:scan/s:referenceableParamGroupRef",
}

# `~pronto.Ontology`: the default MS controlled vocabulary to use.
_VOCABULARY = pronto.Ontology(
pkg_resources.resource_stream("mzml2isa", "ontologies/psi-ms.obo"),
# imports=False,
)
with warnings.catch_warnings(record=True):
warnings.simplefilter('ignore', pronto.warnings.SyntaxWarning)
# `~pronto.Ontology`: the default MS controlled vocabulary to use.
_VOCABULARY = pronto.Ontology(
pkg_resources.resource_filename("mzml2isa", "ontologies/psi-ms.obo"),
)

def __init__(self, filesystem, path, vocabulary=None):
"""Open an ``mzML`` file from the given filesystem and path.
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ project_urls =
Changelog = https://github.com/ISA-tools/mzml2isa/blob/master/CHANGELOG.md

[options]
zip_safe = true
zip_safe = false
include_package_data = false
python_requires = >= 2.7, != 3.0.*, != 3.1.*, != 3.2.*, != 3.3.*
packages = mzml2isa, mzml2isa.templates, mzml2isa.ontologies
Expand Down

0 comments on commit 5eba77a

Please sign in to comment.