schrodinger.application.desmond.packages.msys.molfile package

Structure and coordinate file manipulation library.

Reading a structure file:

reader = molfile.mae.read('/path/to/foo.mae')

Iterating through the frames in a file:

for frame in molfile.dtr.read('/path/to/foo.dtr').frames():
    function( frame.pos, frame.vel, frame.time, frame.box )

Random access to frames (only dtr files support this currently):

f27 = molfile.dtr.read('/path/to/foo.dtr').frame(27) # 0-based index

Convert an mae file to a pdb file:

input=molfile.mae.read('foo.mae')
output=molfile.pdb.write('foo.pdb', atoms=input.atoms)
output.frame(input.frames().next())
output.close()

Write every 10th frame in a dtr to a trr:

input=molfile.dtr.read('big.dtr')
output=molfile.trr.write('out.trr, natoms=input.natoms)
for i in range(0,input.nframes, 10):
    output.frame( input.frame(i) )
output.close()

Write a frame with a specified set of gids:

f = molfile.Frame(natoms, with_gids=True
f.gid[:] = my_gids
f.pos[:] = my_positions
w.frame(f)

Read the raw fields from a frameset (dtr):

dtr = molfile.DtrReader('input.dtr')    # also works for stk
for i in range(dtr.nframes):
    f = dtr.frame(i)
    keyvals = dict()
    frame = dtr.frame(i, keyvals=keyvals)
    ## use data in keyvals

Write raw fields to a frameset (dtr):

dtr = molfile.DtrWriter('output.dtr', natoms=natoms)
keyvals = dict( s = "a string",
                f = positions.flatten(),    # must be 1d arrays
                i = numpy.array([1,2,3]),
                )
dtr.append( time = my_time, keyvals = keyvals )
schrodinger.application.desmond.packages.msys.molfile.register_plugin(plugin)

put plugin in the global namespace, and add to extensiondict

schrodinger.application.desmond.packages.msys.molfile.load_shared_library(path)
schrodinger.application.desmond.packages.msys.molfile.guess_filetype(filename, default=None)

return plugin name based on filename, or default if none found.

class schrodinger.application.desmond.packages.msys.molfile.FrameIter(reader)

Bases: object

__init__(reader)

Initialize self. See help(type(self)) for accurate signature.

__iter__()
__next__()
skip(count=1)
__class__

alias of builtins.type

__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'schrodinger.application.desmond.packages.msys.molfile', '__init__': <function FrameIter.__init__>, '__iter__': <function FrameIter.__iter__>, '__next__': <function FrameIter.__next__>, 'skip': <function FrameIter.skip>, '__dict__': <attribute '__dict__' of 'FrameIter' objects>, '__weakref__': <attribute '__weakref__' of 'FrameIter' objects>, '__doc__': None})
__dir__() → list

default dir() implementation

__eq__

Return self==value.

__format__()

default object formatter

__ge__

Return self>=value.

__getattribute__

Return getattr(self, name).

__gt__

Return self>value.

__hash__

Return hash(self).

__init_subclass__()

This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

__le__

Return self<=value.

__lt__

Return self<value.

__module__ = 'schrodinger.application.desmond.packages.msys.molfile'
__ne__

Return self!=value.

__new__()

Create and return a new object. See help(type) for accurate signature.

__reduce__()

helper for pickle

__reduce_ex__()

helper for pickle

__repr__

Return repr(self).

__setattr__

Implement setattr(self, name, value).

__sizeof__() → int

size of object in memory, in bytes

__str__

Return str(self).

__subclasshook__()

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

__weakref__

list of weak references to the object (if defined)

class schrodinger.application.desmond.packages.msys.molfile.Grid(data, name='', axis=None, origin=None)

Bases: object

__init__(data, name='', axis=None, origin=None)

construct a new Grid object. data - 3d array of data; a copy is made. name - name for the grid. default empty string. axis - 3x3 array with grid axes in the rows. Default diag(1,1,1) origin - 0,0,0 corner of grid. Defaults to [0,0,0]

__repr__()

Return repr(self).

name
data
axis
origin
__class__

alias of builtins.type

__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'schrodinger.application.desmond.packages.msys.molfile', '__init__': <function Grid.__init__>, '__repr__': <function Grid.__repr__>, 'name': <property object>, 'data': <property object>, 'axis': <property object>, 'origin': <property object>, '__dict__': <attribute '__dict__' of 'Grid' objects>, '__weakref__': <attribute '__weakref__' of 'Grid' objects>, '__doc__': None})
__dir__() → list

default dir() implementation

__eq__

Return self==value.

__format__()

default object formatter

__ge__

Return self>=value.

__getattribute__

Return getattr(self, name).

__gt__

Return self>value.

__hash__

Return hash(self).

__init_subclass__()

This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

__le__

Return self<=value.

__lt__

Return self<value.

__module__ = 'schrodinger.application.desmond.packages.msys.molfile'
__ne__

Return self!=value.

__new__()

Create and return a new object. See help(type) for accurate signature.

__reduce__()

helper for pickle

__reduce_ex__()

helper for pickle

__setattr__

Implement setattr(self, name, value).

__sizeof__() → int

size of object in memory, in bytes

__str__

Return str(self).

__subclasshook__()

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

__weakref__

list of weak references to the object (if defined)

class schrodinger.application.desmond.packages.msys.molfile.StkFile

Bases: object

Generalized stk file: handles any molfile format that provides times

name = 'ls'
filename_extensions = 'ls'
classmethod read(path, filetype=None)
class Reader(path, filetype)

Bases: object

__init__(path, filetype)

Initialize self. See help(type(self)) for accurate signature.

natoms
nframes
frames()
frame(n)
get_prop(prop)

Use the same technique as used for times to generate a properly ordered set of properties across all readers

at_time_near(time)
__class__

alias of builtins.type

__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'schrodinger.application.desmond.packages.msys.molfile', '__init__': <function StkFile.Reader.__init__>, 'natoms': <property object>, 'nframes': <property object>, 'frames': <function StkFile.Reader.frames>, 'frame': <function StkFile.Reader.frame>, 'get_prop': <function StkFile.Reader.get_prop>, 'at_time_near': <function StkFile.Reader.at_time_near>, '__dict__': <attribute '__dict__' of 'Reader' objects>, '__weakref__': <attribute '__weakref__' of 'Reader' objects>, '__doc__': None})
__dir__() → list

default dir() implementation

__eq__

Return self==value.

__format__()

default object formatter

__ge__

Return self>=value.

__getattribute__

Return getattr(self, name).

__gt__

Return self>value.

__hash__

Return hash(self).

__init_subclass__()

This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

__le__

Return self<=value.

__lt__

Return self<value.

__module__ = 'schrodinger.application.desmond.packages.msys.molfile'
__ne__

Return self!=value.

__new__()

Create and return a new object. See help(type) for accurate signature.

__reduce__()

helper for pickle

__reduce_ex__()

helper for pickle

__repr__

Return repr(self).

__setattr__

Implement setattr(self, name, value).

__sizeof__() → int

size of object in memory, in bytes

__str__

Return str(self).

__subclasshook__()

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

__weakref__

list of weak references to the object (if defined)

__class__

alias of builtins.type

__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'schrodinger.application.desmond.packages.msys.molfile', '__doc__': ' Generalized stk file: handles any molfile format that provides times', 'name': 'ls', 'filename_extensions': 'ls', 'read': <classmethod object>, 'Reader': <class 'schrodinger.application.desmond.packages.msys.molfile.StkFile.Reader'>, '__dict__': <attribute '__dict__' of 'StkFile' objects>, '__weakref__': <attribute '__weakref__' of 'StkFile' objects>})
__dir__() → list

default dir() implementation

__eq__

Return self==value.

__format__()

default object formatter

__ge__

Return self>=value.

__getattribute__

Return getattr(self, name).

__gt__

Return self>value.

__hash__

Return hash(self).

__init__

Initialize self. See help(type(self)) for accurate signature.

__init_subclass__()

This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

__le__

Return self<=value.

__lt__

Return self<value.

__module__ = 'schrodinger.application.desmond.packages.msys.molfile'
__ne__

Return self!=value.

__new__()

Create and return a new object. See help(type) for accurate signature.

__reduce__()

helper for pickle

__reduce_ex__()

helper for pickle

__repr__

Return repr(self).

__setattr__

Implement setattr(self, name, value).

__sizeof__() → int

size of object in memory, in bytes

__str__

Return str(self).

__subclasshook__()

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

__weakref__

list of weak references to the object (if defined)

class schrodinger.application.desmond.packages.msys.molfile.SeqFile

Bases: object

Read csv-like files with column names in the first row

filename_extensions = 'seq'
name = 'seq'
classmethod read(path)

Open an eneseq file for reading

class Reader(path)

Bases: object

__init__(path)

Only use a direct read to determine the header for the file Otherwise, use numpy.loadtxt

natoms
nframes
__class__

alias of builtins.type

__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'schrodinger.application.desmond.packages.msys.molfile', '_parse_header': <staticmethod object>, '__init__': <function SeqFile.Reader.__init__>, 'natoms': <property object>, 'nframes': <property object>, '_get_prop': <function SeqFile.Reader._get_prop>, 'get_prop': <function SeqFile.Reader.get_prop>, 'frame': <function SeqFile.Reader.frame>, 'frames': <function SeqFile.Reader.frames>, 'at_time_near': <function SeqFile.Reader.at_time_near>, '__dict__': <attribute '__dict__' of 'Reader' objects>, '__weakref__': <attribute '__weakref__' of 'Reader' objects>, '__doc__': None})
__dir__() → list

default dir() implementation

__eq__

Return self==value.

__format__()

default object formatter

__ge__

Return self>=value.

__getattribute__

Return getattr(self, name).

__gt__

Return self>value.

__hash__

Return hash(self).

__init_subclass__()

This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

__le__

Return self<=value.

__lt__

Return self<value.

__module__ = 'schrodinger.application.desmond.packages.msys.molfile'
__ne__

Return self!=value.

__new__()

Create and return a new object. See help(type) for accurate signature.

__reduce__()

helper for pickle

__reduce_ex__()

helper for pickle

__repr__

Return repr(self).

__setattr__

Implement setattr(self, name, value).

__sizeof__() → int

size of object in memory, in bytes

__str__

Return str(self).

__subclasshook__()

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

__weakref__

list of weak references to the object (if defined)

get_prop(prop)
frame(n)
frames()
at_time_near(time)
__class__

alias of builtins.type

__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'schrodinger.application.desmond.packages.msys.molfile', '__doc__': 'Read csv-like files with column names in the first row\n ', 'filename_extensions': 'seq', 'name': 'seq', 'read': <classmethod object>, 'Reader': <class 'schrodinger.application.desmond.packages.msys.molfile.SeqFile.Reader'>, '__dict__': <attribute '__dict__' of 'SeqFile' objects>, '__weakref__': <attribute '__weakref__' of 'SeqFile' objects>})
__dir__() → list

default dir() implementation

__eq__

Return self==value.

__format__()

default object formatter

__ge__

Return self>=value.

__getattribute__

Return getattr(self, name).

__gt__

Return self>value.

__hash__

Return hash(self).

__init__

Initialize self. See help(type(self)) for accurate signature.

__init_subclass__()

This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

__le__

Return self<=value.

__lt__

Return self<value.

__module__ = 'schrodinger.application.desmond.packages.msys.molfile'
__ne__

Return self!=value.

__new__()

Create and return a new object. See help(type) for accurate signature.

__reduce__()

helper for pickle

__reduce_ex__()

helper for pickle

__repr__

Return repr(self).

__setattr__

Implement setattr(self, name, value).

__sizeof__() → int

size of object in memory, in bytes

__str__

Return str(self).

__subclasshook__()

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

__weakref__

list of weak references to the object (if defined)

schrodinger.application.desmond.packages.msys.molfile.ls

alias of schrodinger.application.desmond.packages.msys.molfile.StkFile

schrodinger.application.desmond.packages.msys.molfile.seq

alias of schrodinger.application.desmond.packages.msys.molfile.SeqFile