homepage Welcome to WebmasterWorld Guest from 23.22.194.120
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / Perl Server Side CGI Scripting
Forum Library, Charter, Moderators: coopster & jatar k & phranque

Perl Server Side CGI Scripting Forum

    
confused with distances
ktsirig




msg:443142
 6:09 pm on Mar 23, 2006 (gmt 0)

Hello all,
I have a school assignment in Biology but I seem to be unable to begin...
What I was given is something like the following :

HELIX1: x y z
A 1 -1.115 8.537 7.075
B 2 -2.745 5.280 7.165
C 3 -0.777 3.267 7.329
D 4 1.610 5.225 10.885
E 5 0.296 5.263 10.912

HELIX2:
K 1 -0.696 13.041 22.357
L 2 1.152 11.081 23.082
M 3 2.200 17.590 18.424

What I must do is :
take each atom from each helix (for example atoms A, B, C, D, E from helix1 , atoms K,L,M from helix2)
and calculate the distance from all other atoms of the remaining helices.
An example :
1) Take atom A from helix1
2) Calculate distance with atom K from helix2
3) Calculate distance with atom L from helix2
4) Calculate distance with atom M from helix2

In order to calculate the distance ,for example, between A(helix1) and K(helix2), I use the formula:
distance = (Xa-Xk)^2 + (Ya-Yk)^2 + (Za-Zk)^2

So, what I need to store is :
x,y,z for each atom
then, using the formula above ,I will calculate the distance...
I don't know if I need a hash of arrays, an array of hashes or something more or less complicated...
Any help?

 

perl_diver




msg:443143
 9:31 pm on Mar 23, 2006 (gmt 0)

Since you are asking a general question and not asking for someone to do your homework for you, I would suggest an array of hashes, but it can probably be done any number of ways.

Martin40




msg:443144
 9:42 pm on Mar 23, 2006 (gmt 0)

It seems to me that writing the Perl is more strenuous than simply doing the maths. Unless you were instructed to solve it using a computer program.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Perl Server Side CGI Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved