Re: Writing pdb file.. easier way?

From: Jérôme Hénin (jerome.henin_at_uhp-nancy.fr)
Date: Thu Nov 18 2004 - 17:28:36 CST

Hi Uday,

I am sure there is a nice VMD way of doing this, but here is the quick and
dirty (not so dirty, actually) AWK way:

-------
#!/bin/awk -f
$1=="ATOM" {
        printf("%s%4i%s\n", substr($0, 1, 22), substr($0, 23, 4) + 100,
substr($0, 27, 60))
}
$1!="ATOM" {
        print
}
-------

Of course, you may type it all in a single command line if yo like it better
than an executable script.

Jerome

Le jeudi 18 Novembre 2004 15:58, Uday Chippada a écrit :
> I have another simple question. If I have a pdb file of the sort shown
> below, and I have to change the residue numbers from say 301 to 401, 302 to
> 402 and so on, is there a simple way to do it using VMD or any text
> commands? I have tried cat filename.pdb | awk '{print $1 $2 $3 $4 $5 $6+100
> ... }' > newfile.pdb
>
> But this new file is not being read by VMD, must be the format error (the
> spacings between different columns in the line). Is there a way in which I
> can get a nice spacing, like how we get when we use the "writepdb" ?
>
> I need to change the residue numbers as I was trying to merge different
> files with same resid numbers, but different coordinates.
>
> Thanx
>
> Uday
>
> ATOM 1 N PRO A 301 -7.354 25.615 61.612 1.00 26.07
>
> ATOM 2 CA PRO A 301 -6.259 25.170 60.715 1.00 25.38
>
> ATOM 3 C PRO A 301 -6.330 25.908 59.378 1.00 24.47
>
> ATOM 4 O PRO A 301 -7.381 26.437 59.009 1.00 24.48
>
> ATOM 5 CB PRO A 301 -6.398 23.670 60.496 1.00 25.97
>
> ATOM 6 CG PRO A 301 -7.798 23.365 61.012 1.00 26.29
>
> ATOM 7 CD PRO A 301 -8.264 24.501 61.935 1.00 26.63
>
> ATOM 8 N HYP A 302 -5.206 25.961 58.640 1.00 23.36
>
> ATOM 9 CA HYP A 302 -5.175 26.645 57.342 1.00 21.80

This archive was generated by hypermail 2.1.6 : Wed Feb 29 2012 - 15:39:00 CST