### Thread: Codon translation help

Page 2 of 2 First 12
1. No Profile Picture
Registered User
Devshed Newbie (0 - 499 posts)

Join Date
Mar 2013
Posts
13
Rep Power
0

#### help for calculating distance

\$VAR1 = '-16.243';
\$VAR2 = '-19.569';
\$VAR3 = '-22.090';
thanks so now I got the value i.e \$VAR1,\$VAR2,\$VAR3..so now using this I have to calculate the distance between them....i.e var1,var2,var3...and to be more specific I need the code in such a way that I can get the distance of all the coordinates
2. No Profile Picture
Registered User
Devshed Newbie (0 - 499 posts)

Join Date
Mar 2013
Posts
13
Rep Power
0

#### help for calculating distance

So as previously posted I get an Input file and which is then I output in form of text file so from that text file I need to fetch al those parameters and do the distance calculation.
open INP, "pro.pdb";
open OUT, ">pdbfile.txt";
while (<INP>)
{
if (/^ATOM/)
{
print OUT \$_;
}
}
so this code gives a output in form of pdbfile.txt and from there I need to get parameters and do the calculation
3. No Profile Picture
Contributing User
Devshed Novice (500 - 999 posts)

Join Date
Jun 2012
Location
Paris area, France
Posts
846
Rep Power
496
I am not working in the same field as you, and I already told you that I do not know how to calculate the distance, I don't even know what you call distance, and you are looking for a distance to what, or between what and what?
4. No Profile Picture
Registered User
Devshed Newbie (0 - 499 posts)

Join Date
Mar 2013
Posts
13
Rep Power
0

#### help

Okay I figured out how to calcualte the distance .but as u gave code earlier so can that be used to extract data in a large extent..I mean you gave only for
my \$str = 'ATOM 1 N MET A 1 -16.243 -19.569 -22.090 1.00 0.00 N';..
so like this I have hundreds of lines like this and I want them to be extracted so is there any way..if yes please do help me
5. No Profile Picture
Contributing User
Devshed Regular (2000 - 2499 posts)

Join Date
Apr 2009
Posts
2,019
Rep Power
1228
You can use a while loop to loop over and parse the lines of your data file.
6. No Profile Picture
Contributing User
Devshed Novice (500 - 999 posts)

Join Date
Jun 2012
Location
Paris area, France
Posts
846
Rep Power
496
I am getting frustrated and this is getting quite silly.

Here, we have two threads these days from people asking us to calculate a "distance", and no one wanting to tell us what this fu*ing distance is or how to calculate it. It's amazing. Gosh, it must be a secret available only to some inner elites.

Sorry, but if I don't qualify to obtain the distance formula (and related explanations), then I can't see how I'll will be able to help you and I don't qualify for helping you either.

Or, may be, you don't know yourself what this distance is... Let me be clear; I am not a biologist nor a chemist. I am willing to try to help you, but, please, tell me what you are looking for.
7. No Profile Picture
Registered User
Devshed Newbie (0 - 499 posts)

Join Date
Mar 2013
Posts
13
Rep Power
0

#### help

Originally Posted by FishMonger
You can use a while loop to loop over and parse the lines of your data file.
Can you give me the code how to use that while loop again and again to parse the lines of that data file.
8. No Profile Picture
Contributing User
Devshed Novice (500 - 999 posts)

Join Date
Jun 2012
Location
Paris area, France
Posts
846
Rep Power
496
Originally Posted by krushnach80
Can you give me the code how to use that while loop again and again to parse the lines of that data file.
OK, you can do something like this:

Code:
```my \$file = "file_in.txt";
open my \$INFILE, "<", \$file of die "Cannot open \$file \$! \n";
while (my \$line = <\$INFILE>) { # loops on each line of the file
my @fields = split /\s+/, \$line; # split the line into an array
# do something with the fields
}```
Page 2 of 2 First 12