@@ -192,6 +192,49 @@ def tearDown(self):
192192 self .polymers_long = None
193193
194194
195+ class TestParsePDBHeaderSEPModres (unittest .TestCase ):
196+ """Test that SEP (phosphoserine) is correctly converted to S (SER) via
197+ MODRES records, reproducing the 5FC2 scenario reported in GitHub issue
198+ comments: chain A has SEP at position 4 mapped to SER, and a ligand
199+ 6L3 that should fall back to 'X'."""
200+
201+ def setUp (self ):
202+ self .polymers = parsePDBHeader (
203+ pathDatafile ('sep_modres' ), 'polymers' )
204+ self .polymers_long = parsePDBHeader (
205+ pathDatafile ('sep_modres' ), 'polymers' , longSeq = True )
206+
207+ def testPolymerPresent (self ):
208+ self .assertEqual (len (self .polymers ), 1 ,
209+ 'expected exactly one polymer chain' )
210+
211+ def testOneLetterSequenceSEP (self ):
212+ """SEP should map to S (SER) and ligand 6L3 should fall back to X."""
213+ seq = self .polymers [0 ].sequence
214+ self .assertEqual (seq , 'DKSIEVGRX' ,
215+ 'one-letter sequence incorrect; got {0!r}, expected "DKSIEVGRX"'
216+ .format (seq ))
217+
218+ def testLongSequenceContainsSEP (self ):
219+ """Three-letter sequence should preserve the SEP residue name."""
220+ seq = self .polymers_long [0 ].sequence
221+ self .assertIn ('SEP' , seq ,
222+ 'long sequence should contain "SEP" residue name' )
223+
224+ def testModifiedResidues (self ):
225+ """MODRES record for SEP should be stored in poly.modified."""
226+ modified = self .polymers [0 ].modified
227+ self .assertIsNotNone (modified ,
228+ 'poly.modified should not be None when MODRES records are present' )
229+ resnames = [m [0 ] for m in modified ]
230+ self .assertIn ('SEP' , resnames ,
231+ '"SEP" should appear in poly.modified residue names' )
232+
233+ def tearDown (self ):
234+ self .polymers = None
235+ self .polymers_long = None
236+
237+
195238class TestThreeLetterSequenceKwarg (unittest .TestCase ):
196239
197240 def setUp (self ):
0 commit comments