943,568 Members | Top Members by Rank

Ad:
  • Perl Discussion Thread
  • Unsolved
  • Views: 3511
  • Perl RSS
Sep 29th, 2008
0

convert XYZ co-ordinates to distance in pdb file

Expand Post »
Hello,

I am new to perl, but I would like write a perl script that can convert xyz cordinates from a pdb file to distances using the formula:
distance = SQRT[(X1-X2)^2 + (Y1-Y2)^2 + (Z1-Z2)^2]

eg: line 1 xyz to line2 xyz
line 1 xyz to line3 xyz
line 1 to ...73
line 2 to 3 and so on.

But I need to know which line to which line.
Any help would be so great and appreciated.

The pdb file format look like this
REMARK
ATOM 1 O1 VVA 1 20.542 18.415 14.035
ATOM 2 C2 VVA 1 21.588 17.620 14.671
ATOM 3 H3 VVA 1 21.893 18.095 15.605
ATOM 4 C4 VVA 1 22.849 17.597 13.752
ATOM 5 H5 VVA 1 22.659 16.957 12.887
ATOM 6 C6 VVA 1 23.208 19.009 13.227
ATOM 7 H7 VVA 1 22.404 19.424 12.617
ATOM 8 H8 VVA 1 23.407 19.695 14.054
ATOM 9 H9 VVA 1 24.101 18.970 12.600
ATOM 10 C10 VVA 1 24.078 17.043 14.513
ATOM 11 1H1 VVA 1 24.986 17.171 13.920
ATOM 12 2H1 VVA 1 24.223 17.571 15.458
ATOM 13 3H1 VVA 1 23.979 15.976 14.725
ATOM 14 C14 VVA 1 21.040 16.197 15.003
ATOM 15 H15 VVA 1 21.881 15.519 15.161
ATOM 16 C16 VVA 1 20.191 15.577 13.866
ATOM 17 H17 VVA 1 19.272 16.141 13.690
ATOM 18 H18 VVA 1 20.755 15.531 12.932
ATOM 19 H19 VVA 1 19.903 14.555 14.128
ATOM 20 C20 VVA 1 20.251 16.232 16.295

Thank you.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
annie_singh is offline Offline
6 posts
since Sep 2008
Sep 30th, 2008
0

What Regular expression to retrieve this pattern?

hi,

I want to know what is the regular expression to be written in order to match

ATOM 2 CA ARG A 1 6.324 32.707 50.379

the above XYZ coordinates in this line. I have a pdb file and i want to calculate the distance between 4 coordinates. how do i write this in perl script?

I am completely stuck.

Thank you all in advance
Reputation Points: 10
Solved Threads: 0
Newbie Poster
annie_singh is offline Offline
6 posts
since Sep 2008
Sep 30th, 2008
0

Re: What Regular expression to retrieve this pattern?

Well \d+\.\d+ would match a single floating point number in non-scientific format.
Team Colleague
Reputation Points: 5862
Solved Threads: 950
Posting Sage
Salem is offline Offline
7,164 posts
since Dec 2005

This thread is more than three months old

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.
Message:
Previous Thread in Perl Forum Timeline: Perl SFTP Executing commands
Next Thread in Perl Forum Timeline: How to retrieve three columns using perl





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC