Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

idXML updates #74

Merged
merged 2 commits into from
Mar 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions psm_utils/io/idxml.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,29 @@
is parsed as an individual :py:class:`~psm_utils.psm.PSM` object.

"""


from __future__ import annotations

import logging
import re
from warnings import filterwarnings
from pathlib import Path
from typing import Iterable, List, Tuple, Union

import pyopenms as oms

from psm_utils.exceptions import PSMUtilsException
from psm_utils.io._base_classes import ReaderBase, WriterBase
from psm_utils.psm import PSM
from psm_utils.psm_list import PSMList
from psm_utils.peptidoform import Peptidoform

filterwarnings(
"ignore",
message="OPENMS_DATA_PATH environment variable already exists",
category=UserWarning,
module="pyopenms",
)

import pyopenms as oms #noqa: E402

logger = logging.getLogger(__name__)

# Patterns to match open and closed round/square brackets
Expand Down Expand Up @@ -105,7 +111,7 @@ def __iter__(self) -> Iterable[PSM]:
for peptide_hit in peptide_id.getHits():
yield self._parse_psm(self.protein_ids, peptide_id, peptide_hit)

def _parse_idxml(self) -> Tuple(oms.ProteinIdentification, oms.PeptideIdentification):
def _parse_idxml(self) -> Tuple[oms.ProteinIdentification, oms.PeptideIdentification]:
"""
Parse idXML using pyopenms and perform sanity checks to make sure the file is not empty.
"""
Expand Down
Loading