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.

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

Well \d+\.\d+ would match a single floating point number in non-scientific format.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.