GithubHelp home page GithubHelp logo

Specify version of CV to use? about psims HOT 3 OPEN

bretttully avatar bretttully commented on May 27, 2024
Specify version of CV to use?

from psims.

Comments (3)

mobiusklein avatar mobiusklein commented on May 27, 2024

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.

mobiusklein avatar mobiusklein commented on May 27, 2024

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.

mobiusklein avatar mobiusklein commented on May 27, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.