Skip to content

Commit 0438755

Browse files
committed
Fix proteome_name derivation to use Path.stem
Replace str(proteome).split('/')[-1].split('.')[0] with Path(...).stem in Matcher and Preprocessor. The old logic truncated names at the first dot (so human.v1.fasta and human.v2.fasta both mapped to 'human', colliding on the same .pepidx index) and hardcoded '/' (breaking on Windows paths).
1 parent 0caf485 commit 0438755

4 files changed

Lines changed: 356 additions & 3 deletions

File tree

pepmatch/matcher.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ def __init__(
112112
raise ValueError('counts_only is not supported with best_match.')
113113

114114
self.proteome_file = str(proteome_file)
115-
self.proteome_name = str(proteome_file).split('/')[-1].split('.')[0]
115+
self.proteome_name = Path(proteome_file).stem
116116
self.max_mismatches = max_mismatches
117117
self.preprocessed_files_path = preprocessed_files_path
118118
self.best_match = best_match

pepmatch/preprocessor.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import os
2+
from pathlib import Path
23
from ._rs import rs_preprocess
34

45
class Preprocessor:
@@ -20,7 +21,7 @@ def __init__(
2021
self.proteome_file = str(proteome)
2122

2223
if not proteome_name:
23-
self.proteome_name = str(proteome).split('/')[-1].split('.')[0]
24+
self.proteome_name = Path(proteome).stem
2425
else:
2526
self.proteome_name = proteome_name
2627

pepmatch/rs-engine/Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)