[Python] Error occurred while selecting a specific atom in a PDB file using Biopython...

Discussão em 'Python' iniciado por Stack, Março 24, 2025.

  1. Stack

    Stack Membro Participativo

    The following is a partial content of my PDB file. I want to set the C2 atom as the coordinate origin, but the code shows an error.

    HETATM 1 C1 UNL A 1 -2.791 -1.310 0.787 1.00 0.00 C
    HETATM 2 C2 UNL A 1 -3.711 -0.441 0.007 1.00 0.00 C
    HETATM 3 C3 UNL A 1 -3.059 0.725 -0.664 1.00 0.00 C
    HETATM 4 C4 UNL A 1 -2.098 1.359 0.308 1.00 0.00 C
    HETATM 5 C5 UNL A 1 -1.114 0.285 0.724 1.00 0.00 C
    HETATM 6 O1 UNL A 1 -1.813 -0.636 1.488 1.00 0.00 O
    HETATM 7 O2 UNL A 1 -0.433 -0.261 -0.324 1.00 0.00 O
    HETATM 8 C6 UNL A 1 0.922 -0.022 -0.191 1.00 0.00 C
    HETATM 9 C7 UNL A 1 1.725 -1.297 -0.057 1.00 0.00 C
    HETATM 10 C8 UNL A 1 3.160 -0.900 0.201 1.00 0.00 C


    the code is,

    import numpy as np
    import residue as residue
    from Bio.PDB.PDBParser import PDBParser

    parser = PDBParser()
    structure = parser.get_structure('CEL', 'cel.pdb')
    origin = structure[0]['A'][1]


    KeyError: (' ', 1, ' ')

    Continue reading...

Compartilhe esta Página