jensengroup / propka

PROPKA predicts the pKa values of ionizable groups in proteins and protein-ligand complexes based in the 3D structure.
http://propka.org
GNU Lesser General Public License v2.1
256 stars 58 forks source link

Valence electrons Key Error: 'Mo' #163

Closed Aunity closed 8 months ago

Aunity commented 1 year ago

When I predict propka for pdb 7ORS, I got error like this.

 File "/opt/conda/lib/python3.9/site-packages/unisp/protonize.py", line 200, in predict_pka
    molecule = pk_in.read_molecule_file(pdbfile, molecule)
  File "/opt/conda/lib/python3.9/site-packages/propka/input.py", line 113, in read_molecule_file
    mol_container.extract_groups()
  File "/opt/conda/lib/python3.9/site-packages/propka/molecular_container.py", line 75, in extract_groups
    self.conformations[name].extract_groups()
  File "/opt/conda/lib/python3.9/site-packages/propka/conformation_container.py", line 63, in extract_groups
    group = is_group(self.parameters, atom)
  File "/opt/conda/lib/python3.9/site-packages/propka/group.py", line 1237, in is_group
    ligand_group = is_ligand_group_by_groups(parameters, atom)
  File "/opt/conda/lib/python3.9/site-packages/propka/group.py", line 1293, in is_ligand_group_by_groups
    PROTONATOR.protonate_atom(atom)
  File "/opt/conda/lib/python3.9/site-packages/propka/protonate.py", line 111, in protonate_atom
    self.set_number_of_protons_to_add(atom)
  File "/opt/conda/lib/python3.9/site-packages/propka/protonate.py", line 140, in set_number_of_protons_to_add
    atom.number_of_protons_to_add -= self.valence_electrons[atom.element]
KeyError: 'Mo'

During handling of the above exception, another exception occurred:

This error is caused by the valence_electrons dict only contains these elements:

# https://github.com/jensengroup/propka/blob/master/propka/protonate.py#L30
        self.valence_electrons = {
            'H': 1, 'He': 2, 'Li': 1, 'Be': 2, 'B': 3, 'C': 4, 'N': 5,
            'O': 6, 'F': 7, 'Ne': 8, 'Na': 1, 'Mg': 2, 'Al': 3, 'Si': 4,
            'P': 5, 'S': 6, 'Cl': 7, 'Ar': 8, 'K': 1, 'Ca': 2, 'Sc': 2,
            'Ti': 2, 'V': 2, 'Cr': 1, 'Mn': 2, 'Fe': 2, 'Co': 2, 'Ni': 2,
            'Cu': 1, 'Zn': 2, 'Ga': 3, 'Ge': 4, 'As': 5, 'Se': 6, 'Br': 7,
            'Kr': 8, 'I': 7}

So, maybe we could add all elements' valence electrons? https://github.com/Bowserinator/Periodic-Table-JSON/blob/master/PeriodicTableCSV.csv

speleo3 commented 8 months ago

Fixed by https://github.com/jensengroup/propka/pull/169