Skip to content
Merged
Show file tree
Hide file tree
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
8 changes: 3 additions & 5 deletions ms2rescore/utils.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import logging
import os
import re
from glob import glob
from pathlib import Path
from typing import Optional, Union

from ms2rescore.exceptions import MS2RescoreConfigurationError
from ms2rescore_rs import is_supported_file_type

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -66,11 +66,9 @@ def infer_spectrum_path(
)

# Match with file extension if not in resolved_path yet
if not _is_minitdf(resolved_path) and not re.match(
r"\.mgf$|\.mzml$|\.d$", resolved_path, flags=re.IGNORECASE
):
if not is_supported_file_type(resolved_path) or not os.path.exists(resolved_path):
for filename in glob(resolved_path + "*"):
if re.match(r".*(\.mgf$|\.mzml$|\.d)", filename, flags=re.IGNORECASE):
if is_supported_file_type(filename):
resolved_path = filename
break
else:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ dependencies = [
"lxml>=4.5",
"mokapot>=0.10",
"ms2pip>=4.0.0",
"ms2rescore_rs>=0.3.0",
"ms2rescore_rs>=0.4.0",
"numpy>=1.25",
"pandas>=1",
"plotly>=5",
Expand Down