How do I correctly add chain ID to my pdb file?
1
0
Entering edit mode
2.2 years ago

I am trying to conduct some analysis with my single-chain PDB file (766 residues long), but it requires a chain ID. Currently, there isn't one.

Here is a snippet of the pdb file:

ATOM      1  N   MET     1     -69.269  78.953 -91.441  1.00  0.00           N
ATOM      2  CA  MET     1     -69.264  78.650 -92.891  1.00  0.00           C
ATOM      4  C   MET     1     -69.371  79.939 -93.633  1.00  0.00           C
ATOM      5  O   MET     1     -68.379  80.649 -93.799  1.00  0.00           O
ATOM      3  CB  MET     1     -70.475  77.774 -93.251  1.00  0.00           C
ATOM      6  CG  MET     1     -70.505  76.455 -92.477  1.00  0.00           C
ATOM      7  SD  MET     1     -69.115  75.332 -92.806  1.00  0.00           S
ATOM      8  CE  MET     1     -69.473  74.270 -91.377  1.00  0.00           C
ATOM      9  N   ASP     2     -70.583  80.284 -94.111  1.00  0.00           N
ATOM     10  CA  ASP     2     -70.688  81.539 -94.789  1.00  0.00           C
ATOM     12  C   ASP     2     -70.661  82.602 -93.737  1.00  0.00           C
ATOM     13  O   ASP     2     -71.088  82.377 -92.606  1.00  0.00           O
ATOM     11  CB  ASP     2     -71.963  81.733 -95.626  1.00  0.00           C
ATOM     14  CG  ASP     2     -71.691  82.908 -96.557  1.00  0.00           C
ATOM     15  OD1 ASP     2     -70.569  82.953 -97.130  1.00  0.00           O
ATOM     16  OD2 ASP     2     -72.598  83.768 -96.717  1.00  0.00           O1-
ATOM     17  N   HIS     3     -70.129  83.791 -94.077  1.00  0.00           N
ATOM     18  CA  HIS     3     -70.045  84.846 -93.110  1.00  0.00           C
ATOM     20  C   HIS     3     -71.342  85.581 -93.094  1.00  0.00           C
ATOM     21  O   HIS     3     -72.113  85.574 -94.052  1.00  0.00           O
ATOM     19  CB  HIS     3     -68.925  85.865 -93.404  1.00  0.00           C
ATOM     23  CG  HIS     3     -68.749  86.908 -92.336  1.00  0.00           C
ATOM     25  CD2 HIS     3     -67.998  86.879 -91.200  1.00  0.00           C
ATOM     22  ND1 HIS     3     -69.357  88.144 -92.351  1.00  0.00           N
ATOM     26  CE1 HIS     3     -68.947  88.797 -91.234  1.00  0.00           C
ATOM     24  NE2 HIS     3     -68.121  88.068 -90.504  1.00  0.00           N


What's the best way for me to label the chain as chain A?

pdb assembly file complex • 2.9k views
1
Entering edit mode
2.2 years ago
Mensur Dlakic ★ 20k

Rosetta suite has a Perl script addChain.pl that does just that, but it may be an overkill to download the whole package just for that. It seems that pdb-tools would be a simpler solution.

In simple terms, you need to read the file line by line, and put a chain into column 22 of each line that begins with ATOM or HETATM. Assuming your file is called myfile.pdb, we are trying to replace letter A that is separated by 15 characters from HETATM with letter B, and also letter A that is separated by 17 characters from ATOM with letter B.

sed 's/^$$HETATM.\{15\}$$A/\1B/' myfile.pdb > newfile.pdb
sed -i 's/^$$ATOM.\{17\}$$A/\1B/' newfile.pdb


This actually won't work on your file because it is attempting to replace chain A with B, but it is written this way to indicate where the chain letters go. You would need to put a space (empty character) instead of A in the command above, and whatever chain you desire instead of B. Note that first sed command is done with redirection to preserve your original file, while the second sed is done in place as you now have a new file.

0
Entering edit mode

This Perl script could work:

http://www.canoz.com/sdh/renamepdbchain_pl.txt

0
Entering edit mode

Thanks for your response. I tried this:

sed 's/^$$HETATM.\{15\}$$ /\1A/' test.pdb > test1.pdb; sed -i 's/^$$ATOM.\{17\}$$ /\1B/' test1.pdb


but I keep getting this error: sed: 1: "test1.pdb": undefined label 'est1.pdb'

What am I missing?

0
Entering edit mode

Never mind. I figured it out. Thanks for all your help!

0
Entering edit mode

Could you send us the code and tool/software on which you solved the problem please. I have the same case