Miscellaneous Tools

This module defines miscellaneous utility functions.

class prody.utilities.misctools.Everything[source]

A place for everything.

prody.utilities.misctools.addEnds(x, y, axis=0)[source]

Finds breaks in x, extends them by one position and adds nan at the corresponding position in y. x needs to be an 1-D array, y can be a matrix of column (or row) vectors

prody.utilities.misctools.alnum(string, alt='_', trim=False, single=False)[source]

Replace non alpha numeric characters with alt. If trim is True remove preceding and trailing arg characters. If single is True, contain only a single joining alt character.

prody.utilities.misctools.bin2dec(x)[source]

Converts the binary array to decimal.

prody.utilities.misctools.checkIdentifiers(*pdb, **kwargs)[source]

Check whether pdb identifiers are valid, and replace invalid ones with None in place.

prody.utilities.misctools.countBytes(arrays, base=False)[source]

Returns total number of bytes consumed by elements of arrays. If base is True, use number of bytes from the base array.

prody.utilities.misctools.decToHybrid36(x, resnum=False)[source]

Convert a regular decimal number to a string in hybrid36 format

prody.utilities.misctools.dictElement(element, prefix=None, number_multiples=False)[source]

Returns a dictionary built from the children of element, which must be a xml.etree.ElementTree.Element instance. Keys of the dictionary are tag of children without the prefix, or namespace. Values depend on the content of the child. If a child does not have any children, its text attribute is the value. If a child has children, then the child is the value.

prody.utilities.misctools.div0(a, b, defval=0.0)[source]

Performs true_divide but ignores the error when division by zero (result is set to zero instead).

prody.utilities.misctools.fixArraySize(arr, sizes, value=0)[source]

Makes sure that arr is of sizes. If not, pad with value.

prody.utilities.misctools.hybrid36ToDec(x, resnum=False)[source]

Convert string in hybrid36 format to a regular decimal number

prody.utilities.misctools.impLoadModule(name, cmd, path)[source]

Returns an an imported module equivalent to imp.

prody.utilities.misctools.importDec()[source]

Returns an imported module equivalent to numpy testing decorators.

prody.utilities.misctools.importLA()[source]

Returns one of scipy.linalg or numpy.linalg.

prody.utilities.misctools.intorfloat(x)[source]

Returns int(x), or float(x) upon ValueError.

prody.utilities.misctools.isPDB(string, pos=0, endpos=9223372036854775807)

Matches zero or more characters at the beginning of the string.

prody.utilities.misctools.isSymmetric(M, rtol=1e-05, atol=1e-08)[source]

Checks if the matrix is symmetric.

prody.utilities.misctools.isURL(string, pos=0, endpos=9223372036854775807)

Matches zero or more characters at the beginning of the string.

prody.utilities.misctools.makeSymmetric(M)[source]

Makes sure the matrix is symmetric.

prody.utilities.misctools.rangeString(lint, sep=' ', rng=' to ', exc=False, pos=True)[source]

Returns a structured string for a given list of integers.

Parameters:
  • lint – integer list or array

  • sep – range or number separator

  • rng – range symbol

  • exc – set True if range symbol is exclusive

  • pos – only consider zero and positive integers

prody.utilities.misctools.showFigure()[source]

Call show() function with block=False argument to avoid blocking behavior in non-interactive sessions. If block keyword argument is not recognized, try again without it.

prody.utilities.misctools.sqrtm(matrix)[source]

Returns the square root of a matrix.

prody.utilities.misctools.startswith(this, that)[source]

Returns True if this or that starts with the other.

prody.utilities.misctools.wmean(array, weights, axis=None)[source]

Calculates the weighted average of array given axis.