MMTSB
Tool Set Documentation

Difference between revisions of "analyze.pl"

From MMTSB
Jump to: navigation, search
Line 10: Line 10:
 
values to be returned.
 
values to be returned.
  
An example for a function that calculates the end-to-end distance for the
+
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  
 
N- and C-terminal C-alpha atoms of the first chain from a given structure  
 
is given in the following:
 
is given in the following:

Revision as of 01:38, 28 July 2009

Usage

usage: analyze.pl -function file [pdbFile]

Show source


Description

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;
 }

 1;

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

Options

-help 
usage information


Examples