Skip to content

Commit

Permalink
added final funcion for sage.
Browse files Browse the repository at this point in the history
  • Loading branch information
“Karim committed Oct 26, 2023
1 parent 393ca12 commit c8ce0d1
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions spectrum_fundamentals/mod_string.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,29 @@
from itertools import repeat
from typing import Dict, List, Optional, Tuple

from .constants import MAXQUANT_VAR_MODS, MOD_MASSES, MOD_NAMES, SPECTRONAUT_MODS
from .constants import MAXQUANT_VAR_MODS, MOD_MASSES, MOD_NAMES, SPECTRONAUT_MODS , MOD_MASSES_SAGE

def sage_to_internal(sequences: List[str])->List[str]:
# Find the number within square brackets (as a float)
start_idx = sequences.find('[') + 1
end_idx = sequences.find(']')

# Extract the number string
number_str = sequences[start_idx:end_idx]

try:
# Attempt to convert the number to a float
number = float(number_str)
except ValueError:
# If conversion fails, keep the original text
return sequences

# Replace with the corresponding value from the dictionary
if number in MOD_MASSES_SAGE:
return sequences.replace(f'[{number_str}]', MOD_MASSES_SAGE[number])
else:
return sequences

def sage_to_internal():

def internal_to_spectronaut(sequences: List[str]) -> List[str]:
"""
Expand Down

0 comments on commit c8ce0d1

Please sign in to comment.