Miscellaneous Tools
This module defines miscellaneous utility functions.
- 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.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.Elementinstance. 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_dividebut 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.linalgornumpy.linalg.
- prody.utilities.misctools.intorfloat(x)[source]
Returns
int(x), orfloat(x)uponValueError.
- 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.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 withblock=Falseargument to avoid blocking behavior in non-interactive sessions. If block keyword argument is not recognized, try again without it.