diff --git a/prody/proteins/pdbfile.py b/prody/proteins/pdbfile.py index 92fb333cf..8bf966de8 100644 --- a/prody/proteins/pdbfile.py +++ b/prody/proteins/pdbfile.py @@ -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 ' diff --git a/prody/tests/proteins/test_pdbfile.py b/prody/tests/proteins/test_pdbfile.py index d47902f49..3f34f453a 100644 --- a/prody/tests/proteins/test_pdbfile.py +++ b/prody/tests/proteins/test_pdbfile.py @@ -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']) @@ -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) @@ -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): @@ -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):