Comments (3)
I seem to have made this difficult to manipulate directly. When instantiating a writer, you can pass in a list of CV
objects for it to use, but it automatically uses the default vocabularies for the format too. The mzML vocabularies are located in psims.mzml.components.default_cv_list
. I'll have to make the CV
type a bit more user friendly and put deduplication logic in place.
In the meantime, to avoid updating the CV, you can configure the OBO cache by calling psims.controlled_vocabulary.controlled_vocabulary.configure_obo_store
prior to running your test. This will download any OBOs that the document needs and save them in that directory, and if a CV is requested by URI that can be found in the cache, it will be read from the cache instead of downloading it from the provided URI. This means that if you're running your unit tests on an ephemeral file system like a CI server, you'll need to populate the cache yourself. You can use the static files in psims/controlled_vocabulary/vendor
as seeds for that, but I tend to update them periodically so you'll want to make a static copy. I have psi-ms.obo at 4.1.22
, so a few releases behind the ontology.
My intention (rather, what I do in my own applications and do not document anywhere) was that during installation/update, a program using psims
would get a directory along the user's local config path, and create a subdirectory in it, declare that to be the OBO cache directory, and then write a known good version of the OBOs to that subdirectory, and never deal with it again. Should a problem arise with the cache, or from retrieving the OBO from the internet, the vendored OBO will still be available.
The pymzML repository maintains a historical list of psi-ms.obo releases, if you're looking for a specific version and the source repository history is too muddy.
from psims.
Sorry for the delay in getting back to this.
The version at 36ddbcf now supports this behavior properly:
import psims
from psims.mzml import MzMLWriter
cvs = [
psims.xml.CV("PSI-MS", 'PSI-MS', "4.1.42",
"https://raw.githubusercontent.com/HUPO-PSI/psi-ms-CV/master/psi-ms.obo")
]
...
with MzMLWriter(path, vocabularies=cvs) as f:
f.controlled_vocabularies()
...
This will render as:
<?xml version='1.0' encoding='utf-8'?>
<indexedmzML xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://psi.hupo.org/ms/mzml" xsi:schemaLocation="http://psi.hupo.org/ms/mzml http://psidev.info/files/ms/mzML/xsd/mzML1.1.2_idx.xsd">
<mzML xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://psi.hupo.org/ms/mzml" xsi:schemaLocation="http://psi.hupo.org/ms/mzml http://psidev.info/files/ms/mzML/xsd/mzML1.1.0.xsd" version="1.1.0">
<cvList count="2">
<cv URI="https://raw.githubusercontent.com/HUPO-PSI/psi-ms-CV/master/psi-ms.obo" fullName="PSI-MS" id="PSI-MS" version="4.1.42"/>
<cv URI="http://ontologies.berkeleybop.org/uo.obo" fullName="UNIT-ONTOLOGY" id="UO" version="releases/2019-04-01"/>
</cvList>
You can specify a custom URI to load the vocabulary's obo file from, and it will be requested when the CV has to be loaded. If you specify a custom version over a URI, it will simply be rendered in the XML file, having no bearing on the version loaded, as there is no protocol in place for requesting a specific version by URI.
from psims.
@bretttully Congratulations on the press on your pre-print on toffee
. Did I solve your problem, or is this a recurring issue still?
from psims.
Related Issues (17)
- mzIdentML Usage Patterns HOT 5
- Binary string in IndexedMzML? HOT 5
- Recommended usage pattern for extracting & saving just header info from mzML HOT 2
- Error on exit from mzML HOT 10
- Problem with writing precursor information HOT 2
- Compatibility with other tools HOT 7
- Multiple unit options are possible for parameter 'base peak intensity' but none were specified HOT 7
- NameError: name 'err' is not defined HOT 6
- Conda package HOT 3
- Update package metadata on PyPI? HOT 9
- Files not closing (was: Truncated files) HOT 8
- [Maintainance] Deprecation warnings for sqlalchemy 2.0 HOT 5
- (MzIdentMLWriter) register AttributeError HOT 3
- (MzIdentMLWriter) SpectrumIdentification.write TypeError missing positional argument xml_file HOT 3
- [Question] Adding 1/k0 information to selected precursor ions HOT 2
- Import issues on Python 3.12 HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from psims.