These are the X, Y and Z coordinates from a pdb file. I want to calculate the distance using these three coordinate values. First i want to know how to assign variable names to these values in the array. I have to use this formula to calculate the distance:
Till now I have written the script shown below to obtain the three columns which is shown above. I am stuck. I need help to calculate distance using 'for loop' or i guess its two for loops within which would look something like this:
for($AAi = 1; $AAi<= 7; $AAi++){ #here $AAi shud take the first three values(x1, y1, z1)
for ($AAj = 2; $AAj<= 7; $AAj++){ #similarly $AAj shud take 2nd 3 values(x2, y2, z2)
my $dist = sqrt(($x1-$x2)**2+($y1-$y2)**2+($z1-$z2)**2);
and do an iterative distance calculation. am stuck....
my exiting code:
open(IN, "/Users/anu/out.pl") or die "$!";
while (my $line = <IN>) {
chomp($line);
my @array = (split (/\s+/, $line))[6, 7, 8];
print "@array\n";
}
close(IN);
distance calculation for XYZ coordiantes
I cant reach the link perlguru???
Can any one help me?? Even i have similar type of problem as annie_singe..
thank sin advance.. <<email id snipped>>
Last edited by ~s.o.s~; Oct 22nd, 2008 at 1:46 pm. Reason: Keep it on site.
No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.