[Tutor] arrangement of datafile

Amrita Kumari amrita.g13 at gmail.com
Tue Dec 17 09:20:56 CET 2013


Hi,

I am new in programming and want to try Python programming (which is simple
and easy to learn) to solve one problem: in which
I have various long file like this:

1 GLY HA2=3.7850 HA3=3.9130
2 SER H=8.8500 HA=4.3370 N=115.7570
3 LYS H=8.7530 HA=4.0340 HB2=1.8080 N=123.2380
4 LYS H=7.9100 HA=3.8620 HB2=1.7440 HG2=1.4410 N=117.9810
5 LYS H=7.4450 HA=4.0770 HB2=1.7650 HG2=1.4130 N=115.4790
6 LEU H=7.6870 HA=4.2100 HB2=1.3860 HB3=1.6050 HG=1.5130 HD11=0.7690
HD12=0.7690 HD13=0.7690 N=117.3260
7 PHE H=7.8190 HA=4.5540 HB2=3.1360 N=117.0800
8 PRO HD2=3.7450
9 GLN H=8.2350 HA=4.0120 HB2=2.1370 N=116.3660
10 ILE H=7.9790 HA=3.6970 HB=1.8800 HG21=0.8470 HG22=0.8470 HG23=0.8470
HG12=1.6010 HG13=2.1670 N=119.0300
11 ASN H=7.9470 HA=4.3690 HB3=2.5140 N=117.8620
12 PHE H=8.1910 HA=4.1920 HB2=3.1560 N=121.2640
13 LEU H=8.1330 HA=3.8170 HB3=1.7880 HG=1.5810 HD11=0.8620 HD12=0.8620
HD13=0.8620 N=119.1360
........................
.......................

where first column is the residue number, what I want is to print
individual atom chemical shift value one by one along with residue
number.....for example for atom HA2 it should be:

1 HA2=3.7850
2 HA2=nil
3 HA2=nil
.....
............
..........
13 HA2=nil

similarly for atom HA3 it should be same as above:

1 HA3=3.9130
2 HA3=nil
3 HA3=nil
...........
............
............
13 HA3=nil

while for atom H it should be:
1  H=nil
2  H=8.8500
3  H=8.7530
4  H=7.9100
5  H=7.4450
........

but in some file the residue number is not continuous some are missing (in
between). I want to write python code to solve this problem but don't know
how to split the datafile and print the desired output. This problem is
important in order to compare each atom chemical shift value with some
other web-based generated chemical shift value. As the number of atoms in
different row are different and similar atom are at random position in
different residue hence I don't know to to split them. Please help to solve
this problem.

Thanks,
Amrita
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20131217/cc720403/attachment.html>


More information about the Tutor mailing list