Skip to content

Commit

Permalink
Add io.parquet module to docs
Browse files Browse the repository at this point in the history
  • Loading branch information
RalfG committed May 6, 2024
1 parent 6e51896 commit 8bde7b9
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 16 deletions.
23 changes: 16 additions & 7 deletions docs/source/api/psm_utils.io.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down Expand Up @@ -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
###########################

Expand Down
12 changes: 6 additions & 6 deletions psm_utils/io/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions psm_utils/io/sage.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand All @@ -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:
Expand Down

0 comments on commit 8bde7b9

Please sign in to comment.