-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from VinzentRisch/1_mzml_formats
ENH: Added mzML formats and type
- Loading branch information
Showing
13 changed files
with
456 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,15 @@ | ||
# flake8: noqa | ||
# ---------------------------------------------------------------------------- | ||
# Copyright (c) 2024, QIIME 2 development team. | ||
# | ||
# Distributed under the terms of the Modified BSD License. | ||
# | ||
# The full license is in the file LICENSE, distributed with this software. | ||
# ---------------------------------------------------------------------------- | ||
import importlib | ||
|
||
try: | ||
from ._version import __version__ | ||
except ModuleNotFoundError: | ||
__version__ = "0.0.0+notfound" | ||
|
||
importlib.import_module("q2_ms.types") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
@article{kosters2018pymzml, | ||
title={pymzML v2. 0: introducing a highly compressed and seekable gzip format}, | ||
author={K{\"o}sters, M and Leufken, Johannes and Schulze, Stefan and Sugimoto, K and Klein, Joshua and Zahedi, RP and Hippler, Michael and Leidel, SA and Fufezan, Christian}, | ||
journal={Bioinformatics}, | ||
volume={34}, | ||
number={14}, | ||
pages={2513--2514}, | ||
year={2018}, | ||
publisher={Oxford University Press} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,11 @@ | ||
# flake8: noqa | ||
# ---------------------------------------------------------------------------- | ||
# Copyright (c) 2024, QIIME 2 development team. | ||
# | ||
# Distributed under the terms of the Modified BSD License. | ||
# | ||
# The full license is in the file LICENSE, distributed with this software. | ||
# ---------------------------------------------------------------------------- | ||
from q2_ms.types._format import mzMLDirFmt, mzMLFormat | ||
from q2_ms.types._type import mzML | ||
|
||
__all__ = ["mzMLFormat", "mzMLDirFmt", "mzML"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# ---------------------------------------------------------------------------- | ||
# Copyright (c) 2024, QIIME 2 development team. | ||
# | ||
# Distributed under the terms of the Modified BSD License. | ||
# | ||
# The full license is in the file LICENSE, distributed with this software. | ||
# ---------------------------------------------------------------------------- | ||
import os | ||
import sys | ||
|
||
import pymzml | ||
from qiime2.core.exceptions import ValidationError | ||
from qiime2.plugin import model | ||
|
||
|
||
class mzMLFormat(model.TextFileFormat): | ||
def _validate(self, n_records=None): | ||
try: | ||
# Suppressing warning print "Not index found and build_index_from_scratch | ||
# is False". This could also be solved with setting build_index_from_scratch | ||
# to True but this builds the index and slows down validation. | ||
sys.stdout = open(os.devnull, "w") | ||
pymzml.run.Reader(str(self)) | ||
sys.stdout = sys.__stdout__ | ||
except Exception as e: | ||
raise ValidationError(e) | ||
|
||
def _validate_(self, level): | ||
self._validate() | ||
|
||
|
||
class mzMLDirFmt(model.DirectoryFormat): | ||
mzml = model.FileCollection(r".*\.mzML$", format=mzMLFormat) | ||
|
||
@mzml.set_path_maker | ||
def mzml_path_maker(self, sample_id): | ||
return f"{sample_id}.mzML" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?xml version="1.0" encoding="ISO-8859-1"?> | ||
<indexedmzML xmlns="http://psi.hupo.org/ms/mzml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://psi.hupo.org/ms/mzml http://psidev.info/files/ms/mzML/xsd/mzML1.1.0_idx.xsd"> | ||
<mzML xmlns="http://psi.hupo.org/ms/mzml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://psi.hupo.org/ms/mzml http://psidev.info/files/ms/mzML/xsd/mzML1.1.0.xsd" id="urn:lsid:psidev.info:mzML.instanceDocuments.tiny.pwiz" version="1.1.0"> | ||
<cvList count="2"> | ||
<cv id="MS" fullName="Proteomics Standards Initiative Mass Spectrometry Ontology" version="2.26.0" URI="http://psidev.cvs.sourceforge.net/*checkout*/psidev/psi/psi-ms/mzML/controlledVocabulary/psi-ms.obo"/> | ||
<cv id="UO" fullName="Unit Ontology" version="14:07:2009" URI="http://obo.cvs.sourceforge.net/*checkout*/obo/obo/ontology/phenotype/unit.obo"/> | ||
</cvList> | ||
<fileDescription> | ||
<fileContent> | ||
<cvParam cvRef="MS" accession="MS:1000580" name="MSn spectrum" value=""/> | ||
<cvParam cvRef="MS" accession="MS:1000127" name="centroid spectrum" value=""/> | ||
</fileContent> | ||
<sourceFileList count="3"> | ||
<sourceFile id="tiny1.yep" name="tiny1.yep" location="file://F:/data/Exp01"> | ||
<cvParam cvRef="MS" accession="MS:1000567" name="Bruker/Agilent YEP file" value=""/> |
Oops, something went wrong.