Skip to content

CIF to PDB: issue in pdb_fromcif for predicted structures #168

@venzera

Description

@venzera

Hi!

When i use pdb_fromcif.py it gets:
Traceback (most recent call last): File "pdb_fromcif.py", line 261, in <module> main() File "pdb_fromcif.py", line 240, in main for lineno, line in enumerate(new_pdb): File "pdb_fromcif.py", line 179, in run charge = fields[labels.get('_atom_site.pdbx_formal_charge')] ~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TypeError: list indices must be integers or slices, not NoneType

There is no charge fields in cif files from Chai-1 or AF3 predictions (maybe in all cif files in general, idk).
It can be solved by simply removing lines 179-184:

charge = fields[labels.get('_atom_site.pdbx_formal_charge')]
try:
    charge = charge
    except ValueError:
    charge = '  '

and changing line 187 into
atom_line = _a.format(record, serial, atname, altloc, resname, chainid, resnum, icode, x, y, z, occ, bfactor, segid, element)

I hope it will be useful, since most of the tools still require pdb format.
Sorry, if it is mentioned before.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions