All atom pca

18 views
Skip to first unread message

Daniel Burns

unread,
Jul 16, 2022, 2:10:13 PMJul 16
to MDnalysis discussion
Hello,

I'm trying to do PCA on roughly 10,000 atoms across about 30,000 frames.

The calculation seems to hang for days. I'm using the same script used for the C alpha pca (basically the lines from the mda pca tutorial) and only changing the selection.

I've run it in the past on C alphas with no problem but this seems like it might be too much to process for the mdanalysis implementation?  

I made an np.array of the coordinates and did pca with sklearn in a matter of minutes but when I try to project the trajectory onto the PCs I end up visualizing a blob of atoms squashed into a tiny space. I'm clearly missing something with this approach.

Thanks,
Dan

Daniel Burns

unread,
Jul 16, 2022, 2:35:26 PMJul 16
to MDnalysis discussion
It looks like I need to apply an inverse transform.

Daniel Burns

unread,
Jul 17, 2022, 1:05:04 PMJul 17
to MDnalysis discussion
Doing PCA on all the atoms wasn't as informative on motions as with only CAs so I ran it again on CAs and am now trying to use pca.project_single_frame() to apply the transformation to the rest of the protein.

"Optionally, calculates one displacement vector per residue to extrapolate the transform to atoms not in the PCA atomgroup."

 This function would be great for my purposes but I'm having some problems.

I loaded the CA pc object from a pickle and then:

# same structure and traj that I did the CA PCA with
u = mda.Universe(structure, traj)
protein = u.select_atoms('protein')

# project and write first 15 pc trajectorys
for i in range(15):

    project = pc.project_single_frame(components=i,
                                       group=protein, anchor='name CA')

    u.trajectory.add_transformations(project)

I get an error:

 project = pc.project_single_frame(components=i,
  File "conda_environments/miniconda3/envs/mdanalysis/lib/python3.9/site-packages/MDAnalysis/analysis/pca.py", line 544, in project_single_frame
    if not anchors.issubset(self._atoms):
  File "conda_environments/miniconda3/envs/mdanalysis/lib/python3.9/site-packages/MDAnalysis/core/groups.py", line 473, in wrapped
    raise ValueError(
ValueError: Can't operate on objects from different Universes

Could this be a result of loading the pc object from a file before trying to do the transformations?

Thank you!
Dan
Reply all
Reply to author
Forward
0 new messages