0

I was trying to extract Nitrogen coordinates from ubiquitin protein. I have the 1UBQ.pdb file from http://rcsb.org/pdb/home/home.do website. I have done the following.

pdb1 ='/home/devanandt/Documents/VMD/1UBQ.pdb';
x=pdbread(pdb1)
y=x.Model.Atom

'y' variable gives 1x602 struct array with many fields including the co-ordinates X,Y,Z. There are 76 residues in this protein and so 76 nitrogens. How to extract (X,Y,Z) data separately to an array?

dexterdev
  • 537
  • 4
  • 22

2 Answers2

2

If each x.Model.Atom.X is a single number (presuming this is X-coordinate for a given atom), then:

X = [x.Model.Atom.X]; 
%etc for each field

Should return a 1x602 vector of your X coordinates

In some cases you may want to return a cell array with all the field values instead:

out = {x.Model.Atom.somefield}
nkjt
  • 7,825
  • 9
  • 22
  • 28
0

This is how I achieved it.

pdb1 ='/home/devanandt/Documents/VMD/1UBQ.pdb';
x=pdbread(pdb1);

atom={x.Model.Atom.AtomName};
n_i=find(strcmp(atom,'N')); % Find indices of atoms

X = [x.Model.Atom.X];
Y = [x.Model.Atom.Y];
Z = [x.Model.Atom.Z];

X_n = X(n_i); % X Y Z coordinates of N atoms
Y_n = Y(n_i);
Z_n = Z(n_i);
dexterdev
  • 537
  • 4
  • 22