Skip to content

Commit

Permalink
Merge pull request #1734 from jamesmkrieger/prody-master
Browse files Browse the repository at this point in the history
fix secstr writing
  • Loading branch information
jamesmkrieger authored Aug 11, 2023
2 parents 7cb59a9 + d51db04 commit f38e591
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 14 deletions.
10 changes: 5 additions & 5 deletions prody/proteins/pdbfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -1057,13 +1057,13 @@ def _evalAltlocs(atomgroup, altloc, chainids, resnums, resnames, atomnames):
# ' %5d\n')

HELIXLINE = ('HELIX {serNum:3d} {helixID:>3s} '
'{initResName:<3s}{initChainID:2s} {initSeqNum:4d}{initICode:1s} '
'{endResName:<3s}{endChainID:2s} {endSeqNum:4d}{endICode:1s}'
'{helixClass:2d} {length:5d}\n')
'{initResName:<3s}{initChainID:>2s} {initSeqNum:4d}{initICode:1s} '
'{endResName:<3s}{endChainID:>2s} {endSeqNum:4d}{endICode:1s}'
'{helixClass:2d} {length:5d} \n')

SHEETLINE = ('SHEET {strand:3d} {sheetID:>3s}{numStrands:2d} '
'{initResName:3s}{initChainID:2s}{initSeqNum:4d}{initICode:1s} '
'{endResName:3s}{endChainID:2s}{endSeqNum:4d}{endICode:1s}{sense:2d} \n')
'{initResName:3s}{initChainID:>2s}{initSeqNum:4d}{initICode:1s} '
'{endResName:3s}{endChainID:>2s}{endSeqNum:4d}{endICode:1s}{sense:2d} \n')

PDBLINE_LT100K = ('%-6s%5d %-4s%1s%-3s%2s%4d%1s '
'%8.3f%8.3f%8.3f%6.2f%6.2f '
Expand Down
29 changes: 20 additions & 9 deletions prody/tests/proteins/test_pdbfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,8 @@ def setUp(self):
self.ag = parsePDB(self.pdb['path'])
self.tmp = os.path.join(TEMPDIR, 'test.pdb')

self.ubi = parsePDB(DATA_FILES['1ubi']['path'], secondary=True)

self.hex = parsePDB(DATA_FILES['hex']['path'])
self.h36 = parsePDB(DATA_FILES['h36']['path'])

Expand Down Expand Up @@ -279,11 +281,20 @@ def testWritingHybrid36(self):

serial_99999_line = lines[99999]
self.assertEqual(serial_99999_line[6:11], '99999',
'writePDB failed to write correct pre-h36 serial')
'writePDB failed to write correct pre-h36 serial')

serial_A0000_line = lines[100000]
self.assertEqual(serial_A0000_line[6:11], 'A0000',
'writePDB failed to write correct h36 serial')
'writePDB failed to write correct h36 serial')

@dec.slow
@unittest.skipUnless(os.access(TEMPDIR, os.W_OK), msg)
def testWritingSecstrs(self):
"""Test if output from writing secstrs is as expected."""

out = writePDB(self.tmp, self.ubi)
ubi_new = parsePDB(out, secondary=True)
self.assertListEqual(list(self.ubi.getSecstrs()), list(ubi_new.getSecstrs()))

@dec.slow
@unittest.skipUnless(os.access(TEMPDIR, os.W_OK), msg)
Expand All @@ -299,13 +310,6 @@ def testModelArgument(self):
assert_equal(out.getCoords(), self.ag.getCoordsets(i),
'failed to write model {0} coordinates correctly'.format(i+1))

@dec.slow
def tearDown(self):
"""Remove test file."""

if os.path.isfile(self.tmp):
os.remove(self.tmp)

@dec.slow
@unittest.skipUnless(os.access(TEMPDIR, os.W_OK), msg)
def testWritingHexTer(self):
Expand Down Expand Up @@ -366,6 +370,13 @@ def testWritingHybrid36Ter(self):
self.assertEqual(serial_A0000_line[6:11], 'A0000',
'writePDB failed to write correct h36 serial')

@dec.slow
def tearDown(self):
"""Remove test file."""

if os.path.isfile(self.tmp):
os.remove(self.tmp)


class TestParsePDBHeaderAndAllModels(unittest.TestCase):

Expand Down

0 comments on commit f38e591

Please sign in to comment.