File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed
Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -308,7 +308,23 @@ def __mul__(self, times: int) -> Py_AASequence:
308308 def __rmul__ (self , times : int ) -> Py_AASequence :
309309 """Support int * Py_AASequence."""
310310 return self .__mul__ (times )
311-
311+ def __contains__ (self , substring : str ) -> bool :
312+ """Check if substring is in sequence."""
313+ return self .has_substring (substring )
314+
315+ def __hash__ (self ) -> int :
316+ """Make sequences hashable for use in sets/dicts."""
317+ return hash (self .sequence )
318+
319+ def __lt__ (self , other : Py_AASequence ) -> bool :
320+ """Lexicographic comparison by sequence."""
321+ if not isinstance (other , Py_AASequence ):
322+ return NotImplemented
323+ return self .sequence < other .sequence
324+ def count (self , residue : str ) -> int :
325+ """Count occurrences of a residue, to be consistent with str.count()."""
326+ return self ._sequence .count (residue )
327+
312328 # ==================== Additional Utilities ====================
313329
314330 def get_mz (self , charge : int ) -> float :
You can’t perform that action at this time.
0 commit comments