Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re^2: incrementing already existing file

by wanttoprogram (Novice)
on Feb 28, 2011 at 00:51 UTC ( #890484=note: print w/ replies, xml ) Need Help??


in reply to Re: incrementing already existing file
in thread incrementing already existing file

<MYFILE> has columns similar to this. I want to save column # and last column value when I open this file.I tried to save in sub-strings

IN CHAIN A RESIDUE 1 HAS ENERGY 28.8216 IN CHAIN A RESIDUE 2 HAS ENERGY 24.9274 IN CHAIN A RESIDUE 3 HAS ENERGY 19.0884 IN CHAIN A RESIDUE 4 HAS ENERGY -27.6978 IN CHAIN A RESIDUE 5 HAS ENERGY 34.8558 IN CHAIN A RESIDUE 6 HAS ENERGY 17.9725 IN CHAIN A RESIDUE 7 HAS ENERGY 29.0379 IN CHAIN A RESIDUE 8 HAS ENERGY 13.7192 IN CHAIN A RESIDUE 9 HAS ENERGY 15.3481 IN CHAIN A RESIDUE 10 HAS ENERGY -7.55393 IN CHAIN A RESIDUE 11 HAS ENERGY -5.87837 IN CHAIN A RESIDUE 12 HAS ENERGY 40.7543 IN CHAIN A RESIDUE 13 HAS ENERGY -11.5488 IN CHAIN A RESIDUE 14 HAS ENERGY -11.7673 <NEWF> has columns similar to this. I want to save column # and compar +e it with previous MYFILE vale. When they match I want to print the valve that I stored in previous fi +le in place of last but one column (bold column) ATOM 1 N MET 1 4.440 25.987 -14.585 1.00 0.00 + A ATOM 2 HT1 MET 1 4.524 25.860 -15.614 1.00 0.00 + A ATOM 3 HT2 MET 1 4.109 26.952 -14.383 1.00 0.00 + A ATOM 4 HT3 MET 1 3.729 25.316 -14.228 1.00 0.00 + A ATOM 5 CA MET 1 5.708 25.747 -13.831 1.00 0.00 + A ATOM 6 HA MET 1 6.008 24.725 -14.011 1.00 0.00 + A ATOM 7 CB MET 1 6.792 26.728 -14.367 1.00 0.00 + A ATOM 8 HB1 MET 1 6.812 26.659 -15.475 1.00 0.00 + A ATOM 9 HB2 MET 1 6.502 27.769 -14.109 1.00 0.00 + A ATOM 10 CG MET 1 8.241 26.517 -13.880 1.00 0.00 + A ATOM 11 HG1 MET 1 8.298 26.709 -12.787 1.00 0.00 + A ATOM 12 HG2 MET 1 8.547 25.462 -14.049 1.00 0.00 + A ATOM 20 N ALA 2 6.330 25.384 -11.469 1.00 0.00 + A ATOM 21 HN ALA 2 7.105 24.825 -11.751 1.00 0.00 + A ATOM 22 CA ALA 2 6.383 25.717 -10.067 1.00 0.00 + A ATOM 23 HA ALA 2 6.344 26.791 -9.955 1.00 0.00 + A ATOM 24 CB ALA 2 5.300 25.034 -9.205 1.00 0.00 + A ATOM 25 HB1 ALA 2 4.288 25.319 -9.565 1.00 0.00 + A ATOM 26 HB2 ALA 2 5.394 23.928 -9.255 1.00 0.00 + A ATOM 27 HB3 ALA 2 5.396 25.346 -8.143 1.00 0.00 + A ATOM 28 C ALA 2 7.753 25.238 -9.659 1.00 0.00 + A ATOM 29 O ALA 2 8.299 24.357 -10.317 1.00 0.00 + A ATOM 30 N THR 3 8.353 25.813 -8.605 1.00 86.23 + A ATOM 31 HN THR 3 7.908 26.533 -8.079 1.00 0.00 + A ATOM 32 CA THR 3 9.687 25.408 -8.176 1.00 88.87 + A ATOM 33 HA THR 3 9.829 24.356 -8.373 1.00 0.00 + A ATOM 34 CB THR 3 10.847 26.194 -8.810 1.00 91.62 + A ATOM 35 HB THR 3 11.790 25.982 -8.261 1.00 0.00 + A


Comment on Re^2: incrementing already existing file
Download Code
Re^3: incrementing already existing file
by broomduster (Priest) on Feb 28, 2011 at 01:06 UTC
    OK so far, I think. But you need to be a bit clearer.
    • When you say "column #" what do you mean exactly?
    • Given the first few lines of each file (say five lines), what should the output look like? Not just a description, but please show the actual output you want to create.
Re^3: incrementing already existing file
by umasuresh (Hermit) on Feb 28, 2011 at 13:55 UTC
    It looks like you are trying to add energy value of each residue in one file to a PDB file, is this what you are trying to accomplish?
      That's right

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://890484]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (8)
As of 2014-12-21 18:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (106 votes), past polls