- changed version to v2.3 [devel]
- edited description
How to calculate distance matrix between two chain in a single PDB file?
Hi,
Is there a way I can calculate distance matrix between residue in just two wanted chains (e.g chain A and B ) from a single PDB file. But this code calculate all against all (even A against A and B agains B).
library(bio3d)
pdb <- read.pdb("5hie")
# I only want to calculate distance of residue for Chain A and B of 5hie.pdb
ca_ind <- atom.select(pdb, chain=c("A","B"))
dm(pdb, inds=ca_ind)
At the end of the day, I have list of residue from each chain which I want to calculate the distance in Armstrong:
First 3 column is residue, residue number, chain name from 5hie.
SER 602 A LYS 601 B
SER 465 A ASP 663 B
ASN 660 A ILE 543 B
SER 602 A VAL 600 B
VAL 600 A VAL 600 B
ASP 663 A ILE 463 B
ASN 660 A TYR 538 B
GLY 615 A GLY 615 B
GLY 615 A ARG 662 B
SER 602 A THR 599 B
ILE 463 A GLN 664 B
ILE 543 A ASN 660 B
ARG 603 A GLN 493 B
GLY 464 A GLN 664 B
GLN 664 A ILE 463 B
ARG 603 A LYS 601 B
ARG 662 A GLY 615 B
TYR 472 A ARG 671 B
ARG 462 A GLN 664 B
GLN 664 A GLY 464 B
LYS 601 A VAL 600 B
GLY 464 A ASP 663 B
LYS 601 A LYS 601 B
ARG 603 A VAL 600 B
VAL 600 A LYS 601 B
LYS 601 A THR 599 B
TYR 538 A ASN 660 B
THR 599 A ARG 603 B
THR 599 A SER 602 B
ASP 663 A SER 465 B
ILE 463 A ASP 663 B
VAL 600 A SER 602 B
GLN 664 A ARG 462 B
PHE 667 A ARG 462 B
LYS 601 A ARG 603 B
ASP 663 A GLY 464 B
ARG 462 A PHE 667 B
ARG 462 A ASP 663 B
ARG 603 A ALA 598 B
ASP 663 A ARG 462 B
THR 599 A LYS 601 B
ALA 598 A ARG 603 B
ARG 662 A SER 614 B
ARG 603 A THR 599 B
VAL 600 A ARG 603 B
LYS 601 A SER 602 B
GLY 615 A SER 614 B
How can I go about it?
EW
Comments (8)
-
reporter -
reporter - marked as minor
- edited description
-
reporter - edited description
-
Hi,
The data you want is a subset of the full distance matrix, which you can easily extract using the information from the PDB. For example,
# get the number of residues for chain A n <- sum(trim(pdb, chain='A')$calpha) # get the full matrix dmat <- dm(pdb, inds=ca_ind) # the matrix between A and B dAB <- dmat[1:n, (n+1):ncol(dmat)]
-
reporter Hi,
Thanks so much for your answer. FromdAB
how can I get the original residue number (as in PDB file) of each chain?For example given this:
SER 602 A LYS 601 B
I would like to check the distance betwen SER (residue 602 of chain A) and LYS (residue 601 of chain B ).
-
One way is to label your full matrix with residue id and number (and possibly chain ID), and then you can easily locate residues you are interested in. For example,
pdbca <- trim(pdb, "calpha") labs <- paste(pdbca$atom$resid, pdbca$atom$resno, pdbca$atom$chain, sep="_") rownames(dmat) <- labs colnames(dmat) <- labs dmat["SER_602_A", "LYS_601_B"]
-
reporter Xinqiu, thank you so much. This is very very helpful!
EW -
reporter - changed status to resolved
Resolved
- Log in to comment