Miscellaneous Tools

This module defines miscellaneous utility functions.

class Everything[source]

A place for everything.

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

Returns a structured string for a given list of integers.

  • 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
In [1]: from prody.utilities import rangeString

In [2]: lint = [1, 2, 3, 4, 10, 15, 16, 17]

In [3]: rangeString(lint)
Out[3]: '1 to 4 10 15 to 17'

In [4]: rangeString(lint, sep=',', rng='-')
Out[4]: '1-4,10,15-17'

In [5]: rangeString(lint, ',', ':', exc=True)
Out[5]: '1:5,10,15:18'
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.


Returns one of scipy.linalg or numpy.linalg.

dictElement(element, prefix=None)[source]

Returnss 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.


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

startswith(this, that)[source]

Returns True if this or that starts with the other.


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.

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.


Returns the square root of a matrix.