mms-fcul / PypKa

A python module for flexible Poisson-Boltzmann based pKa calculations with proton tautomerism
https://pypka.readthedocs.io/en/latest/
GNU Lesser General Public License v3.0
56 stars 10 forks source link

Problem with N-terminal in the Amber format #3

Closed shaoqx closed 4 years ago

shaoqx commented 4 years ago

I generate the pdb file with tLeAP and I can be recognized by all Amber modules. But when I tried it with the PypKa installed from pip, it aborted like this:

 Traceback (most recent call last):
  File "Test_pka.py", line 9, in <module>
    pKa = Titration(parameters)
  File "/usr/local/lib/python3.6/dist-packages/pypka/pypka.py", line 99, in __init__
    self.processDelPhiParams()
  File "/usr/local/lib/python3.6/dist-packages/pypka/pypka.py", line 267, in processDelPhiParams
    log.checkDelPhiErrors(logfile, 'readFiles')
  File "/usr/local/lib/python3.6/dist-packages/pypka/log.py", line 82, in checkDelPhiErrors
    raise Exception('The following errors have been found on {0}: \n{1}'.format(filename, errors))
Exception: The following errors have been found on LOG_readFiles:
!!! WARNING: no radius record for  H2   GLY     1
!!! WARNING: no radius record for  H1   GLY     1
!!! WARNING: no radius record for  H3   GLY     1

The residue 1 in my file is like:

ATOM      1  N   GLY     1      12.837  -6.638  21.081  1.00  0.00
ATOM      2  H1  GLY     1      12.581  -6.309  20.161  1.00  0.00
ATOM      3  H2  GLY     1      13.221  -5.866  21.606  1.00  0.00
ATOM      4  H3  GLY     1      12.069  -7.174  21.459  1.00  0.00
ATOM      5  CA  GLY     1      13.958  -7.609  20.931  1.00  0.00
ATOM      6  HA2 GLY     1      14.819  -7.251  21.476  1.00  0.00
ATOM      7  HA3 GLY     1      13.657  -8.569  21.321  1.00  0.00
ATOM      8  C   GLY     1      14.311  -7.754  19.454  1.00  0.00
ATOM      9  O   GLY     1      15.169  -7.038  18.939  1.00  0.00

And I'm just using the example script from the document, replacing the filename with what I have.

I successfully ran the pKa = Titration(parameters) after deleting the GLY, but still, some error was raised for the print(site, pKa[site], pKa.getProtState(site, 7)) line:

API exited successfully
Traceback (most recent call last):
  File "Test_pka.py", line 12, in <module>
    print(site, pKa[site], pKa.getProtState(site, 7))
  File "/usr/local/lib/python3.6/dist-packages/pypka/pypka.py", line 835, in __getitem__
    return self.molecules[chain]
KeyError: <titsite.Titsite object at 0x7f55f299fcc0>
shaoqx commented 4 years ago

Here is the .py I ran

from pypka.pypka import Titration

parameters = {'structure'     : './2kz2init_amb.pdb',
              'epsin'         : 10,
              'ionicstr'      : 0.1,
              'pbc_dimensions': 0,
              'ncpus'         : 4}

pKa = Titration(parameters)

for site in pKa:
    print(site, pKa[site], pKa.getProtState(site, 7))

print(pKa.getParameters())
shaoqx commented 4 years ago

Solution:

  1. For the format problem: set the ffinput to AMBER (In the parameter)
  2. For the print error:
    print( site.resiname, site.pK, site.getProtState(7)[0] ) 

    This works.