Bioinformatics Programming
How to extract x,y,z coordinates of atoms from PDB file?

The x, y, and z coordinates of atoms are provided in the PDB file. One way to extract them is by using the Biopython package [1]. In this article, we will extract coordinates of C-alpha atoms for each residue from the PDB file using Biopython.
Let’s say we have a PDB file named ‘input.pdb‘.
#!/usr/bin/env python3
from Bio.PDB import *
import numpy as np
p=PDBParser()
structure=p.get_structure('input', "input.pdb")
for model in structure:
for chain in model:
CA_coord = []
for residue in chain:
CA_coord.append((residue['CA'].get_vector()))
print(CA_coord)
Save this file as Python script, for example, as ‘ca_coord.py‘, keep your input file in the same directory or provide the full path in the script, and run it as:
python3 ca_coord.py
References
- https://biopython.org/
Bioinformatics Programming
How to make swarm boxplot?

With the new year, we are going to start with a very simple yet complicated topic (for beginners) in bioinformatics. In this tutorial, we provide a simple code to plot swarm boxplot using matplotlib and seaborn. (more…)
Bioinformatics Programming
How to obtain ligand structures in PDB format from PDB ligand IDs?

Previously, we provided a similar script to download ligand SMILES from PDB ligand IDs. In this article, we are downloading PDB ligand structures from their corresponding IDs. (more…)
Bioinformatics Programming
How to obtain SMILES of ligands using PDB ligand IDs?

Fetching SMILE strings for a given number of SDF files of chemical compounds is not such a trivial task. We can quickly obtain them using RDKit or OpenBabel. But what if you don’t have SDF files of ligands in the first place? All you have is Ligand IDs from PDB. If they are a few then you can think of downloading SDF files manually but still, it seems time-consuming, especially when you have multiple compounds to work with. Therefore, we provide a Python script that will read all Ligand IDs and fetch their SDF files, and will finally convert them into SMILE strings. (more…)
You must be logged in to post a comment Login