[Bioperl-l] distances from one atom to another in biological structures

Alex Gutteridge alexg at ebi.ac.uk
Wed Apr 14 05:31:22 EDT 2004


This can be done with the BioPerl structure modules. You don't say what 
your 'protein sites' actually are (residues, patches, co-ordinates, 
etc..?), but assuming you know the serial number of your active site 
atom and the xyz co-ordinates of your 'site' the following (untested) 
script would work. Just give it the PDB file as fist argument, active 
site atom serial as the second, and the x,y,z co-ords as the remaining 
arguments. Let me know if you need anymore help.

use strict;
use Bio::Structure::IO;

my $file = shift;
my $active_site_serial = shift;
my ($other_site_x, $other_site_y, $other_site_z) = @_;

my $structure = Bio::Structure::IO->new(-file => shift,
                                         -format => 

my ($x,$y,$z) = 

print distance($other_site_x,$other_site_y,$other_site_z,

sub distance {

   my ($x1,$y1,$z1,$x2,$y2,$z2) = @_;

   my $distance = sqrt((($x1 - $x2) * ($x1 - $x2)) +
                       (($y1 - $y2) * ($y1 - $y2)) +
                       (($z1 - $z2) * ($z1 - $z2)));

   return $distance;


Alex Gutteridge
European Bioinformatics Institute
Cambridge CB10 1SD

Tel: 01223 492550
Email: alexg at ebi.ac.uk

More information about the Bioperl-l mailing list