From 8bde7b9a0faf7e74620bb8dd02dac22971a11578 Mon Sep 17 00:00:00 2001 From: RalfG Date: Mon, 6 May 2024 17:46:52 +0200 Subject: [PATCH] Add io.parquet module to docs --- docs/source/api/psm_utils.io.rst | 23 ++++++++++++++++------- psm_utils/io/__init__.py | 12 ++++++------ psm_utils/io/sage.py | 6 +++--- 3 files changed, 25 insertions(+), 16 deletions(-) diff --git a/docs/source/api/psm_utils.io.rst b/docs/source/api/psm_utils.io.rst index 40e42d7..d858997 100644 --- a/docs/source/api/psm_utils.io.rst +++ b/docs/source/api/psm_utils.io.rst @@ -6,19 +6,19 @@ psm_utils.io :members: -psm_utils.io.ionbot -########################## -.. automodule:: psm_utils.io.ionbot +psm_utils.io.idxml +################## + +.. automodule:: psm_utils.io.idxml :members: :inherited-members: +psm_utils.io.ionbot +########################## -psm_utils.io.idxml -################## - -.. automodule:: psm_utils.io.idxml +.. automodule:: psm_utils.io.ionbot :members: :inherited-members: @@ -51,6 +51,15 @@ psm_utils.io.mzid +psm_utils.io.parquet +################# + +.. automodule:: psm_utils.io.parquet + :members: + :inherited-members: + + + psm_utils.io.peptide_record ########################### diff --git a/psm_utils/io/__init__.py b/psm_utils/io/__init__.py index 45b3d7a..79f09ac 100644 --- a/psm_utils/io/__init__.py +++ b/psm_utils/io/__init__.py @@ -28,6 +28,12 @@ from psm_utils.psm_list import PSMList FILETYPES = { + "ionbot": { + "reader": ionbot.IonbotReader, + "writer": None, + "extension": "ionbot.first.csv", + "filename_pattern": r"^ionbot.first.csv$", + }, "idxml": { "reader": idxml.IdXMLReader, "writer": idxml.IdXMLWriter, @@ -100,12 +106,6 @@ "extension": ".parquet", "filename_pattern": r"^.*(?:_|\.).sage.parquet$", }, - "ionbot": { - "reader": ionbot.IonbotReader, - "writer": None, - "extension": "ionbot.first.csv", - "filename_pattern": r"^ionbot.first.csv$", - }, "parquet": { # List after proteoscape and sage to avoid extension matching conflicts "reader": parquet.ParquetReader, "writer": parquet.ParquetWriter, diff --git a/psm_utils/io/sage.py b/psm_utils/io/sage.py index 4cc23e3..eb1fae9 100644 --- a/psm_utils/io/sage.py +++ b/psm_utils/io/sage.py @@ -24,7 +24,7 @@ set_csv_field_size_limit() -class SageReaderBase(ReaderBase, ABC): +class _SageReaderBase(ReaderBase, ABC): def __init__( self, filename, score_column: str = "sage_discriminant_score", *args, **kwargs ) -> None: @@ -104,7 +104,7 @@ def from_dataframe(cls, dataframe) -> PSMList: ) -class SageTSVReader(SageReaderBase): +class SageTSVReader(_SageReaderBase): def __iter__(self) -> Iterable[PSM]: """Iterate over file and return PSMs one-by-one.""" with open(self.filename, "r") as open_file: @@ -119,7 +119,7 @@ def __iter__(self) -> Iterable[PSM]: SageReader = SageTSVReader # Alias for backwards compatibility -class SageParquetReader(SageReaderBase): +class SageParquetReader(_SageReaderBase): def __iter__(self) -> Iterable[PSM]: """Iterate over file and return PSMs one-by-one.""" with pq.ParquetFile(self.filename) as pq_file: