Due Wednesday, March 30
From Problem #11.10, in Tisdall:
Create a Perl program, atoms_near.pl
, that parses the contents
of a PDB file, takes as arguments a distance, D, and the identifier of
an atom, X, within the file. The program then prints information about
those atoms that are within D of X.
There shall be two ways to invoke the program. In the first, the user provides all the arguments in the command line:
atoms_near.pl PDBfileName originAtomID distance
Where PDBfileName is the name of a PDB file (for example "pdb1c1f.ent"), originAtomID is the ID number of an atom in the file (the first field in an "ATOM" record), and distance is a floating point value. If the command line arguments are inappropriate values (file by that name, negative distance, or a non-existent atom ID), the program should print an appropriate and meaningful error message and return. If the values are valid, the program should generate its output.
The second way to invoke the program is:
atoms_near.pl PDBfileName
In that case, the program should prompt the user for the originAtomID and distance values from the console. If the user enters inappropriate values (negative distance, or a non-existent atom ID), the program should print a warning message and ask for new values. If the values are valid, the program should generate its output.
Finding the File
The PDBfileName will not be a full pathname. Your program must traverse the current working directory to find a file whose name equals PDBfileName. You can use the directory traversal methods we looked at in class. Those methods will give you a pathname to the file, and you can then use that to open it for reading.
Output
The output should be streamed to the console (STDOUT) in this format:
ORIGIN: #42, (N) x = -1.234, y = 12.628, z = 1.234. Atoms within 2.0 are: #5 , (N) x = -1.002, y = 3.655, z = 12.200. Distance 0.52 #146, (C) x = 11.234, y = -2.628, z = 12.234. Distance 0.12 etc.
(No the distance values above are not accurate, I'm just providing an example of the syntax). Note that the output is formatted so that the columns align. The parenthesized expression is the element (i.e., "N" is nitrogen), "#5" represents atom ID 5. The Distance figure is the distance from that atom to the ORIGIN atom specified by the user.
Submit your program source code and any supporting data files electronically.