コード例 #1
0
    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)
コード例 #2
0
    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)
コード例 #3
0
    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()
コード例 #4
0
    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'])
コード例 #5
0
    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
コード例 #6
0
    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)
コード例 #7
0
    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)
コード例 #8
0
    def setUp(self):
        """
        Prepare TopologyDataFrame once for every test
        """

        self.top = System(self.pdb_file, mol2file=self.mol_file).topology
コード例 #9
0
    def setUpClass(cls):
        """
        Prepare TopologyDataFrame once for every test
        """

        cls.top = System(cls.pdb_file, mol2file=cls.mol_file).topology