Skip to content

Commit

Permalink
Merge pull request bigbio#17 from bigbio/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
ypriverol authored Oct 18, 2023
2 parents 14bdd80 + de8c1d0 commit 9731be2
Show file tree
Hide file tree
Showing 23 changed files with 639 additions and 294 deletions.
2 changes: 1 addition & 1 deletion docs/ae.rst
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,4 @@ We suggest including the following properties in the header:
(e.g. ``tissue``)

Please check also the differential expression example for more
information `DE <DE.rst>`__
information :doc:`de`
5 changes: 3 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@

# -- Project information -----------------------------------------------------

project = 'quantms'
project = 'quantms.io'
copyright = '2022, daichengxin, jpfeuffer, timosachenberg, ypriverol'
author = 'daichengxin, jpfeuffer, timosachenberg, ypriverol'

# The full version, including alpha/beta/rc tags
release = '1.1.0'
release = '1.0'


# -- General configuration ---------------------------------------------------
Expand All @@ -31,6 +31,7 @@
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx.ext.autosectionlabel',
]

# Add any paths that contain templates here, relative to this directory.
Expand Down
2 changes: 1 addition & 1 deletion docs/de.rst
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,4 @@ We suggest including the following properties in the header:
(e.g. ``adj.pvalue < 0.05``)

A complete example of a quantms output file can be seen
`here <../include/PXD004683-quantms.csv>`__.
`here <https://github.com/bigbio/quantms.io/blob/dev/docs/include/PXD004683-quantms.csv>`__.
6 changes: 3 additions & 3 deletions docs/feature.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ Format

Peptide properties and columns:

- ``sequence``: The peptide’s sequence corresponding to the feature, this peptide sequence do not includes posttraslational modifications -> ``string``
- ``sequence``: The peptide’s sequence corresponding to the feature, this peptide sequence do not includes post-translational modifications -> ``string``
- ``unique``: Indicates whether the peptide sequence is unique for this protein in respect to the searched database -> ``boolean (0/1)``
- ``modifications``: A list of modifications for a give peptide ``[modification1, modification2, ...]``. A modification should be
recorded as string like `modification definition <README.rst#modifications>`__-> ``list[string]``
recorded as string like :ref:`modifications` -> ``list[string]``
- ``charge``: The charge assigned by the search engine/software -> ``integer``
- ``calc_mass_to_charge``: The PSM’s calculated (theoretical) mass to charge (m/z) -> ``double``
- ``exp_mass_to_charge``: The PSM’s experimental mass to charge (m/z) -> ``double``
- ``peptidoform``: Peptidoform of the PSM. See more `documentation here <Introduction.rst#peptidoform>`__. -> ``string``
- ``peptidoform``: Peptidoform of the PSM. See more :ref:`peptidoform` -> ``string``
- ``posterior_error_probability``: Posterior Error Probability score from quantms -> ``double``
- ``global_qvalue``: Global q-value for the feature for the peptide identification in the experiment -> ``double``
- ``is_decoy``: Indicates whether the peptide sequence (coming from the PSM) is decoy -> ``boolean (0/1)``
Expand Down
8 changes: 4 additions & 4 deletions docs/introduction.rst
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
Introduction to quantms.io
======================================

The ``.qms`` folder will contain multiple metadata files that will be
The ``.qms`` folder will contain multiple files that will be
used to describe the project, the samples, the data acquisition and the
data processing. Each of these files will be described in the following
data processing, in addition to the data files. Each of these files will be described in the following
sections:

- :doc:`metadata`: A json file for metadata about the
analyzed project
- :doc:`ae` or :doc:`ae`: A csv file based on the MSstats (TODO link) format for either absolute expression or
- :doc:`ae` or :doc:`de`: A csv file based on the `MSstats <https://github.com/Vitek-Lab/MSstats>`_ format for either absolute expression or
differential expression.

Some general rules for all the files:
Expand Down Expand Up @@ -77,4 +77,4 @@ This concept is used in the following outputs:

- :doc:`psm`
- :doc:`feature`
- :doc:`peptide`
- :doc:`peptide`
331 changes: 241 additions & 90 deletions docs/tools.rst

Large diffs are not rendered by default.

55 changes: 36 additions & 19 deletions python/quantmsio/quantms_io/commands/absolute_expression_command.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
from quantms_io.core.ae import AbsoluteExpressionHander
import click
CONTEXT_SETTINGS = dict(help_option_names=["-h", "--help"])


@click.group(context_settings=CONTEXT_SETTINGS)
def cli():
"""
This is the main tool that gives access to all commands.
"""

@click.command(
"convert-ibaq-absolute",
"convert_ibaq_absolute",
short_help="Convert a ibaq_absolute file into a quantms.io file " "format",
)
@click.option(
Expand All @@ -10,46 +19,54 @@
required=True,
)
@click.option(
"--output_folder", help="Folder to generate the df expression file.", required=True
"--sdrf_file",
help="the sdrf_file path",
required=True,
)
@click.option("--output_prefix_file", help="Prefix of the df expression file", required=False)
@click.option(
"--generate_project",
help="Generate project.json for pride project, Otherwise, False",
"--project_file",
help="quantms.io project file",
required=False,
is_flag=True,
)
@click.option(
"--output_folder", help="Folder to generate the df expression file.", required=True
)
@click.option("--output_prefix_file", help="Prefix of the df expression file", required=False)
@click.option(
"--delete_existing", help="Delete existing files in the output folder", is_flag=True
)
@click.option("--project_file", help="quantms.io project file", required=False)
def convert_ibaq_absolute(
@click.pass_context
def convert_ibaq_absolute(ctx,
ibaq_file:str,
sdrf_file:str,
project_file: str,
output_folder: str,
output_prefix_file: str,
generate_project: bool = True,
delete_existing: bool = True,
project_file:str = None,
):
"""
Convert a IBAQ absolute file into a quantms.io file format. The file definition is available in the docs
https://github.com/bigbio/quantms.io/blob/main/docs/AE.md.
:param ibaq_file: IBAQ file
:param sdrf_file: sdrf file
:param project_file: quantms.io project file
:param output_folder: Folder to generate the df expression file.
:param output_prefix_file: Prefix of the df expression file
:param generate_project: "Generate project.json for pride project, Otherwise, False"
:param delete_existing: Delete existing files in the output folder
:return: none
"""
de_handler = AbsoluteExpressionHander()
if generate_project:
de_handler.load_project_file(project_file)
de_handler.load_ibaq_file(ibaq_file)
de_handler.convert_ibaq_to_quantms(
ae_handler = AbsoluteExpressionHander()
if project_file:
ae_handler.load_project_file(project_file)
ae_handler.load_ibaq_file(ibaq_file)
ae_handler.load_sdrf_file(sdrf_file)
ae_handler.convert_ibaq_to_quantms(
output_folder=output_folder,
output_prefix_file_prefix=output_prefix_file,
output_file_prefix=output_prefix_file,
delete_existing=delete_existing,
)
if generate_project:
de_handler.update_project_file(project_file)

cli.add_command(convert_ibaq_absolute)

if __name__ == '__main__':
cli()
37 changes: 37 additions & 0 deletions python/quantmsio/quantms_io/commands/attach_file_command.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
from quantms_io.core.tools import register_file_to_json
import click
CONTEXT_SETTINGS = dict(help_option_names=["-h", "--help"])


@click.group(context_settings=CONTEXT_SETTINGS)
def cli():
"""
This is the main tool that gives access to all commands.
"""


@click.command("attach_file_to_json", short_help="Register the file to project.json.",)
@click.option("--project_file", help="the project.json file", required=True)
@click.option("--attach_file", help="The path of the file that will be registered", required=True)
@click.option("--category", type=click.Choice(['feature_file', 'psm_file', 'differential_file',
'absolute_file'], case_sensitive=False),
help="The type of file that will be registered.", required=True)
@click.option("--replace_existing", help="Whether to delete old files", is_flag=True)
@click.pass_context
def attach_file_to_json(ctx, project_file, attach_file, category, replace_existing):
"""
Register the file with project.json
:param project_file: the project.json file path
:param attach_file: The path of the file that will be registered
:param category: The type of file that will be registered
:param replace_existing Whether to delete old files
:return: none
"""
register_file_to_json(project_file, attach_file,
category, replace_existing)


cli.add_command(attach_file_to_json)

if __name__ == '__main__':
cli()
Original file line number Diff line number Diff line change
@@ -1,19 +1,30 @@
import click

from quantms_io.core.de import DifferentialExpressionHandler
CONTEXT_SETTINGS = dict(help_option_names=["-h", "--help"])


@click.group(context_settings=CONTEXT_SETTINGS)
def cli():
"""
This is the main tool that gives access to all commands.
"""

@click.command(
"convert-msstats-differential",
"convert_msstats_differential",
short_help="Convert a MSstats differential file into a quantms.io file " "format",
)
@click.option("--msstats_file", help="MSstats differential file", required=True)
@click.option("--project_file", help="quantms.io project file", required=False)
@click.option(
"--sdrf_file",
help="the SDRF file needed to extract some of the metadata",
required=True,
)
@click.option(
"--project_file",
help="quantms.io project file",
required=False,
)
@click.option(
"--fdr_threshold",
help="FDR threshold to use to filter the results",
Expand All @@ -24,44 +35,38 @@
"--output_folder", help="Folder to generate the df expression file.", required=True
)
@click.option("--output_prefix_file", help="Prefix of the df expression file", required=False)
@click.option(
"--generate_project",
help="Generate project.json for pride project, Otherwise, False",
required=False,
is_flag=True,
)
@click.option(
"--delete_existing", help="Delete existing files in the output folder", is_flag=True
)
@click.pass_context
def convert_msstats_differential(
ctx,
msstats_file: str,
sdrf_file: str,
project_file:str,
fdr_threshold: float,
output_folder: str,
output_prefix_file: str,
generate_project: bool= True,
delete_existing: bool=True,
project_file: str = None,
):
"""
Convert a MSstats differential file into a quantms.io file format. The file definition is available in the docs
https://github.com/bigbio/quantms.io/blob/main/docs/DE.md.
:param msstats_file: MSstats differential file
:param project_file: quantms.io project file
:param sdrf_file: the SDRF file needed to extract some of the metadata
:param project_file: quantms.io project file
:param output_folder: Folder to generate the df expression file.
:param output_prefix_file: Prefix of the df expression file
:param delete_existing: Delete existing files in the output folder
:param fdr_threshold: FDR threshold to use to filter the results
:param generate_project: "Generate project.json for pride project, Otherwise, False"
:return: none
"""

if msstats_file is None or project_file is None or output_folder is None:
if msstats_file is None or sdrf_file is None or output_folder is None:
raise click.UsageError("Please provide all the required parameters")

de_handler = DifferentialExpressionHandler()
if generate_project:
if project_file:
de_handler.load_project_file(project_file)
de_handler.load_msstats_file(msstats_file)
de_handler.load_sdrf_file(sdrf_file)
Expand All @@ -71,5 +76,7 @@ def convert_msstats_differential(
output_file_prefix=output_prefix_file,
delete_existing=delete_existing,
)
if generate_project:
de_handler.update_project_file(project_file)

cli.add_command(convert_msstats_differential)
if __name__ == '__main__':
cli()
Loading

0 comments on commit 9731be2

Please sign in to comment.