0

I have maybe more technical question than code-related. I try to perform PCA (with MDAnalysis package) with only PDB file - this pdb file contain 100 aligned structures (which are, of course, same - it means same type and amount of atoms; it was done in PyMol).

I use my previously made code for PCA with standard trajectories, but it returns error "No covariance information can be gathered from asingle trajectory frame."

Thus, my hypotesis is that PCA cant be done only using PDB files or it could be, but I dont have right pdb-inputs. I would like to know if there is someone, who has ever tried something like this or has good experience with MDAnalysis and could give me any suggestions (I am new to computational chemistry).

Code is, I think, not so much needed, however I attach it:

import matplotlib.pyplot as plt
import MDAnalysis as mda
from MDAnalysis.analysis.pca import PCA
import numpy as np

u = mda.Universe("mypdb.pdb") 
ca = u.select_atoms('name CA')


pca = PCA(u, select='name CA').run()
n_pcs = np.where(pca.cumulated_variance > 0.95)[0][0]
reduced_data = pca.transform(ca, n_components=n_pcs)

plt.plot(pca.variance, "-o")
  • 1
    If the PDB file contains a "PDB trajectory" (i.e., a file with multiple MODEL entries) then this should work. See if `u.trajectory.n_frames` shows a number greater than 1. See [PDB structure files in MDAnalysis](https://www.mdanalysis.org/docs/documentation_pages/coordinates/PDB.html) for some more background. – orbeckst Nov 26 '19 at 23:27
  • By the way, most MDAnalysis users asks questions on the mailing list https://groups.google.com/group/mdnalysis-discussion – orbeckst Nov 26 '19 at 23:31
  • Thanks, I looked into te mailing list, but didnt find answer to my problem. Yes, my file is a single frame, because it is not made from trajectory. I made this file from 100 structures, which are aligned and these structures are originally separate structures from RCSB (but it is always the same protein with the same amount of atoms). Is there a possibility to made it as multiframe PDB? – HungryMolecule Nov 27 '19 at 08:46
  • Have you printed the `u.trajectory.n_frames` as suggested by @orbeckst? Most likely your .pdb trajectory is not constructed correctly. How did you separate the frames in your .pdb? Does the separation use the keyword MODEL? – mateuszb Nov 27 '19 at 12:20

1 Answers1

0

for you PDB file to be considered as a "multi-frame" PDB file by mdtraj (and not as a single frame PDB), you must separate each conformation by "END" and not by "TER".

Lur
  • 1