File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed
Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change 77
88import numpy as np
99
10+ from hdxms_datasets .models import DeuterationType , Peptides
11+
1012
1113def diff_sequence (a : str , b : str ) -> float :
1214 return difflib .SequenceMatcher (None , a , b ).ratio ()
@@ -184,3 +186,13 @@ def peptide_redundancy(
184186 redundancy [i0 :i1 ] += 1
185187
186188 return r_number , redundancy
189+
190+
191+ def get_peptides_by_type (peptides : list [Peptides ], deuteration_type : DeuterationType ) -> Peptides :
192+ """Get peptides of a specific deuteration type."""
193+ matching_peptides = [p for p in peptides if p .deuteration_type == deuteration_type ]
194+ if not matching_peptides :
195+ raise ValueError (f"No peptides found with deuteration type: { deuteration_type } " )
196+ if len (matching_peptides ) > 1 :
197+ raise ValueError (f"Multiple peptides found with deuteration type: { deuteration_type } " )
198+ return matching_peptides [0 ]
You can’t perform that action at this time.
0 commit comments