kanika has asked for the wisdom of the Perl Monks concerning the following question:

Iam new to perl and this may seem a vague question but I have a PDB file and i just want to add 10 in all x co ordinate of the ATOM records after TER in the file. can anyone please help me with the code?? this is the PDB file: http://www.pdb.org/pdb/files/3MIM.pdb ATOM is a series of lines in the file and TER is a lines within these ATOM lines.If ATOM=[0] position then x coordinate =5. Considering only the first TER in ATOM lines, I need to add 10 to x coordinate and substitute the revised values in the file. I hope this makes sense.

Replies are listed 'Best First'.
Re: change x coordinate in pdb
by Anonymous Monk on May 06, 2011 at 08:21 UTC
Re: change x coordinate in pdb
by mr_mischief (Monsignor) on May 06, 2011 at 07:04 UTC

    The question is a whole lot more vague than it needs to be. Not only don't you have a stab at it, but you don't even tell us what a PDB file is or link to a definition. Yes, searching the web is easy enough, but it'd be much less work for you to make one good link than for twenty or thirty people to search, read the first couple of pages through a few links, and come back to ask if they'd found the right type of PDB file.

Re: change x coordinate in pdb
by John M. Dlugosz (Monsignor) on May 06, 2011 at 07:09 UTC
    You didn't show what an ATOM record or a TER is, so I expect it's not part of the problem that you need help with. Though I'll have to assume that you are dealing with text.

    Use s// and m/// to identify and change parts of a line.

    Use an "if" statement to determine if you are looking for the TER record or have passed it.

    The file I/O is explained in any intro, but you might be interested in the -i command line option.