diff --git a/.github/workflows/python-tests.yml b/.github/workflows/python-tests.yml index a4e3a1a..3e23788 100644 --- a/.github/workflows/python-tests.yml +++ b/.github/workflows/python-tests.yml @@ -18,7 +18,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install flake8 pytest setuptools jsonschema + pip install flake8 pytest - name: Lint with flake8 run: | # stop the build if there are Python syntax errors or undefined names @@ -27,7 +27,7 @@ jobs: flake8 implementations/python --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - name: Install python package run: | - pip install --editable implementations/python + pip install --editable implementations/python[test] - name: Test with pytest env: MZSPECLIB_PEAK_ANNOTATION_SCHEMA_LOCATION: "specification/peak-annotation-format/annotation-schema.json" diff --git a/.github/workflows/scripts/generate_metadata_docs.py b/.github/workflows/scripts/generate_metadata_docs.py index 342ffb0..94e4624 100644 --- a/.github/workflows/scripts/generate_metadata_docs.py +++ b/.github/workflows/scripts/generate_metadata_docs.py @@ -7,23 +7,48 @@ from collections import defaultdict from functools import partial from glob import glob +from typing import Dict, Iterable, Iterator, List +import psims from jsonschema import validate from tomark import Tomark -import psims -def rules_to_markdown(rules): +def _add_ols_links(lines: Iterable[str]) -> Iterator[str]: + """Add links to OLS for all ontology accessions.""" + add_links = partial( + re.sub, + pattern=r"MS:(\d{7})", + repl=r"[\g<0>](https://www.ebi.ac.uk/ols4/ontologies/ms/classes/http%253A%252F%252Fpurl.obolibrary.org%252Fobo%252FMS_\g<1>)", + ) + for line in lines: + yield add_links(string=line) + + +def rules_to_markdown(rules: Dict, level_descriptions: Dict) -> List[str]: + """ + Convert JSON metadata rules to markdown documentation. + + Parameters + ---------- + rules + Metadata rules + level_descriptions + Title, description, and sub-groups for each metadata level + + """ cv = psims.load_psims() # load a fresh copy of the PSI-MS CV mapping + # Group rules by path and requirement level rule_dict = defaultdict(lambda: defaultdict(list)) for rule in rules["rules"]: rule_dict[rule["path"]][rule["requirement_level"]].append(rule) lines = [] - lines.append(f"# {rules['name'].upper()}\n") + # lines.append(f"## {rules['name'].upper()}\n") for path, path_rules in rule_dict.items(): - lines.append(f"## `{path}`\n") + lines.append(f"### {level_descriptions[path]['title']}\n") + lines.append(level_descriptions[path]["description"] + "\n") for level, level_rules in path_rules.items(): # Combine all rule attributes into single list (#TODO: how to handle combination logic?) rule_attrs = [] @@ -80,25 +105,26 @@ def rules_to_markdown(rules): fields.append(field) - lines.append(f"### {level}\n") + lines.append(f"#### {level}\n") # lines.append(f"Combination logic: `{rule['combination_logic']}`\n") lines.append("\n") lines.append(Tomark.table(fields)) lines.append("\n") - # Add link to OLS for all accessions - add_links = partial( - re.sub, - pattern=r"MS:(\d{7})", - repl=r"[\g<0>](https://www.ebi.ac.uk/ols4/ontologies/ms/classes/http%253A%252F%252Fpurl.obolibrary.org%252Fobo%252FMS_\g<1>)", - ) - lines = [add_links(string=line) for line in lines] lines.append("\n") + lines = _add_ols_links(lines) + return lines def main(): lines = [] + + with open( + LEVEL_DESCRIPTIONS_FILENAME, "rt", encoding="utf-8" + ) as level_descriptions_file: + level_descriptions = json.load(level_descriptions_file) + for json_filename in glob(JSON_FILES_GLOB): # Read JSON rules with open(json_filename, "rt", encoding="utf-8") as json_file: @@ -110,10 +136,10 @@ def main(): validate(rules, schema) # Convert to markdown - lines.extend(rules_to_markdown(rules)) + lines.extend(rules_to_markdown(rules, level_descriptions)) # Write to file - with open(MD_FILENAME, "wt") as md_file: + with open(MD_FILENAME, "wt", encoding="utf-8") as md_file: for line in lines: md_file.write(line) @@ -124,6 +150,7 @@ def main(): ) # JSON_FILES_GLOB = "implementations/python/mzlib/validate/rules/*.json" JSON_FILES_GLOB = "implementations/python/mzlib/validate/rules/all.json" + LEVEL_DESCRIPTIONS_FILENAME = ".github/workflows/scripts/level-information.json" MD_FILENAME = "docs/metadata-rules.md" main() diff --git a/.github/workflows/scripts/level-information.json b/.github/workflows/scripts/level-information.json new file mode 100644 index 0000000..1d1bd5e --- /dev/null +++ b/.github/workflows/scripts/level-information.json @@ -0,0 +1,33 @@ +{ + "/Library": { + "title": "Metadata specific to the library", + "description": "The following attributes describe an entire collection of spectra, the library itself. They should be listed under the tag and nowhere else in the library.", + "subgroups": [ + "Terms that define the library as a collection and how it was constructed", + "Terms that define attribute sets", + "Terms that define clusters of spectra" + ] + }, + "/Library/Spectrum": { + "title": "Metadata specific to library spectra", + "description": "The second level of metadata provides information specific to each library spectrum. The attributes SHOULD be organized in subcategories: those that pertain to the library spectrum and the origin of the spectrum, those that pertain to the spectrum itself, those that pertain to the interpretation of the spectrum, and those that pertain to the analyte(s) the spectrum is identified to. The following are attributes pertaining to the library spectrum and the origin of the spectrum, including the acquisition method and information about the precursor ion. They MUST be listed under , or listed in library spectrum attribute sets.", + "subgroups": [ + "Terms that identify the spectrum", + "Terms that describe how the spectrum is acquired, including the method and the context", + "Terms that describe how the spectrum itself, including steps of data processing leading to it", + "Terms that describe an aggregated spectrum (e.g. a consensus spectrum constructed from multiple replicates)", + "Terms that cross-reference other spectra in the same library or elsewhere", + "Terms that define the additional columns of the peak list" + ] + }, + "/Library/Spectrum/Interpretation": { + "title": "Metadata specific to the interpretation", + "description": "These attributes describe the details of the interpretation of the spectrum. They MUST be listed under . Additional attributes can be children of PSM-level search engine specific statistics [MS:1001143](https://www.ebi.ac.uk/ols/ontologies/ms/terms?iri=http%3A%2F%2Fpurl.obolibrary.org%2Fobo%2FMS_1001143), e.g., Comet:xcorr.", + "subgroups": ["Describing details of the interpretation of the spectrum"] + }, + "/Library/Spectrum/Analyte": { + "title": "Metadata specific to the analyte", + "description": "These attributes refer to the analyte(s) to which the spectrum is identified. In the present version of the library format, only peptide analytes are supported, but support for other kinds of analytes (e.g. small molecule metabolites) are expected in the future. They MUST be listed under ", + "subgroups": ["Terms that describe the analyte"] + } +} diff --git a/.github/workflows/validate-json-schemas.yml b/.github/workflows/validate-json-schemas.yml index 3423f66..6dfadca 100644 --- a/.github/workflows/validate-json-schemas.yml +++ b/.github/workflows/validate-json-schemas.yml @@ -8,7 +8,7 @@ jobs: steps: - uses: actions/checkout@v2 - name: Set up Python - uses: actions/setup-python@v1 + uses: actions/setup-python@v3 with: python-version: 3.8 - name: Install dependencies diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst new file mode 100644 index 0000000..28a2369 --- /dev/null +++ b/CONTRIBUTING.rst @@ -0,0 +1,80 @@ +############ +Contributing +############ + +This document briefly describes how to contribute to +`mzSpecLib `_. + + + +Before you begin +################ + +If you have an idea for a feature, use case to add or an approach for a bugfix, +you are welcome to communicate it with the community by opening a +thread in `GitHub Issues `_. + + + +Development setup +################# + +Local install +************* + +#. Setup Python 3, and preferably create a virtual environment. +#. Clone the `mzSpecLib repository `_. +#. Use pip in editable mode to setup the development environment: + +.. code-block:: sh + + pip install --editable .[test,docs] + + +Unit tests +********** + +Run tests with ``pytest``: + +.. code-block:: sh + + pytest ./tests + + +Documentation +************* + +To work on the documentation and get a live preview, install the requirements +and run ``sphinx-autobuild``: + +.. code-block:: sh + + pip install .[docs] + sphinx-autobuild ./docs/ ./docs/_build/ + +Then browse to http://localhost:8000 to watch the live preview. + + + +How to contribute +################# + +- Fork `mzSpecLib `_ on GitHub to + make your changes. +- Commit and push your changes to your + `fork `_. +- Ensure that the tests and documentation (both Python docstrings and files in + ``/docs/``) have been updated according to your changes. Python + docstrings are formatted in the + `numpydoc style `_. +- Open a + `pull request `_ + with these changes. You pull request message ideally should include: + + - A description of why the changes should be made. + - A description of the implementation of the changes. + - A description of how to test the changes. + +- The pull request should pass all the continuous integration tests which are + automatically run by + `GitHub Actions `_. diff --git a/docs/.readthedocs.yaml b/docs/.readthedocs.yaml new file mode 100644 index 0000000..31c93e2 --- /dev/null +++ b/docs/.readthedocs.yaml @@ -0,0 +1,21 @@ +version: 2 + +build: + os: ubuntu-22.04 + tools: + python: "3.11" + +sphinx: + configuration: docs/conf.py + builder: dirhtml + +formats: + - pdf + - epub + +python: + install: + - method: pip + path: implementations/python + extra_requirements: + - docs diff --git a/docs/LICENSE.txt b/docs/LICENSE.txt new file mode 100644 index 0000000..1eaa3b0 --- /dev/null +++ b/docs/LICENSE.txt @@ -0,0 +1,435 @@ +Attribution-NonCommercial-ShareAlike 4.0 International + +======================================================================= + +Creative Commons Corporation ("Creative Commons") is not a law firm and +does not provide legal services or legal advice. Distribution of +Creative Commons public licenses does not create a lawyer-client or +other relationship. Creative Commons makes its licenses and related +information available on an "as-is" basis. Creative Commons gives no +warranties regarding its licenses, any material licensed under their +terms and conditions, or any related information. Creative Commons +disclaims all liability for damages resulting from their use to the +fullest extent possible. + +Using Creative Commons Public Licenses + +Creative Commons public licenses provide a standard set of terms and +conditions that creators and other rights holders may use to share +original works of authorship and other material subject to copyright +and certain other rights specified in the public license below. The +following considerations are for informational purposes only, are not +exhaustive, and do not form part of our licenses. + + Considerations for licensors: Our public licenses are + intended for use by those authorized to give the public + permission to use material in ways otherwise restricted by + copyright and certain other rights. Our licenses are + irrevocable. Licensors should read and understand the terms + and conditions of the license they choose before applying it. + Licensors should also secure all rights necessary before + applying our licenses so that the public can reuse the + material as expected. Licensors should clearly mark any + material not subject to the license. This includes other CC- + licensed material, or material used under an exception or + limitation to copyright. More considerations for licensors: + wiki.creativecommons.org/Considerations_for_licensors + + Considerations for the public: By using one of our public + licenses, a licensor grants the public permission to use the + licensed material under specified terms and conditions. If + the licensor's permission is not necessary for any reason--for + example, because of any applicable exception or limitation to + copyright--then that use is not regulated by the license. Our + licenses grant only permissions under copyright and certain + other rights that a licensor has authority to grant. Use of + the licensed material may still be restricted for other + reasons, including because others have copyright or other + rights in the material. A licensor may make special requests, + such as asking that all changes be marked or described. + Although not required by our licenses, you are encouraged to + respect those requests where reasonable. More_considerations + for the public: + wiki.creativecommons.org/Considerations_for_licensees + +======================================================================= + +Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International +Public License + +By exercising the Licensed Rights (defined below), You accept and agree +to be bound by the terms and conditions of this Creative Commons +Attribution-NonCommercial-ShareAlike 4.0 International Public License +("Public License"). To the extent this Public License may be +interpreted as a contract, You are granted the Licensed Rights in +consideration of Your acceptance of these terms and conditions, and the +Licensor grants You such rights in consideration of benefits the +Licensor receives from making the Licensed Material available under +these terms and conditions. + + +Section 1 -- Definitions. + + a. Adapted Material means material subject to Copyright and Similar + Rights that is derived from or based upon the Licensed Material + and in which the Licensed Material is translated, altered, + arranged, transformed, or otherwise modified in a manner requiring + permission under the Copyright and Similar Rights held by the + Licensor. For purposes of this Public License, where the Licensed + Material is a musical work, performance, or sound recording, + Adapted Material is always produced where the Licensed Material is + synched in timed relation with a moving image. + + b. Adapter's License means the license You apply to Your Copyright + and Similar Rights in Your contributions to Adapted Material in + accordance with the terms and conditions of this Public License. + + c. BY-NC-SA Compatible License means a license listed at + creativecommons.org/compatiblelicenses, approved by Creative + Commons as essentially the equivalent of this Public License. + + d. Copyright and Similar Rights means copyright and/or similar rights + closely related to copyright including, without limitation, + performance, broadcast, sound recording, and Sui Generis Database + Rights, without regard to how the rights are labeled or + categorized. For purposes of this Public License, the rights + specified in Section 2(b)(1)-(2) are not Copyright and Similar + Rights. + + e. Effective Technological Measures means those measures that, in the + absence of proper authority, may not be circumvented under laws + fulfilling obligations under Article 11 of the WIPO Copyright + Treaty adopted on December 20, 1996, and/or similar international + agreements. + + f. Exceptions and Limitations means fair use, fair dealing, and/or + any other exception or limitation to Copyright and Similar Rights + that applies to Your use of the Licensed Material. + + g. License Elements means the license attributes listed in the name + of a Creative Commons Public License. The License Elements of this + Public License are Attribution, NonCommercial, and ShareAlike. + + h. Licensed Material means the artistic or literary work, database, + or other material to which the Licensor applied this Public + License. + + i. Licensed Rights means the rights granted to You subject to the + terms and conditions of this Public License, which are limited to + all Copyright and Similar Rights that apply to Your use of the + Licensed Material and that the Licensor has authority to license. + + j. Licensor means the individual(s) or entity(ies) granting rights + under this Public License. + + k. NonCommercial means not primarily intended for or directed towards + commercial advantage or monetary compensation. For purposes of + this Public License, the exchange of the Licensed Material for + other material subject to Copyright and Similar Rights by digital + file-sharing or similar means is NonCommercial provided there is + no payment of monetary compensation in connection with the + exchange. + + l. Share means to provide material to the public by any means or + process that requires permission under the Licensed Rights, such + as reproduction, public display, public performance, distribution, + dissemination, communication, or importation, and to make material + available to the public including in ways that members of the + public may access the material from a place and at a time + individually chosen by them. + + m. Sui Generis Database Rights means rights other than copyright + resulting from Directive 96/9/EC of the European Parliament and of + the Council of 11 March 1996 on the legal protection of databases, + as amended and/or succeeded, as well as other essentially + equivalent rights anywhere in the world. + + n. You means the individual or entity exercising the Licensed Rights + under this Public License. Your has a corresponding meaning. + + +Section 2 -- Scope. + + a. License grant. + + 1. Subject to the terms and conditions of this Public License, + the Licensor hereby grants You a worldwide, royalty-free, + non-sublicensable, non-exclusive, irrevocable license to + exercise the Licensed Rights in the Licensed Material to: + + a. reproduce and Share the Licensed Material, in whole or + in part, for NonCommercial purposes only; and + + b. produce, reproduce, and Share Adapted Material for + NonCommercial purposes only. + + 2. Exceptions and Limitations. For the avoidance of doubt, where + Exceptions and Limitations apply to Your use, this Public + License does not apply, and You do not need to comply with + its terms and conditions. + + 3. Term. The term of this Public License is specified in Section + 6(a). + + 4. Media and formats; technical modifications allowed. The + Licensor authorizes You to exercise the Licensed Rights in + all media and formats whether now known or hereafter created, + and to make technical modifications necessary to do so. The + Licensor waives and/or agrees not to assert any right or + authority to forbid You from making technical modifications + necessary to exercise the Licensed Rights, including + technical modifications necessary to circumvent Effective + Technological Measures. For purposes of this Public License, + simply making modifications authorized by this Section 2(a) + (4) never produces Adapted Material. + + 5. Downstream recipients. + + a. Offer from the Licensor -- Licensed Material. Every + recipient of the Licensed Material automatically + receives an offer from the Licensor to exercise the + Licensed Rights under the terms and conditions of this + Public License. + + b. Additional offer from the Licensor -- Adapted Material. + Every recipient of Adapted Material from You + automatically receives an offer from the Licensor to + exercise the Licensed Rights in the Adapted Material + under the conditions of the Adapter's License You apply. + + c. No downstream restrictions. You may not offer or impose + any additional or different terms or conditions on, or + apply any Effective Technological Measures to, the + Licensed Material if doing so restricts exercise of the + Licensed Rights by any recipient of the Licensed + Material. + + 6. No endorsement. Nothing in this Public License constitutes or + may be construed as permission to assert or imply that You + are, or that Your use of the Licensed Material is, connected + with, or sponsored, endorsed, or granted official status by, + the Licensor or others designated to receive attribution as + provided in Section 3(a)(1)(A)(i). + + b. Other rights. + + 1. Moral rights, such as the right of integrity, are not + licensed under this Public License, nor are publicity, + privacy, and/or other similar personality rights; however, to + the extent possible, the Licensor waives and/or agrees not to + assert any such rights held by the Licensor to the limited + extent necessary to allow You to exercise the Licensed + Rights, but not otherwise. + + 2. Patent and trademark rights are not licensed under this + Public License. + + 3. To the extent possible, the Licensor waives any right to + collect royalties from You for the exercise of the Licensed + Rights, whether directly or through a collecting society + under any voluntary or waivable statutory or compulsory + licensing scheme. In all other cases the Licensor expressly + reserves any right to collect such royalties, including when + the Licensed Material is used other than for NonCommercial + purposes. + + +Section 3 -- License Conditions. + +Your exercise of the Licensed Rights is expressly made subject to the +following conditions. + + a. Attribution. + + 1. If You Share the Licensed Material (including in modified + form), You must: + + a. retain the following if it is supplied by the Licensor + with the Licensed Material: + + i. identification of the creator(s) of the Licensed + Material and any others designated to receive + attribution, in any reasonable manner requested by + the Licensor (including by pseudonym if + designated); + + ii. a copyright notice; + + iii. a notice that refers to this Public License; + + iv. a notice that refers to the disclaimer of + warranties; + + v. a URI or hyperlink to the Licensed Material to the + extent reasonably practicable; + + b. indicate if You modified the Licensed Material and + retain an indication of any previous modifications; and + + c. indicate the Licensed Material is licensed under this + Public License, and include the text of, or the URI or + hyperlink to, this Public License. + + 2. You may satisfy the conditions in Section 3(a)(1) in any + reasonable manner based on the medium, means, and context in + which You Share the Licensed Material. For example, it may be + reasonable to satisfy the conditions by providing a URI or + hyperlink to a resource that includes the required + information. + 3. If requested by the Licensor, You must remove any of the + information required by Section 3(a)(1)(A) to the extent + reasonably practicable. + + b. ShareAlike. + + In addition to the conditions in Section 3(a), if You Share + Adapted Material You produce, the following conditions also apply. + + 1. The Adapter's License You apply must be a Creative Commons + license with the same License Elements, this version or + later, or a BY-NC-SA Compatible License. + + 2. You must include the text of, or the URI or hyperlink to, the + Adapter's License You apply. You may satisfy this condition + in any reasonable manner based on the medium, means, and + context in which You Share Adapted Material. + + 3. You may not offer or impose any additional or different terms + or conditions on, or apply any Effective Technological + Measures to, Adapted Material that restrict exercise of the + rights granted under the Adapter's License You apply. + + +Section 4 -- Sui Generis Database Rights. + +Where the Licensed Rights include Sui Generis Database Rights that +apply to Your use of the Licensed Material: + + a. for the avoidance of doubt, Section 2(a)(1) grants You the right + to extract, reuse, reproduce, and Share all or a substantial + portion of the contents of the database for NonCommercial purposes + only; + + b. if You include all or a substantial portion of the database + contents in a database in which You have Sui Generis Database + Rights, then the database in which You have Sui Generis Database + Rights (but not its individual contents) is Adapted Material, + including for purposes of Section 3(b); and + + c. You must comply with the conditions in Section 3(a) if You Share + all or a substantial portion of the contents of the database. + +For the avoidance of doubt, this Section 4 supplements and does not +replace Your obligations under this Public License where the Licensed +Rights include other Copyright and Similar Rights. + + +Section 5 -- Disclaimer of Warranties and Limitation of Liability. + + a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE + EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS + AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF + ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS, + IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION, + WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR + PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS, + ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT + KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT + ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU. + + b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE + TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION, + NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT, + INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES, + COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR + USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN + ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR + DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR + IN PART, THIS LIMITATION MAY NOT APPLY TO YOU. + + c. The disclaimer of warranties and limitation of liability provided + above shall be interpreted in a manner that, to the extent + possible, most closely approximates an absolute disclaimer and + waiver of all liability. + + +Section 6 -- Term and Termination. + + a. This Public License applies for the term of the Copyright and + Similar Rights licensed here. However, if You fail to comply with + this Public License, then Your rights under this Public License + terminate automatically. + + b. Where Your right to use the Licensed Material has terminated under + Section 6(a), it reinstates: + + 1. automatically as of the date the violation is cured, provided + it is cured within 30 days of Your discovery of the + violation; or + + 2. upon express reinstatement by the Licensor. + + For the avoidance of doubt, this Section 6(b) does not affect any + right the Licensor may have to seek remedies for Your violations + of this Public License. + + c. For the avoidance of doubt, the Licensor may also offer the + Licensed Material under separate terms or conditions or stop + distributing the Licensed Material at any time; however, doing so + will not terminate this Public License. + + d. Sections 1, 5, 6, 7, and 8 survive termination of this Public + License. + + +Section 7 -- Other Terms and Conditions. + + a. The Licensor shall not be bound by any additional or different + terms or conditions communicated by You unless expressly agreed. + + b. Any arrangements, understandings, or agreements regarding the + Licensed Material not stated herein are separate from and + independent of the terms and conditions of this Public License. + + +Section 8 -- Interpretation. + + a. For the avoidance of doubt, this Public License does not, and + shall not be interpreted to, reduce, limit, restrict, or impose + conditions on any use of the Licensed Material that could lawfully + be made without permission under this Public License. + + b. To the extent possible, if any provision of this Public License is + deemed unenforceable, it shall be automatically reformed to the + minimum extent necessary to make it enforceable. If the provision + cannot be reformed, it shall be severed from this Public License + without affecting the enforceability of the remaining terms and + conditions. + + c. No term or condition of this Public License will be waived and no + failure to comply consented to unless expressly agreed to by the + Licensor. + + d. Nothing in this Public License constitutes or may be interpreted + as a limitation upon, or waiver of, any privileges and immunities + that apply to the Licensor or You, including from the legal + processes of any jurisdiction or authority. + +======================================================================= + +Creative Commons is not a party to its public licenses. +Notwithstanding, Creative Commons may elect to apply one of its public +licenses to material it publishes and in those instances will be +considered the "Licensor." Except for the limited purpose of indicating +that material is shared under a Creative Commons public license or as +otherwise permitted by the Creative Commons policies published at +creativecommons.org/policies, Creative Commons does not authorize the +use of the trademark "Creative Commons" or any other trademark or logo +of Creative Commons without its prior written consent including, +without limitation, in connection with any unauthorized modifications +to any of its public licenses or any other arrangements, +understandings, or agreements concerning use of licensed material. For +the avoidance of doubt, this paragraph does not form part of the public +licenses. + +Creative Commons may be contacted at creativecommons.org. diff --git a/docs/_static/css/custom.css b/docs/_static/css/custom.css new file mode 100644 index 0000000..01f2deb --- /dev/null +++ b/docs/_static/css/custom.css @@ -0,0 +1,20 @@ +@import url('https://fonts.googleapis.com/css2?family=Open+Sans&family=Roboto+Slab:wght@500&display=swap'); + +html { + --pst-font-family-base: 'Open Sans', sans-serif; + --pst-font-family-heading: 'Roboto Slab', serif; + --pst-font-weight-heading: 500; +} + +html[data-theme="light"] { + --pst-color-primary: #3b5880; +} + +html[data-theme="dark"] { + --pst-color-primary: #5c87c2; + +} + +a:visited { + color: var(--pst-color-link); +} diff --git a/docs/conf.py b/docs/conf.py new file mode 100644 index 0000000..943e443 --- /dev/null +++ b/docs/conf.py @@ -0,0 +1,53 @@ +"""Configuration file for the Sphinx documentation builder.""" + +# Project information +project = "mzSpecLib" +author = "HUPO-PSI" +github_project_url = "https://github.com/HUPO-PSI/mzSpecLib" +github_doc_root = "https://github.com/HUPO-PSI/mzSpecLib/tree/master/docs" + +# General configuration +extensions = [ + "sphinx.ext.autodoc", + "sphinx.ext.autosectionlabel", + "sphinx.ext.autosummary", + "sphinx.ext.napoleon", + "sphinx.ext.intersphinx", + "sphinx_click.ext", + "myst_parser", +] +source_suffix = [".rst"] +master_doc = "index" +exclude_patterns = ["_build"] + +# Options for HTML output +html_theme = "pydata_sphinx_theme" +html_static_path = ["_static"] +html_css_files = ["css/custom.css"] +html_theme_options = { + "icon_links": [ + { + "name": "GitHub", + "url": "https://github.com/HUPO-PSI/mzSpecLib", + "icon": "fa-brands fa-github", + "type": "fontawesome", + } + ] +} + +# Autodoc options +autodoc_default_options = {"members": True, "show-inheritance": True} +autodoc_member_order = "bysource" +autodoc_typehints = "description" +autoclass_content = "init" + +# Intersphinx options +intersphinx_mapping = { + "python": ("https://docs.python.org/3", None), + "psims": ("https://mobiusklein.github.io/psims/docs/build/html/", None), + "pyteomics": ("https://pyteomics.readthedocs.io/en/stable/", None), +} + + +def setup(app): + config = {"enable_eval_rst": True} # noqa: F841 diff --git a/docs/contributing.rst b/docs/contributing.rst new file mode 100644 index 0000000..a021d3e --- /dev/null +++ b/docs/contributing.rst @@ -0,0 +1 @@ +.. include:: ../CONTRIBUTING.rst diff --git a/docs/implementations/index.rst b/docs/implementations/index.rst new file mode 100644 index 0000000..ebb51a9 --- /dev/null +++ b/docs/implementations/index.rst @@ -0,0 +1,11 @@ +############### +Implementations +############### + +.. toctree:: + :caption: Contents + :maxdepth: 2 + :glob: + + */index + diff --git a/docs/implementations/python/api.rst b/docs/implementations/python/api.rst new file mode 100644 index 0000000..a2874c7 --- /dev/null +++ b/docs/implementations/python/api.rst @@ -0,0 +1,7 @@ +********** +Python API +********** + +.. automodule:: mzlib + :members: + :imported-members: diff --git a/docs/implementations/python/cli.rst b/docs/implementations/python/cli.rst new file mode 100644 index 0000000..f57470e --- /dev/null +++ b/docs/implementations/python/cli.rst @@ -0,0 +1,7 @@ +********************** +Command line interface +********************** + +.. click:: mzlib.tools.cli:main + :prog: mzspeclib + :nested: full diff --git a/docs/implementations/python/index.rst b/docs/implementations/python/index.rst new file mode 100644 index 0000000..7d589cf --- /dev/null +++ b/docs/implementations/python/index.rst @@ -0,0 +1,11 @@ +##################### +Python implementation +##################### + +.. toctree:: + :caption: Contents + :maxdepth: 2 + :glob: + + * + diff --git a/docs/index.rst b/docs/index.rst new file mode 100644 index 0000000..b9b2c5a --- /dev/null +++ b/docs/index.rst @@ -0,0 +1,13 @@ +.. include:: ../README.md + :parser: myst_parser.sphinx_ + +.. toctree:: + :caption: About + :hidden: + :includehidden: + :glob: + + Home + specification/index + implementations/index + contributing diff --git a/docs/metadata-rules.md b/docs/metadata-rules.md index 2c51e6c..cf8fa45 100644 --- a/docs/metadata-rules.md +++ b/docs/metadata-rules.md @@ -1,19 +1,19 @@ -# ALL_METADATA -## `/Library` -### MUST +### Metadata specific to the library +The following attributes describe an entire collection of spectra, the library itself. They should be listed under the tag and nowhere else in the library. +#### MUST | Name | Info | Value | Allowed units | Repeatable | |-----|-----|-----|-----|-----| | library format version ([MS:1003186](https://www.ebi.ac.uk/ols4/ontologies/ms/classes/http%253A%252F%252Fpurl.obolibrary.org%252Fobo%252FMS_1003186)) | "Version number of the [PSI] library format specification" [PSI:PI] | xsd:string | / | False | | library name ([MS:1003188](https://www.ebi.ac.uk/ols4/ontologies/ms/classes/http%253A%252F%252Fpurl.obolibrary.org%252Fobo%252FMS_1003188)) | "A short name identifying the library to potential users. The same name may refer to multiple versions of the same continually updated library." [PSI:PI] | xsd:string | / | False | -### SHOULD +#### SHOULD | Name | Info | Value | Allowed units | Repeatable | |-----|-----|-----|-----|-----| | library identifier ([MS:1003187](https://www.ebi.ac.uk/ols4/ontologies/ms/classes/http%253A%252F%252Fpurl.obolibrary.org%252Fobo%252FMS_1003187)) | "Short identifier for the library for easy reference, preferably but not necessarily globally unique" [PSI:PI] | xsd:string | / | False | -### MAY +#### MAY | Name | Info | Value | Allowed units | Repeatable | |-----|-----|-----|-----|-----| @@ -45,8 +45,9 @@ | spectrum cluster member spectrum keys ([MS:1003268](https://www.ebi.ac.uk/ols4/ontologies/ms/classes/http%253A%252F%252Fpurl.obolibrary.org%252Fobo%252FMS_1003268)) | "A list of integers corresponding to the library spectrum keys of the members of this cluster. These members must be in the same library." [PSI:PI] | Undefined | / | True | | spectrum cluster member USI ([MS:1003269](https://www.ebi.ac.uk/ols4/ontologies/ms/classes/http%253A%252F%252Fpurl.obolibrary.org%252Fobo%252FMS_1003269)) | "A member of this cluster external to the library, specified using a PSI Universal Spectrum Identifier." [PSI:PI] | xsd:string | / | True | -## `/Library/Spectrum` -### MUST +### Metadata specific to library spectra +The second level of metadata provides information specific to each library spectrum. The attributes SHOULD be organized in subcategories: those that pertain to the library spectrum and the origin of the spectrum, those that pertain to the spectrum itself, those that pertain to the interpretation of the spectrum, and those that pertain to the analyte(s) the spectrum is identified to. The following are attributes pertaining to the library spectrum and the origin of the spectrum, including the acquisition method and information about the precursor ion. They MUST be listed under , or listed in library spectrum attribute sets. +#### MUST | Name | Info | Value | Allowed units | Repeatable | |-----|-----|-----|-----|-----| @@ -54,7 +55,7 @@ | library spectrum index ([MS:1003062](https://www.ebi.ac.uk/ols4/ontologies/ms/classes/http%253A%252F%252Fpurl.obolibrary.org%252Fobo%252FMS_1003062)) | "Integer index value that indicates the spectrum's ordered position within a spectral library. By custom, index counters should begin with 0." [PSI:PI] | xsd:integer | / | False | | experimental precursor monoisotopic m/z ([MS:1003208](https://www.ebi.ac.uk/ols4/ontologies/ms/classes/http%253A%252F%252Fpurl.obolibrary.org%252Fobo%252FMS_1003208)) | "The measured or inferred m/z (as reported by the mass spectrometer acquisition software or post-processing software) of the monoisotopic peak of the precursor ion based on the MSn-1 spectrum." [PSI:MS]

**Notes:** NOTE: This is the preferred term for specification of the precursor m/z in typical use cases. If the specification of the isolation window is desired, the terms [MS:1000827](https://www.ebi.ac.uk/ols4/ontologies/ms/classes/http%253A%252F%252Fpurl.obolibrary.org%252Fobo%252FMS_1000827)\|isolation window target m/z, [MS:1000828](https://www.ebi.ac.uk/ols4/ontologies/ms/classes/http%253A%252F%252Fpurl.obolibrary.org%252Fobo%252FMS_1000828)\|isolation window lower offset, [MS:1000829](https://www.ebi.ac.uk/ols4/ontologies/ms/classes/http%253A%252F%252Fpurl.obolibrary.org%252Fobo%252FMS_1000829)\|isolation window upper offset should be used. The terms [MS:1000744](https://www.ebi.ac.uk/ols4/ontologies/ms/classes/http%253A%252F%252Fpurl.obolibrary.org%252Fobo%252FMS_1000744)\|selection ion m/z and [MS:1002234](https://www.ebi.ac.uk/ols4/ontologies/ms/classes/http%253A%252F%252Fpurl.obolibrary.org%252Fobo%252FMS_1002234)\|selection precursor m/z are unclear and should be avoided. | xsd:float | m/z | False | -### MAY +#### MAY | Name | Info | Value | Allowed units | Repeatable | |-----|-----|-----|-----|-----| @@ -86,9 +87,9 @@ | precursor apex intensity ([MS:1003086](https://www.ebi.ac.uk/ols4/ontologies/ms/classes/http%253A%252F%252Fpurl.obolibrary.org%252Fobo%252FMS_1003086)) | "Intensity of the precursor ion current as measured by its apex point over time and m/z. It is unspecified whether this is the intensity of the selected isotope or the most intense isotope." [PSI:MS] | xsd:float | / | False | | previous MSn-1 scan precursor intensity ([MS:1003085](https://www.ebi.ac.uk/ols4/ontologies/ms/classes/http%253A%252F%252Fpurl.obolibrary.org%252Fobo%252FMS_1003085)) | "Intensity of the precursor ion in the previous MSn-1 scan (prior in time to the referencing MSn scan). For an MS2 scan, this means the MS1 precursor intensity. It is unspecified on whether this is an apex (across m/z) intensity, integrated (across m/z) intensity, a centroided peak intensity of unknown origin, or even summed across several isotopes." [PSI:MS] | xsd:double | / | False | | possible charge state ([MS:1000633](https://www.ebi.ac.uk/ols4/ontologies/ms/classes/http%253A%252F%252Fpurl.obolibrary.org%252Fobo%252FMS_1000633)) | "A possible charge state of the ion in a situation where the charge of an ion is known to be one of several possible values rather than a completely unknown value or determined to be a specific charge with reasonable certainty." [PSI:MS] | xsd:integer | / | False | -| charge state ([MS:1000041](https://www.ebi.ac.uk/ols4/ontologies/ms/classes/http%253A%252F%252Fpurl.obolibrary.org%252Fobo%252FMS_1000041)) | "Number of net charges, positive or negative, on an ion." [PSI:MS]

**Notes:** The “charge state” attribute has two different meanings depending on its context. When this attribute is included under , it is used to denote the experimental charge state of the precursor as inferred from the data (e.g. by the isotopic pattern of the precursor peak in the MSn-1 spectrum). If the spectrum is identified to an analyte, the charge state refers to that of the analyte believed to produce this spectrum. In such cases, the charge state attribute should be included in the section instead. | xsd:integer | / | False | -| number of peaks ([MS:1003059](https://www.ebi.ac.uk/ols4/ontologies/ms/classes/http%253A%252F%252Fpurl.obolibrary.org%252Fobo%252FMS_1003059)) | "Number of peaks or features in a spectrum. For a peak-picked spectrum, this will correspond to the number of data points. For a non-peak-picked spectrum, this corresponds to the number of features discernable in the spectrum, which will be fewer than the number of data points." [PSI:PI]

**Notes:** This is the preferred term for a peak-picked (centroid) spectrum. Use the term “[MS:1003060](https://www.ebi.ac.uk/ols4/ontologies/ms/classes/http%253A%252F%252Fpurl.obolibrary.org%252Fobo%252FMS_1003060)\|number of data point” for a non-peak-picked (profile) spectrum. | xsd:integer | / | False | -| number of data points ([MS:1003060](https://www.ebi.ac.uk/ols4/ontologies/ms/classes/http%253A%252F%252Fpurl.obolibrary.org%252Fobo%252FMS_1003060)) | "Number of data points in a spectrum. For a peak-picked spectrum, this will correspond to the number of peaks. For a non-peak-picked spectrum, this corresponds to the number of values in the data array, which are not all peaks." [PSI:PI]

**Notes:** This is the preferred term for a non-peak-picked (profile) spectrum. Use the term “[MS:1003059](https://www.ebi.ac.uk/ols4/ontologies/ms/classes/http%253A%252F%252Fpurl.obolibrary.org%252Fobo%252FMS_1003059)\|number of peaks” for a peak-picked (centroid) spectrum. | xsd:integer | / | False | +| charge state ([MS:1000041](https://www.ebi.ac.uk/ols4/ontologies/ms/classes/http%253A%252F%252Fpurl.obolibrary.org%252Fobo%252FMS_1000041)) | "Number of net charges, positive or negative, on an ion." [PSI:MS]

**Notes:** The 'charge state' attribute has two different meanings depending on its context. When this attribute is included under , it is used to denote the experimental charge state of the precursor as inferred from the data (e.g. by the isotopic pattern of the precursor peak in the MSn-1 spectrum). If the spectrum is identified to an analyte, the charge state refers to that of the analyte believed to produce this spectrum. In such cases, the charge state attribute should be included in the section instead. | xsd:integer | / | False | +| number of peaks ([MS:1003059](https://www.ebi.ac.uk/ols4/ontologies/ms/classes/http%253A%252F%252Fpurl.obolibrary.org%252Fobo%252FMS_1003059)) | "Number of peaks or features in a spectrum. For a peak-picked spectrum, this will correspond to the number of data points. For a non-peak-picked spectrum, this corresponds to the number of features discernable in the spectrum, which will be fewer than the number of data points." [PSI:PI]

**Notes:** This is the preferred term for a peak-picked (centroid) spectrum. Use the term '[MS:1003060](https://www.ebi.ac.uk/ols4/ontologies/ms/classes/http%253A%252F%252Fpurl.obolibrary.org%252Fobo%252FMS_1003060)\|number of data point' for a non-peak-picked (profile) spectrum. | xsd:integer | / | False | +| number of data points ([MS:1003060](https://www.ebi.ac.uk/ols4/ontologies/ms/classes/http%253A%252F%252Fpurl.obolibrary.org%252Fobo%252FMS_1003060)) | "Number of data points in a spectrum. For a peak-picked spectrum, this will correspond to the number of peaks. For a non-peak-picked spectrum, this corresponds to the number of values in the data array, which are not all peaks." [PSI:PI]

**Notes:** This is the preferred term for a non-peak-picked (profile) spectrum. Use the term '[MS:1003059](https://www.ebi.ac.uk/ols4/ontologies/ms/classes/http%253A%252F%252Fpurl.obolibrary.org%252Fobo%252FMS_1003059)\|number of peaks' for a peak-picked (centroid) spectrum. | xsd:integer | / | False | | intensity unit ([MS:1000034](https://www.ebi.ac.uk/ols4/ontologies/ms/classes/http%253A%252F%252Fpurl.obolibrary.org%252Fobo%252FMS_1000034)) | "The determination of the mass of an ion based on the mass spectral peaks that represent multiple-charge ions." [PSI:MS] | Children of [MS:1000034](https://www.ebi.ac.uk/ols4/ontologies/ms/classes/http%253A%252F%252Fpurl.obolibrary.org%252Fobo%252FMS_1000034) | / | False | | base peak intensity ([MS:1000505](https://www.ebi.ac.uk/ols4/ontologies/ms/classes/http%253A%252F%252Fpurl.obolibrary.org%252Fobo%252FMS_1000505)) | "The intensity of the greatest peak in the mass spectrum." [PSI:MS] | xsd:float | number of detector counts, percent of base peak, counts per second, percent of base peak times 100, absorbance unit | False | | signal-to-noise ratio ([MS:1001884](https://www.ebi.ac.uk/ols4/ontologies/ms/classes/http%253A%252F%252Fpurl.obolibrary.org%252Fobo%252FMS_1001884)) | "Unitless number providing the ratio of the total measured intensity of a signal relative to the estimated noise level for that signal." [PSI:MS] | xsd:float | / | False | @@ -109,7 +110,7 @@ | similar spectrum USI ([MS:1003264](https://www.ebi.ac.uk/ols4/ontologies/ms/classes/http%253A%252F%252Fpurl.obolibrary.org%252Fobo%252FMS_1003264)) | "A cross reference to a similar spectrum in the form of a PSI Universal Spectrum Identifier" [PSI:PI] | xsd:string | / | False | | peak attribute ([MS:1003254](https://www.ebi.ac.uk/ols4/ontologies/ms/classes/http%253A%252F%252Fpurl.obolibrary.org%252Fobo%252FMS_1003254)) | "An attribute of a peak in a mass spectrum other than its m/z, intensity, and annotation. " [PSI:PI] | Children of [MS:1003254](https://www.ebi.ac.uk/ols4/ontologies/ms/classes/http%253A%252F%252Fpurl.obolibrary.org%252Fobo%252FMS_1003254) | / | True | -### SHOULD +#### SHOULD | Name | Info | Value | Allowed units | Repeatable | |-----|-----|-----|-----|-----| @@ -118,13 +119,14 @@ | spectrum origin type ([MS:1003072](https://www.ebi.ac.uk/ols4/ontologies/ms/classes/http%253A%252F%252Fpurl.obolibrary.org%252Fobo%252FMS_1003072)) | "Categorization of a spectrum based on its origin (e.g., observed spectrum, predicted spectrum, demultiplexed spectrum, etc.)." [PSI:PI] | Children of [MS:1003072](https://www.ebi.ac.uk/ols4/ontologies/ms/classes/http%253A%252F%252Fpurl.obolibrary.org%252Fobo%252FMS_1003072) | / | False | | spectrum aggregation type ([MS:1003065](https://www.ebi.ac.uk/ols4/ontologies/ms/classes/http%253A%252F%252Fpurl.obolibrary.org%252Fobo%252FMS_1003065)) | "Categorization of a spectrum based on its type of aggregation (e.g., individual spectrum, consensus spectrum, best replicate spectrum, etc.)." [PSI:PI] | Children of [MS:1003065](https://www.ebi.ac.uk/ols4/ontologies/ms/classes/http%253A%252F%252Fpurl.obolibrary.org%252Fobo%252FMS_1003065) | / | False | -## `/Library/Spectrum/Analyte` -### MAY +### Metadata specific to the analyte +These attributes refer to the analyte(s) to which the spectrum is identified. In the present version of the library format, only peptide analytes are supported, but support for other kinds of analytes (e.g. small molecule metabolites) are expected in the future. They MUST be listed under +#### MAY | Name | Info | Value | Allowed units | Repeatable | |-----|-----|-----|-----|-----| -| charge state ([MS:1000041](https://www.ebi.ac.uk/ols4/ontologies/ms/classes/http%253A%252F%252Fpurl.obolibrary.org%252Fobo%252FMS_1000041)) | "Number of net charges, positive or negative, on an ion." [PSI:MS]

**Notes:** The "charge state" attribute has two different meanings depending on its context. When this attribute is included under , it is used to denote the experimental charge state of the precursor as inferred from the data (e.g. by the isotopic pattern of the precursor peak in the MSn-1 spectrum). If the spectrum is identified to an analyte, the charge state refers to that of the analyte believed to produce this spectrum. In such cases, the charge state attribute should be included in the section instead. | xsd:integer | / | False | -| theoretical mass ([MS:1001117](https://www.ebi.ac.uk/ols4/ontologies/ms/classes/http%253A%252F%252Fpurl.obolibrary.org%252Fobo%252FMS_1001117)) | "The theoretical neutral mass of the molecule (e.g. the peptide sequence and its modifications) not including its charge carrier." [PSI:PI]

**Notes:** This is the theoretical mass of the neutral molecule (does not include the charge-giving moiety. Use the term “[MS:1003243](https://www.ebi.ac.uk/ols4/ontologies/ms/classes/http%253A%252F%252Fpurl.obolibrary.org%252Fobo%252FMS_1003243)\|adduct ion mass” to refer to the mass of the adduct ion, which includes the charge-giving moiety. | xsd:double | dalton | False | +| charge state ([MS:1000041](https://www.ebi.ac.uk/ols4/ontologies/ms/classes/http%253A%252F%252Fpurl.obolibrary.org%252Fobo%252FMS_1000041)) | "Number of net charges, positive or negative, on an ion." [PSI:MS]

**Notes:** The 'charge state' attribute has two different meanings depending on its context. When this attribute is included under , it is used to denote the experimental charge state of the precursor as inferred from the data (e.g. by the isotopic pattern of the precursor peak in the MSn-1 spectrum). If the spectrum is identified to an analyte, the charge state refers to that of the analyte believed to produce this spectrum. In such cases, the charge state attribute should be included in the section instead. | xsd:integer | / | False | +| theoretical mass ([MS:1001117](https://www.ebi.ac.uk/ols4/ontologies/ms/classes/http%253A%252F%252Fpurl.obolibrary.org%252Fobo%252FMS_1001117)) | "The theoretical neutral mass of the molecule (e.g. the peptide sequence and its modifications) not including its charge carrier." [PSI:PI]

**Notes:** This is the theoretical mass of the neutral molecule (does not include the charge-giving moiety. Use the term '[MS:1003243](https://www.ebi.ac.uk/ols4/ontologies/ms/classes/http%253A%252F%252Fpurl.obolibrary.org%252Fobo%252FMS_1003243)\|adduct ion mass' to refer to the mass of the adduct ion, which includes the charge-giving moiety. | xsd:double | dalton | False | | adduct ion mass ([MS:1003243](https://www.ebi.ac.uk/ols4/ontologies/ms/classes/http%253A%252F%252Fpurl.obolibrary.org%252Fobo%252FMS_1003243)) | "The theoretical mass of the adduct ion (e.g. for a singly-charged protonated peptide ion, this value would be the neutral peptide molecule's mass plus the mass of a proton)" [PSI:PI] | xsd:float | / | False | | adduct ion formula ([MS:1002813](https://www.ebi.ac.uk/ols4/ontologies/ms/classes/http%253A%252F%252Fpurl.obolibrary.org%252Fobo%252FMS_1002813)) | "Adduct formation formula of the form M+X or M-X, as constrained by the provided regular expression." [PSI:MS]

**Notes:** For peptides, absence of this field implies that the adduct ion is [M+nH]n+ where n is the charge state. The regular expression for this field is given in the definition of [MS:1002812](https://www.ebi.ac.uk/ols4/ontologies/ms/classes/http%253A%252F%252Fpurl.obolibrary.org%252Fobo%252FMS_1002812)\|Regular expression for adduct ion formula. | xsd:string | / | False | | theoretical monoisotopic m/z ([MS:1003053](https://www.ebi.ac.uk/ols4/ontologies/ms/classes/http%253A%252F%252Fpurl.obolibrary.org%252Fobo%252FMS_1003053)) | "Mass-to-charge ratio of a peptidoform ion composed of the most common isotope of each atom computed from the putative knowledge of its molecular constituents." [PSI:PI] | xsd:float | / | False | diff --git a/docs/specification/index.rst b/docs/specification/index.rst new file mode 100644 index 0000000..e2ba9e3 --- /dev/null +++ b/docs/specification/index.rst @@ -0,0 +1,11 @@ +#################### +Format specification +#################### + +.. toctree:: + :caption: Contents + :glob: + :maxdepth: 2 + + specification + metadata diff --git a/docs/specification/metadata.rst b/docs/specification/metadata.rst new file mode 100644 index 0000000..2de7a2e --- /dev/null +++ b/docs/specification/metadata.rst @@ -0,0 +1,6 @@ +################### +Metadata attributes +################### + +.. include:: ../metadata-rules.md + :parser: myst_parser.sphinx_ diff --git a/docs/specification/specification.rst b/docs/specification/specification.rst new file mode 100644 index 0000000..cae515e --- /dev/null +++ b/docs/specification/specification.rst @@ -0,0 +1,3 @@ +############# +Specification +############# diff --git a/implementations/python/mzlib/validate/rules/all.json b/implementations/python/mzlib/validate/rules/all.json index 735eb24..de143c4 100644 --- a/implementations/python/mzlib/validate/rules/all.json +++ b/implementations/python/mzlib/validate/rules/all.json @@ -1015,7 +1015,7 @@ "accession": "MS:1000041", "name": "charge state", "repeatable": false, - "notes": "The \u201ccharge state\u201d attribute has two different meanings depending on its context. When this attribute is included under , it is used to denote the experimental charge state of the precursor as inferred from the data (e.g. by the isotopic pattern of the precursor peak in the MSn-1 spectrum). If the spectrum is identified to an analyte, the charge state refers to that of the analyte believed to produce this spectrum. In such cases, the charge state attribute should be included in the section instead.", + "notes": "The 'charge state' attribute has two different meanings depending on its context. When this attribute is included under , it is used to denote the experimental charge state of the precursor as inferred from the data (e.g. by the isotopic pattern of the precursor peak in the MSn-1 spectrum). If the spectrum is identified to an analyte, the charge state refers to that of the analyte believed to produce this spectrum. In such cases, the charge state attribute should be included in the section instead.", "value": { "name": "value_of_type", "value": "xsd:integer" @@ -1032,7 +1032,7 @@ "accession": "MS:1003059", "name": "number of peaks", "repeatable": false, - "notes": "This is the preferred term for a peak-picked (centroid) spectrum. Use the term \u201cMS:1003060|number of data point\u201d for a non-peak-picked (profile) spectrum.", + "notes": "This is the preferred term for a peak-picked (centroid) spectrum. Use the term 'MS:1003060|number of data point' for a non-peak-picked (profile) spectrum.", "value": { "name": "value_of_type", "value": "xsd:integer" @@ -1049,7 +1049,7 @@ "accession": "MS:1003060", "name": "number of data points", "repeatable": false, - "notes": "This is the preferred term for a non-peak-picked (profile) spectrum. Use the term \u201cMS:1003059|number of peaks\u201d for a peak-picked (centroid) spectrum.", + "notes": "This is the preferred term for a non-peak-picked (profile) spectrum. Use the term 'MS:1003059|number of peaks' for a peak-picked (centroid) spectrum.", "value": { "name": "value_of_type", "value": "xsd:integer" @@ -1387,7 +1387,7 @@ "accession": "MS:1000041", "name": "charge state", "repeatable": false, - "notes": "The \"charge state\" attribute has two different meanings depending on its context. When this attribute is included under , it is used to denote the experimental charge state of the precursor as inferred from the data (e.g. by the isotopic pattern of the precursor peak in the MSn-1 spectrum). If the spectrum is identified to an analyte, the charge state refers to that of the analyte believed to produce this spectrum. In such cases, the charge state attribute should be included in the section instead.", + "notes": "The 'charge state' attribute has two different meanings depending on its context. When this attribute is included under , it is used to denote the experimental charge state of the precursor as inferred from the data (e.g. by the isotopic pattern of the precursor peak in the MSn-1 spectrum). If the spectrum is identified to an analyte, the charge state refers to that of the analyte believed to produce this spectrum. In such cases, the charge state attribute should be included in the section instead.", "value": { "name": "value_of_type", "value": "xsd:integer" @@ -1404,7 +1404,7 @@ "accession": "MS:1001117", "name": "theoretical mass", "repeatable": false, - "notes": "This is the theoretical mass of the neutral molecule (does not include the charge-giving moiety. Use the term \u201cMS:1003243|adduct ion mass\u201d to refer to the mass of the adduct ion, which includes the charge-giving moiety.", + "notes": "This is the theoretical mass of the neutral molecule (does not include the charge-giving moiety. Use the term 'MS:1003243|adduct ion mass' to refer to the mass of the adduct ion, which includes the charge-giving moiety.", "value": { "name": "value_of_type", "value": "xsd:double" @@ -1575,4 +1575,4 @@ "requirement_level": "MAY" } ] -} \ No newline at end of file +} diff --git a/implementations/python/pyproject.toml b/implementations/python/pyproject.toml index 4b2cb8c..826c81b 100644 --- a/implementations/python/pyproject.toml +++ b/implementations/python/pyproject.toml @@ -1,3 +1,43 @@ +[project] +name='mzlib' +version='0.1.0-alpha' +description='HUPO-PSI Spectral library format' +classifiers=[ + "Intended Audience :: Science/Research", + "Programming Language :: Python :: 3 :: Only", + "Topic :: Scientific/Engineering :: Bio-Informatics", + "Development Status :: 3 - Alpha" +] +dependencies = [ + "sqlalchemy", + "click", + "psims >= 0.1.41", + "pyteomics >= 4.5.3", +] + +[project.optional-dependencies] +test = [ + "jsonschema" +] +docs = [ + "sphinx", + "pydata-sphinx-theme", + "numpydoc>=1,<2", + "sphinx_click", + "myst-parser", + "sphinx-autobuild", +] + +[project.scripts] +mzspeclib = "mzlib.tools.cli:main" + +[build-system] +requires = ["setuptools"] +build-backend = "setuptools.build_meta" + +[tool.setuptools.packages] +find = {} + [tool.ruff] target-version = "py38" line-length = 120 @@ -5,4 +45,4 @@ select = ["D"] ignore = ["D415", "D400", "D212", "D205", "D203", "D105"] [tool.ruff.pydocstyle] -convention = "numpy" \ No newline at end of file +convention = "numpy" diff --git a/implementations/python/setup.py b/implementations/python/setup.py deleted file mode 100644 index 2f258d9..0000000 --- a/implementations/python/setup.py +++ /dev/null @@ -1,30 +0,0 @@ -"""Setup project.""" - -from setuptools import setup, find_packages - -setup( - name='mzlib', - packages=find_packages(exclude=('tests',)), - version='0.1.0-alpha', - description='HUPO-PSI Spectral library format', - entry_points={ - 'console_scripts': [ - "mzspeclib = mzlib.tools.cli:main" - ], - }, - classifiers=[ - "Intended Audience :: Science/Research", - "Programming Language :: Python :: 3 :: Only", - "Topic :: Scientific/Engineering :: Bio-Informatics", - "Development Status :: 3 - Alpha" - ], - install_requires=[ - "sqlalchemy", - "click", - "psims >= 0.1.41", - "pyteomics >= 4.5.3", - ], - test_requires=[ - "jsonschema" - ] -)