Hi,
thank you for the fast help! This is pretty much, what the output should be. The only thing is the mean value. So, in the first line should be -1.5 in the 5th column (-1+(-2))/2=-1.5. Meaning, always, when both values are minus or plus, a mean value should be calculated.
So the output should look like:
A B C D -1.5 0
I J K L +1
M N O P -6
Could we do that?
Thanx again
Christine
---------- Post updated at 09:46 AM ---------- Previous update was at 09:30 AM ----------
One more question: Would it be also possible with an awk script? I am much more familiar with awk than with perl
Thanx a lot,
Christine
---------- Post updated at 12:26 PM ---------- Previous update was at 09:46 AM ----------
Okay, I post my original file:
ATOM 0 BB SER 1 0 -31.958 -25.125 -11.061 1.00 0.00 -0.8
ATOM 1 BB GLY 1 1 -32.079 -26.085 -14.466 1.00 0.00 -0.4
ATOM 2 BB VAL 1 2 -36.455 -21.265 -15.792 1.00 0.00 4.2
ATOM 3 BB SER 1 3 -37.401 -20.877 -19.029 1.00 0.00 -0.8
ATOM 4 BB ALA 1 4 -42.701 -21.232 -18.584 1.00 0.00 1.8
ATOM 5 BB VAL 1 5 -47.498 -23.718 -18.979 1.00 0.00 4.2
ATOM 6 BB THR 1 6 -47.989 -24.426 -21.973 1.00 0.00 -0.7
ATOM 7 BB ALA 1 7 -46.376 -27.080 -22.868 1.00 0.00 1.8
ATOM 8 BB VAL 1 8 -44.852 -28.570 -20.796 1.00 0.00 4.2
If the values in the last column are both postive or both negative, then I want to calculate the mean value and write out only the line that originally contained the first value. If the values are different concerning plus/minus I leave them as they are. So in this case the output should be:
ATOM 0 BB SER 1 0 -31.958 -25.125 -11.061 1.00 0.00 -0.6
ATOM 2 BB VAL 1 2 -36.455 -21.265 -15.792 1.00 0.00 4.2
ATOM 3 BB SER 1 3 -37.401 -20.877 -19.029 1.00 0.00 -0.8
ATOM 4 BB ALA 1 4 -42.701 -21.232 -18.584 1.00 0.00 3.0
ATOM 6 BB THR 1 6 -47.989 -24.426 -21.973 1.00 0.00 -0.7
ATOM 7 BB ALA 1 7 -46.376 -27.080 -22.868 1.00 0.00 3.0
I think, the Perl script would work, I just cannot adapt it to my file
I am really thankful for any help!