Esempio n. 1
0
    def testPDB_sel_type_hetero(self):
        # preparation
        pdb = atomset.PDB()

        # function to test
        pdb.initialise("tests/data/pdb_test_ligand.pdb", type="HETERO")

        # assertion
        pdbContent = "MODEL        1\n\
ATOM   1717  H   ASN A 119      25.915   9.925  -7.236  1.00 31.61           H  \n\
ATOM   1718  CA  ASN A 119      27.159  10.509  -6.736  1.00 33.83           C  \n\
TER\n\
HETATM 1733  O1  AIN L   1      13.907  16.130   0.624  0.50 28.52           O  \n\
TER\n\
HETATM 1753 CA    CA B   1      16.636  15.477   0.293  1.00  3.39          Ca2+\n\
TER\n\
ENDMDL\n\
END   \n"

        atom1 = atomset.Atom(
            "HETATM 1733  O1  AIN L   1      13.907  16.130   0.624  0.50 28.52           O  "
        )
        atom2 = atomset.Atom(
            "HETATM 1753 CA    CA B   1      16.636  15.477   0.293  1.00  3.39          Ca2+"
        )
        goldenAtomsDict = {atom1.id: atom1, atom2.id: atom2}

        self.assertEqual(pdb.pdb, pdbContent)
        self.assertEqual(pdb.atoms, goldenAtomsDict)
Esempio n. 2
0
    def testPDB_from_str(self):
        # preparation
        with open("tests/data/pdb_test.pdb", "rt") as pdbfile:
            pdbstring = pdbfile.read()
        pdb = atomset.PDB()

        # function to test
        pdb.initialise(pdbstring)

        # assertion
        pdbContent = "ATOM      1  N   ASN A   1       7.920  22.268   9.257  1.00 15.18           N1+\n\
ATOM      2  CA  CYS A   1       8.394  20.916   9.575  1.00 16.24           C  \n\
ATOM      3  CA  ASN A   1       7.870  19.937   8.524  1.00 16.63           C  \n\
ATOM      4  O   ASN A   1       7.030  20.308   7.700  1.00 16.13           O  \n\
ATOM      5  CB  CYS A   1       8.108  20.445  11.030  1.00 16.53           C  \n"

        atom1 = atomset.Atom(
            "ATOM      1  N   ASN A   1       7.920  22.268   9.257 1.00 15.18           N1+"
        )
        atom2 = atomset.Atom(
            "ATOM      2  CA  CYS A   1       8.394  20.916   9.575 1.00 16.24           C  "
        )
        atom3 = atomset.Atom(
            "ATOM      3  CA  ASN A   1       7.870  19.937   8.524 1.00 16.63           C  "
        )
        atom4 = atomset.Atom(
            "ATOM      4  O   ASN A   1       7.030  20.308   7.700 1.00 16.13           O  "
        )
        atom5 = atomset.Atom(
            "ATOM      5  CB  CYS A   1       8.108  20.445  11.030 1.00 16.53           C  "
        )
        goldenAtomsDict = {
            atom1.id: atom1,
            atom2.id: atom2,
            atom3.id: atom3,
            atom4.id: atom4,
            atom5.id: atom5
        }

        self.assertEqual(pdb.pdb, pdbContent)
        self.assertEqual(pdb.atoms, goldenAtomsDict)
Esempio n. 3
0
    def testPDB_sel_chain(self):
        # preparation
        pdb = atomset.PDB()

        # function to test
        pdb.initialise("tests/data/pdb_test2.pdb", chain="B")

        # assertion
        pdbContent = "ATOM      1  N   ASN A   1       7.920  22.268   9.257  1.00 15.18           N1+\n\
ATOM      2  CA  CYS B   1       8.394  20.916   9.575  1.00 16.24           C  \n\
ATOM      3  CA  ASN B   1       7.870  19.937   8.524  1.00 16.63           C  \n\
ATOM      4  O   ASN A   2       7.030  20.308   7.700  1.00 16.13           O  \n\
ATOM      5  CB  CYS A   2       8.108  20.445  11.030  1.00 16.53           C  \n"

        atom2 = atomset.Atom(
            "ATOM      2  CA  CYS B   1       8.394  20.916   9.575 1.00 16.24           C  "
        )
        atom3 = atomset.Atom(
            "ATOM      3  CA  ASN B   1       7.870  19.937   8.524 1.00 16.63           C  "
        )
        goldenAtomsDict = {atom2.id: atom2, atom3.id: atom3}

        self.assertEqual(pdb.pdb, pdbContent)
        self.assertEqual(pdb.atoms, goldenAtomsDict)