RSS Forums RSS

convert XYZ co-ordinates to distance in pdb file

Please support our Perl advertiser: Programming Forums
Reply
Posts: 6
Reputation: annie_singh is an unknown quantity at this point 
Solved Threads: 0
annie_singh annie_singh is offline Offline
Newbie Poster

convert XYZ co-ordinates to distance in pdb file

  #1  
Sep 29th, 2008
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.
AddThis Social Bookmark Button
Reply With Quote  
Posts: 6
Reputation: annie_singh is an unknown quantity at this point 
Solved Threads: 0
annie_singh annie_singh is offline Offline
Newbie Poster

What Regular expression to retrieve this pattern?

  #2  
Sep 30th, 2008
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
Reply With Quote  
Posts: 5,120
Reputation: Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute 
Solved Threads: 631
Colleague
Salem's Avatar
Salem Salem is offline Offline
Void main'ers are DOOMed

Re: What Regular expression to retrieve this pattern?

  #3  
Sep 30th, 2008
Well \d+\.\d+ would match a single floating point number in non-scientific format.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
UK Voter? Please send a message to Incapability Brown and the rest of Zanu-Labour
Up to 8Mb PlusNet broadband from only £5.99 a month!
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.



Other Threads in the Perl Forum
Views: 1417 | Replies: 2 | Currently Viewing: 1 (0 members and 1 guests)

 

Thread Tools Display Modes
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 1:49 pm.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC