[gmx-users] trjconv chaged the chain names of multi-chain complex?

Mark Abraham Mark.Abraham at anu.edu.au
Tue Apr 8 00:51:19 CEST 2008


Liu Shiyong wrote:
> Hi,
> 
> Chain name is very important for some application.  But,  when I  use 
> the following script to get a minimized structure from a multi-chain  
> complex.
> But the chain name was changed.  I checked the man trjconv , but I did 
> not find any information on chain name for trjconv.

The .gro file format does not permit chain identifiers. So they were 
lost when you wrote ${file}.gro, and re-invented for output.pdb. If I 
remember correctly they're also not stored in a .tpr file.

> pdb2gmx   -ff ${forcefield} -f  starting.pdb -p ${file}.top -i 
> ${file}.posre.itp -o ${file}.gro > ${file}.output.pdb2gmx 2>&1
> 
> mdrun -nice 0 -v -s ${file}.input.tpr -o ${file}.minim_traj.trr -c 
> ${file}.minimized.gro -e ${file}.minim_ener.edr -g ${file}.emlog.log    
>  > ${file}.output.mdrun 2>&1
> 
> trjconv  -sep -f ${file}.minim_traj.trr -s ${file}.input.tpr -o 
> output.pdb << HHH
> 2
> 2
> HHH
> 
> The starting.pdb has four chain: A B  D E
> The output file output.pdb has a different chain name: A B C D.

There's no way to fix this one with GROMACS (at least, as far as I 
know). However if you edit your starting.pdb file to have the same kind 
of format as output.pdb, then you can use the standard unix utility 
programs head, tail, grep, cut and paste to solve this problem. Use

head -n x output.pdb > head
tail -n y output.pdb > tail

to extract the header and footer to separate files, and then grep out 
all of the lines that begin with atom records

grep -e '^ATOM' output.pdb > outputatom
grep -e '^ATOM' starting.pdb > startingatom

Then

cut -c=z startingatom > chainidentifiers
cut -c-1-a outputatom > left
cut -c=b- outputatom > right
paste -d='' left chainidentifiers right > middle
cat head middle tail > fixed.pdb

and to clean up

rm head tail outputatom startingatom chainidentifiers middle

You will need to identify the correct numbers for x, y, and z, and a=z-1 
and b=z+1. See the man pages for each of these commands to learn more.

Mark



More information about the gromacs.org_gmx-users mailing list