Entering edit mode
4.5 years ago
illimar.rekand
▴
10
Hello, everyone
I have a script that carves out the binding site of pdb-files and thus creates a new .pdb-file. Here is my code:
from Bio.PDB import *
from Bio import PDB
global keep_res_list
parser = PDBParser()
io = PDBIO()
structure = parser.get_structure('xxx', "pdb3e5e.ent")
structure = structure[0] # Only parse thru first model
atom_list = Selection.unfold_entities(structure, 'A') # A for atoms
ns = NeighborSearch(atom_list)
keep_res_list = []
# Iterate over all residues in a model
for residue in structure.get_residues():
if residue.get_resname() == 'SAH': #only keep first ligand
keep_res_list.append(residue)
for atom in residue:
center = atom.get_coord()
neighbors = ns.search(center, 15.0) # 15.0 for distance in angstrom
residue_list = Selection.unfold_entities(neighbors, 'R') # R for residues
for res in residue_list:
if (res not in keep_res_list) and (res.get_resname() != 'HOH') : #exclude also water molecules
keep_res_list.append(res)
io = PDBIO()
io.set_structure(structure)
io.save('out.pdb')
This piece of code gives me the following error:
File "/scratch/software/anaconda3/lib/python3.7/site-packages/Bio/PDB/Residue.py", line 83, in get_unpacked_list
undisordered_atom_list = (undisordered_atom_list + atom.disordered_get_list())
AttributeError: 'Atom' object has no attribute 'disordered_get_list'
This problem reoccurs in some other .pdb-files as well, such as 3b5a, 2xo0, 1mwl, 2npy, 2npz , 3dio + + +,
I have a suspicion that the problem arises with line 1591-1596 in the file 3e5e.ent where the B-factor exceeds four significant digits? Similar lines are found in 1mwl (line 821-824) , 3b5a (lines 1697-1701), 2npy (lines 1694-1700 and 1706-1712).
Does anyone have an idea for a workaround or fix?