stacker.file_manipulation.file_convert

Contents

stacker.file_manipulation.file_convert#

file_convert(trj_file, top_file, outfile)[source]#

Converts a trajectory input file to a new output type.

The output file type is determined by the outfile extension. Uses mdtraj.save() commands to convert trajectory files to various file types such as mdtraj.save_mdcrd(), mdtraj.save_pdb(), mdtraj.save_xyz(), etc.

Parameters:
trj_filestr

Path to the file of the concatenated trajectory (eg. .mdcrd file).

top_filestr

Path to the file of the topology of the molecule (.prmtop file).

outfilestr

Output filename (include .mdcrd, .pdb, etc.).

Returns:
None

See also

mdtraj.load

Load trajectory files

mdtraj.save

Save md.Trajectory to file

mdtraj.load_xyz

Load a .xyz trajectory file

Notes

Output filetype determined from file extension of output_file parameter.

Examples

>>> import stacker as st
>>> import mdtraj as md
>>> st.file_convert('stacker/testing/first10_5JUP_N2_tUAG_aCUA_+1GCU_nowat.mdcrd', 
...                 'stacker/testing/5JUP_N2_tUAG_aCUA_+1GCU_nowat.prmtop', 
...                 'stacker/testing/first10_5JUP_N2_tUAG_aCUA_+1GCU_nowat.xyz')
WARNING: Output file atom, residue, and chain indices are zero-indexed
Trajectory written to: stacker/testing/first10_5JUP_N2_tUAG_aCUA_+1GCU_nowat.xyz
>>> md.load_xyz('stacker/testing/first10_5JUP_N2_tUAG_aCUA_+1GCU_nowat.xyz', 
...             top='stacker/testing/5JUP_N2_tUAG_aCUA_+1GCU_nowat.prmtop')
<mdtraj.Trajectory with 10 frames, 12089 atoms, 494 residues, without unitcells at 0x10bb75cd0>