![]() |
|
Difference between revisions of "analyze.pl"
From MMTSB
Line 23: | Line 23: | ||
for (my $ia=$res->[0]->{start}; $ia<=$res->[0]->{end}; $ia++) { | for (my $ia=$res->[0]->{start}; $ia<=$res->[0]->{end}; $ia++) { | ||
$ca1=$atom->[$ia] if ($atom->[$ia]->{atomname} eq "CA"); | $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; | + | 1; |
== Options == | == Options == |
Revision as of 01:37, 28 July 2009
Usage
usage: analyze.pl -function file [pdbFile]
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 for the 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;
Options
- -help
- usage information