6
$\begingroup$

I have a trajectory (few frames) that I want to stack together and build a single PDB. I thought either to use VMD or MDAnalysis library.

With VMD if I do atomselect it takes a frame identifier as an argument. With MDAnalysis I saw this:

with MDAnalysis.Writer("all.pdb", multiframe=True) as pdb:
    for ts in u.trajectory:
        pdb.write(u)

However, I am not sure how to use it in a complete script.

$\endgroup$
2
  • 1
    $\begingroup$ Not only is your edit asking a different question, it's not the right question. That PDB file doesn't have multiple "trajectories" or frames. It's a protein with quaternary structure, where each subunit is separated by a TER card. You should ask a separate question about how to split apart PDB files. $\endgroup$ Commented Dec 30, 2017 at 17:29
  • $\begingroup$ @pentavalentcarbon I see, that was my original problem. I created a new question. $\endgroup$
    – 0x90
    Commented Dec 31, 2017 at 1:29

1 Answer 1

4
$\begingroup$
#!/usr/bin/env python2

import MDAnalysis

# file formats are automatically deduced; this is a standard topology and binary
# (NetCDF) trajectory from AMBER
topology = 'peptide_1.prmtop'
trajectory = '02_peptide_1_equil_NVT.nc'
u = MDAnalysis.Universe(topology, trajectory)

with MDAnalysis.Writer("all.pdb", multiframe=True) as pdb:
    for ts in u.trajectory:
        pdb.write(u)

One thing that may be important: I see lots of warnings when trying to use Python 3, so 2.7 is probably better at this point.

$\endgroup$
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.