Back to index

python-biopython  1.60
Public Member Functions
test_MMCIF.ParseReal Class Reference

List of all members.

Public Member Functions

def test_parser
def testModels

Detailed Description

Testing with real CIF file(s).

Definition at line 39 of file test_MMCIF.py.


Member Function Documentation

Extract polypeptides from 1A80.

Definition at line 42 of file test_MMCIF.py.

00042 
00043     def test_parser(self):
00044         """Extract polypeptides from 1A80."""
00045         parser = MMCIFParser()
00046         structure = parser.get_structure("example", "PDB/1A8O.cif")
00047         self.assertEqual(len(structure), 1)
00048         for ppbuild in [PPBuilder(), CaPPBuilder()]:
00049             #==========================================================
00050             # Check that serial_num (model column) is stored properly
00051             self.assertEqual(structure[0].serial_num, 1)
00052             #First try allowing non-standard amino acids,
00053             polypeptides = ppbuild.build_peptides(structure[0], False)
00054             self.assertEqual(len(polypeptides), 1)
00055             pp = polypeptides[0]
00056             # Check the start and end positions
00057             self.assertEqual(pp[0].get_id()[1], 151)
00058             self.assertEqual(pp[-1].get_id()[1], 220)
00059             # Check the sequence
00060             s = pp.get_sequence()
00061             self.assertTrue(isinstance(s, Seq))
00062             self.assertEqual(s.alphabet, generic_protein)
00063             #Here non-standard MSE are shown as M
00064             self.assertEqual("MDIRQGPKEPFRDYVDRFYKTLRAEQASQEVKNWMTETLLVQ"
00065                              "NANPDCKTILKALGPGATLEEMMTACQG", str(s))
00066             #==========================================================
00067             #Now try strict version with only standard amino acids
00068             #Should ignore MSE 151 at start, and then break the chain
00069             #at MSE 185, and MSE 214,215
00070             polypeptides = ppbuild.build_peptides(structure[0], True)
00071             self.assertEqual(len(polypeptides), 3)
00072             #First fragment
00073             pp = polypeptides[0]
00074             self.assertEqual(pp[0].get_id()[1], 152)
00075             self.assertEqual(pp[-1].get_id()[1], 184)
00076             s = pp.get_sequence()
00077             self.assertTrue(isinstance(s, Seq))
00078             self.assertEqual(s.alphabet, generic_protein)
00079             self.assertEqual("DIRQGPKEPFRDYVDRFYKTLRAEQASQEVKNW", str(s))
00080             #Second fragment
00081             pp = polypeptides[1]
00082             self.assertEqual(pp[0].get_id()[1], 186)
00083             self.assertEqual(pp[-1].get_id()[1], 213)
00084             s = pp.get_sequence()
00085             self.assertTrue(isinstance(s, Seq))
00086             self.assertEqual(s.alphabet, generic_protein)
00087             self.assertEqual("TETLLVQNANPDCKTILKALGPGATLEE", str(s))
00088             #Third fragment
00089             pp = polypeptides[2]
00090             self.assertEqual(pp[0].get_id()[1], 216)
00091             self.assertEqual(pp[-1].get_id()[1], 220)
00092             s = pp.get_sequence()
00093             self.assertTrue(isinstance(s, Seq))
00094             self.assertEqual(s.alphabet, generic_protein)
00095             self.assertEqual("TACQG", str(s))

Test file with multiple models

Definition at line 96 of file test_MMCIF.py.

00096 
00097     def testModels(self):
00098         """Test file with multiple models"""
00099         parser = MMCIFParser()
00100         structure = parser.get_structure("example", "PDB/1LCD.cif")
00101         self.assertEqual(len(structure), 3)
00102         for ppbuild in [PPBuilder(), CaPPBuilder()]:
00103                 #==========================================================
00104                 # Check that serial_num (model column) is stored properly
00105                 self.assertEqual(structure[0].serial_num, 1)
00106                 self.assertEqual(structure[1].serial_num, 2)
00107                 self.assertEqual(structure[2].serial_num, 3)
00108                 #First try allowing non-standard amino acids,
00109                 polypeptides = ppbuild.build_peptides(structure[0], False)
00110                 self.assertEqual(len(polypeptides), 1)
00111                 pp = polypeptides[0]
00112                 # Check the start and end positions
00113                 self.assertEqual(pp[0].get_id()[1], 1)
00114                 self.assertEqual(pp[-1].get_id()[1], 51)
00115                 # Check the sequence
00116                 s = pp.get_sequence()
00117                 self.assertTrue(isinstance(s, Seq))
00118                 self.assertEqual(s.alphabet, generic_protein)
00119                 #Here non-standard MSE are shown as M
00120                 self.assertEqual("MKPVTLYDVAEYAGVSYQTVSRVVNQASHVSAKTREKVEAAMAELNYIPNR", 
00121                                  str(s))
00122                 #==========================================================
00123                 #Now try strict version with only standard amino acids
00124                 polypeptides = ppbuild.build_peptides(structure[0], True)
00125                 self.assertEqual(len(polypeptides), 1)
00126                 pp = polypeptides[0]
00127                 # Check the start and end positions
00128                 self.assertEqual(pp[0].get_id()[1], 1)
00129                 self.assertEqual(pp[-1].get_id()[1], 51)
00130                 # Check the sequence
00131                 s = pp.get_sequence()
00132                 self.assertTrue(isinstance(s, Seq))
00133                 self.assertEqual(s.alphabet, generic_protein)
00134                 self.assertEqual("MKPVTLYDVAEYAGVSYQTVSRVVNQASHVSAKTREKVEAAMAELNYIPNR",
00135                                  str(s))


The documentation for this class was generated from the following file: