Tool Set Documentation

Difference between revisions of ""

Jump to: navigation, search
(No difference)

Latest revision as of 22:37, 13 September 2010


usage: -function file [pdbFile]
Show source


This tool runs the perl function given in the script file for the structure given as argument. The perl function has to be named analyze. It is passed a Molecule object as argument and expects one or more values to be returned.

An example for a function that calculates the end-to-end distance between N- and C-terminal C-alpha atoms of the first chain from a given structure is given in the following:

 sub analyze {
   my $mol=shift;
   my @data=();  
   my $res=$mol->{chain}->[0]->{res};
   my $atom=$mol->{chain}->[0]->{atom};

   my $ca1;
   for (my $ia=$res->[0]->{start}; $ia<=$res->[0]->{end}; $ia++) {
     $ca1=$atom->[$ia] if ($atom->[$ia]->{atomname} eq "CA");

   my $ca2;
   for (my $ia=$res->[$#{$res}]->{start}; $ia<=$res->[$#{$res}]->{end}; $ia++) {
     $ca2=$atom->[$ia] if ($atom->[$ia]->{atomname} eq "CA");

   my $dx=$ca1->{xcoor}-$ca2->{xcoor};
   my $dy=$ca1->{ycoor}-$ca2->{ycoor};
   my $dz=$ca1->{zcoor}-$ca2->{zcoor};

   push(@data, sqrt($dx*$dx+$dy*$dy+$dz*$dz));

   return @data;


An example of how to use such a function is given below.


usage information
-function file 
perl script file with function named analyze

Examples -function end2end.distance 1vii.exp.pdb
runs the script end2end.distance which in this case calculates the end-to-end distance between the N- and C-terminal C-alpha atoms.