psico.exporting

File export module that provides overloaded save commands with secondary structure and crystal information header, as well as saving to trajectory formats.

(c) 2010-2012 Thomas Holder and Steffen Schmidt, MPI for Developmental Biology (c) 2009 Sean Law, Michigan State University (save2traj)

License: BSD-2-Clause

Functions

get_grostr([selection, state, _self])

Save a Gromacs .gro file.

get_pdb_seqres([selection, quiet, _self])

Get PDB SEQRES records for a given selection.

get_pdb_sss([selection, state, quiet, _self])

API-only.

paper_png(filename[, width, height, dpi, ...])

Saves a PNG format image file of the current display.

save(filename[, selection, state, format, ...])

MagicMock is a subclass of Mock with default implementations of most of the magic methods.

save_lightdock_restraints(filename, selection, *)

Save a LightDock restraints file

save_mdtraj(filename[, selection, ...])

Save a trajectory file with the "mdtraj" Python library.

save_pdb(filename[, selection, state, symm, ...])

Save the coordinates of a selection as pdb including the secondary structure information and, if possible, the unit cell.

save_pdb_without_ter(filename, selection, *args)

Save PDB file without TER records.

save_traj(filename[, selection, format, ...])

Save coordinates of a multi-state object to a trajectory file (DCD OR CRD).

unittouu(string[, dpi])

API only.

Classes

CRDOutfile(filename[, nstates, natoms, ...])

http://ambermd.org/formats.html#trajectory

DCDOutfile(filename, nstates, natoms[, ...])

http://www.ks.uiuc.edu/Research/vmd/plugins/molfile/dcdplugin.html

RSTOutfile(*args, **kwargs)

http://ambermd.org/formats.html#restart

class psico.exporting.CRDOutfile(filename, nstates=-1, natoms=-1, vendor='PyMOL', box=None)[source]

Bases: object

http://ambermd.org/formats.html#trajectory

close()[source]
columns = 10
fmt = '%8.3f'
writeCoordSet(xyz, transposed=0)[source]

Write a NATOMSx3 coord matrix.

class psico.exporting.DCDOutfile(filename, nstates, natoms, vendor='PyMOL', box=None)[source]

Bases: FileIO

http://www.ks.uiuc.edu/Research/vmd/plugins/molfile/dcdplugin.html

writeCoordSet(xyz, transposed=0)[source]

Write a 3xNATOMS coord matrix.

writeFortran(buffer, fmt, length=0)[source]

Write FORTRAN unformatted binary record.

class psico.exporting.RSTOutfile(*args, **kwargs)[source]

Bases: CRDOutfile

http://ambermd.org/formats.html#restart

columns = 6
fmt = '%12.7f'
psico.exporting.get_grostr(selection='all', state=-1, *, _self=...)[source]

Save a Gromacs .gro file.

psico.exporting.get_pdb_seqres(selection='all', quiet=1, *, _self=...)[source]

Get PDB SEQRES records for a given selection.

psico.exporting.get_pdb_sss(selection='(all)', state=-1, quiet=1, *, _self=...)[source]

API-only. Return the PDB “Secondary Structure Section” for a given selection to put in the header section of a PDB file. Takes the “ss” atom property of CA atoms.

http://www.wwpdb.org/documentation/format33/sect5.html

Argument

selection = string: atom selection

state = int: object state {default: -1}

psico.exporting.paper_png(filename, width=100, height=0, dpi=300, ray=1, *, _self=...)[source]

Saves a PNG format image file of the current display. Instead of pixel dimensions, physical dimensions for printing (in millimeters) and DPI are specified.

Usage

paper_png filename [, width [, height [, dpi [, ray ]]]]

Arguments

filename = string: filename

width = float: width in millimeters {default: 100 = 10cm} width = string: width including unit (like: ‘10cm’ or ‘100mm’)

height = float or string, like “width” argument. If height=0, keep aspect ratio {default: 0}

dpi = float: dots-per-inch {default: 300}

ray = 0 or 1: should ray be run first {default: 1 (yes)}

See Also

png

psico.exporting.save(filename, selection='(all)', state=-1, format='', ref='', ref_state=-1, quiet=1, *args, _self=..., **kwargs)[source]

MagicMock is a subclass of Mock with default implementations of most of the magic methods. You can use MagicMock without having to configure the magic methods yourself.

If you use the spec or spec_set arguments then only magic methods that exist in the spec will be created.

Attributes and the return value of a MagicMock will also be MagicMocks.

Additional Note

This is an overloaded version of the ‘save’ command that also saves secondary structure and crystal information, if available.

psico.exporting.save_lightdock_restraints(filename: Path | str, selection: str, *, ligand: str = '', append: bool = False, quiet: bool = True, _self=...)[source]

Save a LightDock restraints file

Arguments

ligand = str: Ligand object name

psico.exporting.save_mdtraj(filename, selection='all', topformat='pdb', quiet=1, *, _self=...)[source]

Save a trajectory file with the “mdtraj” Python library.

https://mdtraj.org/

psico.exporting.save_pdb(filename, selection='(all)', state=-1, symm=1, ss=1, aniso=None, seqres=0, quiet=1, *, _self=...)[source]

Save the coordinates of a selection as pdb including the secondary structure information and, if possible, the unit cell. The latter requires the selction of a single object

Usage

save_pdb filename, selection [, state [, symm [, ss ]]]

Arguments

filename = string: file path to be written

selection = string: atoms to save {default: (all)}

Note: to include the unit cell information you need to select a single object

state = integer: state to save {default: -1 (current state)}

symm = 0 or 1: save symmetry info if possible {default: 1}

ss = 0 or 1: save secondary structure info {default: 1}

aniso: unused/obsolete

See Also

save

psico.exporting.save_pdb_without_ter(filename, selection, *args, _self=..., **kwargs)[source]

Save PDB file without TER records. External applications like TMalign and DynDom stop reading PDB files at TER records, which might be undesired in case of missing loops.

psico.exporting.save_traj(filename, selection='(all)', format='', box=0, quiet=1, *, _self=...)[source]

Save coordinates of a multi-state object to a trajectory file (DCD OR CRD).

Based on http://pymolwiki.org/index.php/Save2traj by Sean Law

Usage

save_traj filename [, selection [, format ]]

Arguments

filename = string: file path to be written

selection = string: atoms to save

format = string: ‘dcd’ or ‘crd’ (alias ‘charmm’ or ‘amber’) {default: determined from filename extension)

psico.exporting.unittouu(string, dpi=90.0)[source]

API only. Returns pixel units given a string representation of units in another system. Default unit is millimeter.