parmed.amber.offlib module

Tool for parsing and writing OFF library files to and from dictionaries of ResidueTemplate objects

class parmed.amber.offlib.AmberOFFLibrary[source]

Bases: object

Class containing static methods responsible for parsing and writing OFF libraries

Methods

id_format(filename)

Sees if an open file is an OFF library file.

parse(filename)

Parses an Amber OFF library

write(lib, dest)

Writes a dictionary of ResidueTemplate units to a file in OFF format

static id_format(filename)[source]

Sees if an open file is an OFF library file.

Parameters
filenamestr

The name of the file to see if it is an OFF file format

Returns
is_fmtbool

True if it is recognized as OFF, False otherwise

static parse(filename)[source]

Parses an Amber OFF library

Parameters
filenamestr or file-like iterable

The file name or file object to parse. If it is an iterable, it will be exhausted

Returns
residuesOrderedDict {str

Dictionary pairing residue names with their ResidueTemplate objects

Raises
ValueError if the first line does not match the file format. This line
will be consumed
IOError if filename is the name of a file that does not exist
RuntimeError if EOF is reached prematurely or other formatting issues
found
static write(lib, dest)[source]

Writes a dictionary of ResidueTemplate units to a file in OFF format

Parameters
libdict {str

Items can be either ResidueTemplate or ResidueTemplateContainer instances

deststr or file-like

Either a file name or a file-like object to write the file to