Dear forum members,
I am trying to write a script to calculate distances between atoms in two separate collections (collection_AA_atoms & collection_DNA_atoms) using biopython but am not getting any values. The program runs but doesn't print any values. Where might be the problem? The code:
Sincerely,
Aurimas
I am trying to write a script to calculate distances between atoms in two separate collections (collection_AA_atoms & collection_DNA_atoms) using biopython but am not getting any values. The program runs but doesn't print any values. Where might be the problem? The code:
from Bio.PDB import PDBParser # create parser parser = PDBParser() # read structure from file structure = parser.get_structure('HS_1az0_B', 'HS_1az0_B.pdb') model = structure[0] chain = model['B'] collection_AA_atoms = ['N' 'O' 'CB' 'CG' 'ND2' 'CD1' 'SD'] collection_DNA_atoms = ['CA' 'C8' 'N7' 'N4'] for residue1 in chain: for residue2 in chain: for i in collection_AA_atoms: for x in collection_DNA_atoms: if residue1 != residue2: # compute distance between CA atoms try: distance = residue1[i] - residue2[x] except KeyError: ## no CA atom, e.g. for H_NAG continue if distance < 3.9: print(residue1, residue2, distance) # stop afterI will look forward to all replies. If you need more details - please let me know and I'll provide.
Sincerely,
Aurimas