def test_load_topology_sybyl(self): """ Load topology including Tripos SYBYL atom types from mol2 """ top = System(self.pdb_file, mol2file=self.mol_file).topology self.assertTrue('attype' in top.columns)
def test_load_topology_instance(self): """ Check if returned object is instance of DataFrame, TopologyDataFrame """ top = System(self.pdb_file).topology self.assertIsInstance(top, DataFrame) self.assertIsInstance(top, TopologyDataFrame)
def setUpClass(cls): """ Prepare TopologyDataFrame once for every test """ cls.top = System(cls.pdb_file, mol2file=cls.mol_file).topology # Build distance matrix cls.top.distances()
def test_load_topology_pdb(self): """ Load PDB file """ top = System(self.pdb_file).topology self.assertEqual(len(top), 5202) self.assertEqual(list(top.columns), ['serial', 'name', 'element', 'resSeq', 'resName', 'chainID', 'segmentID'])
def load_topology(self, pdb_id): pdb_file = os.path.abspath( os.path.join(currpath, '../files/{0}.pdb'.format(pdb_id))) mol_file = os.path.abspath( os.path.join(currpath, '../files/{0}.mol2'.format(pdb_id))) top = System(pdb_file, mol2file=mol_file).topology top.distances() return top
def test_topdataframe_neighbours_exceptions(self): """ Neighbours method exceptions """ # Method requires pairwise distance matrix top = System(self.pdb_file, mol2file=self.mol_file).topology sel = top[top['resName'] == 'THA'] self.assertRaises(AttributeError, sel.neighbours) # Target selection should be contained in parent sel.distances() target = top[top['resSeq'].isin( [72, 80, 81, 84, 85, 117, 118, 119, 121, 122])] parent = top[top['resSeq'].isin([84, 85, 117, 118, 119, 121, 122])] sel._parent = parent self.assertRaises(TypeError, sel.neighbours, target)
def setUpClass(cls): """ Prepare TopologyDataFrame once for every test """ pdb_file = '{0}/{1}.pdb'.format(filepath, cls.ref['pdb_id']) mol_file = '{0}/{1}.mol2'.format(filepath, cls.ref['pdb_id']) # Load structures (PDB + MOL2) and calculate distance matrix trajectory = System(pdb_file, mol2file=mol_file) cls.top = trajectory.topology cls.top.distances() # Select ligand and neighbours, build contact frame if 'chain' in cls.ref: ligand_selection = cls.top[ (cls.top['resSeq'] == cls.ref['ligand']) & (cls.top['chainID'] == cls.ref['chain'])] else: ligand_selection = cls.top[cls.top['resSeq'] == cls.ref['ligand']] cls.neighbour_selection = ligand_selection.neighbours() cls.cf = ligand_selection.contacts(cls.neighbour_selection)
def setUp(self): """ Prepare TopologyDataFrame once for every test """ self.top = System(self.pdb_file, mol2file=self.mol_file).topology
def setUpClass(cls): """ Prepare TopologyDataFrame once for every test """ cls.top = System(cls.pdb_file, mol2file=cls.mol_file).topology