Exemplo n.º 1
0
 def test_chain_too_long(self):
     with self.assertRaises(Exception) as context:
         numpdb.numsele(":AX")
     self.assertEqual(context.exception.message,
                      "chain identifier must be one character")
     with self.assertRaises(Exception) as context:
         numpdb.numsele(":AX.CA")
     self.assertEqual(context.exception.message,
                      "chain identifier must be one character")
Exemplo n.º 2
0
 def test_chain(self):
     self.assertDictEqual(numpdb.numsele(":A"), {
         "chain": "A",
         "resno": None,
         "atomname": None
     })
     self.assertDictEqual(numpdb.numsele(": "), {
         "chain": " ",
         "resno": None,
         "atomname": None
     })
Exemplo n.º 3
0
 def test_combination(self):
     self.assertDictEqual(numpdb.numsele("1:B.CA"), {
         "chain": "B",
         "resno": 1,
         "atomname": "CA"
     })
     self.assertDictEqual(numpdb.numsele("1: .CA"), {
         "chain": " ",
         "resno": 1,
         "atomname": "CA"
     })
Exemplo n.º 4
0
    def test_superpose(self):
        npdb1 = numpdb.NumPdb(data("1U19.pdb"))
        npdb2 = numpdb.NumPdb(data("3DQB.pdb"))

        sele = numpdb.numsele("1-326:A")
        sp, msg = numpdb.superpose(npdb1, npdb2, sele, sele, align=False)
        np.testing.assert_almost_equal(sp.rmsd, 2.8033625498819172)
Exemplo n.º 5
0
 def test_resno_range(self):
     self.assertDictEqual(numpdb.numsele("110-311"), {
         "chain": None,
         "resno": [110, 311],
         "atomname": None
     })
     self.assertDictEqual(numpdb.numsele("110-312:C"), {
         "chain": "C",
         "resno": [110, 312],
         "atomname": None
     })
     self.assertDictEqual(numpdb.numsele("110-313.N"), {
         "chain": None,
         "resno": [110, 313],
         "atomname": "N"
     })
Exemplo n.º 6
0
 def __prep_arg(self, value, params):
     if not value:
         return value
     if params.get("type") in ["file", "dir"]:
         if "nargs" in params:
             return map(self.abspath, value)
         return self.abspath(value)
     elif params.get("type") == "sele":
         return numpdb.numsele(value)
     return value
Exemplo n.º 7
0
 def test_atomname_too_long(self):
     with self.assertRaises(Exception) as context:
         numpdb.numsele(":A.foobar")
     self.assertEqual(context.exception.message,
                      "atomname must be one to four characters")
Exemplo n.º 8
0
 def test_atomname(self):
     self.assertDictEqual(numpdb.numsele(".CA"), {
         "chain": None,
         "resno": None,
         "atomname": "CA"
     })
Exemplo n.º 9
0
 def test_resno(self):
     self.assertDictEqual(numpdb.numsele("312"), {
         "chain": None,
         "resno": 312,
         "atomname": None
     })