Connect with us

Tips & Tricks

How to remove HETATMS and chains from PDB file?

Tariq Abdullah



Removing HETATM and chains from pdb files

This is a basic tutorial on how to remove the hetero-atoms (HETATMS) and chains from PDB files. It is an important step for computational and molecular dynamics simulation.

There are two simple ways to remove HETATMS and chains from PDB files.

1. Using a text editor


  • Open your PDB file in an editor such as notepad++ (in Windows) or gedit/notepadqq (in Linux).
  • Go to the end of the file. There you will see many lines with ‘HETATM’ in the first column from the right (Figure 1).
  • Remove these lines. DON’T remove the last two lines (‘MASTER’ & ‘END’).

Figure 1. Removing hetatoms

Figure 1 HETATM rows in a PDB file.

Removing Chains

Now, look at the fifth column in Figure 1. As you can see, there are four chains in that protein: A, B, C, and D. Let’s suppose we need chain A only, then we have to remove the rest of the three chains.

  • After removing HETATM rows, start removing other chains from the row having ‘TER’ in the first column from the right (Figure 2).

Figure 2 Removing chains from PDB files

Figure 2 Chain D in the PDB file.

  • Keep removing until you reach the line showing ‘TER’ in the first column and ‘A’ in the fifth column (Figure 3). Now, you must be left with the last two rows (MASTER & END) at the end of file.
  • Now, save this file.

Figure 3. Removing chains from PDB files

Figure 3 Remaining chain A and the last two rows (MASTER & END) at the end of the file.

2. Using Pymol

The first option seems tedious as compared to using Pymol.

  • Open PDB file in Pymol.
  • Go to the bottom left panel. There you will see some options including ‘S’ and ‘F’.
  • Click on ‘S’. It will display the chains/ amino acid residues present in that structure.
  • Just above these options, you will see: “Selecting: Residues” written there (Figure 4).

Figure 4. Removing chains from PDB file using PYMOL

Figure 4 Bottom-left panel in Pymol showing ‘S’ option.

  • Left-click with the mouse on Residues one time. It will show ‘Chains’ (Figure 5).

Figure 5. Removing chains from PDB file using PYMOL

Figure 5 Bottom-left panel in Pymol showing ‘Chains’ option.

  • Let’s suppose you need only chain A. Go to the displayed amino acid residues. Scroll to the end.
  • Select the chains that you want to delete by left-clicking with your mouse.
  • Go to the top right panel. There you will three rows including ‘(sele)’. Click on ‘A’ (means action). It will show a small window, select ‘remove atoms’. It will remove the selected chains.
  • Now, go to File –> Export Molecule –> PDB Options. Check ‘Write CONECT records for all bonds’ and uncheck ‘Write segment identifier (segi) column’. The latter is optional. Click ‘Save’.

Now, you have successfully removed all HETATMS and irrelevant chains from your PDB file.


  1. The PyMOL Molecular Graphics System, Version 1.2r3pre, Schrödinger, LLC.

Tariq is founder of Bioinformatics Review and CEO at IQL Technologies. His areas of expertise include algorithm design, phylogenetics, MicroArray, Plant Systematics, and genome data analysis. If you have questions, reach out to him via his homepage.

Click to comment

You must be logged in to post a comment Login

Leave a Reply

Tips & Tricks

Basic bioinformatics concepts to learn for beginners

Dr. Muniba Faiza



Basic Concepts in Biology & Bioinformatics for Beginners

This article is for beginners who are stepping into the field of bioinformatics. We will discuss some basic concepts that you need to learn while trying to enter the field of bioinformatics. (more…)

Continue Reading

Tips & Tricks

A Beginner’s Guide on How to Write Good Manuscripts

Dr. Muniba Faiza



A beginner's guide on how to write good manuscripts

Drafting a manuscript could be a difficult task for beginners in the field of research. In this article, we will provide a few tips for how can you write a good manuscript being a research scholar. (more…)

Continue Reading

Tips & Tricks

Importance of Reasoning in Research

Dr. Muniba Faiza



Importance of reasoning in research

Research is considered complicated. As it involves reading multiple research articles and reviews, devising hypotheses and appropriate experiments, and last but not the least, getting a significant output. This seems difficult to read multiple research papers and then extract useful information regarding your project. It involves a methodology to read and understand research articles in one go. This is explained in our previous article “A guide on how to read the research articles”. This article explains the importance of thinking during your entire research. (more…)

Continue Reading