pbtools

Perform analysis on protein sequences encoded as Protein Blocks

Provide functions to compute a Mutual Information matrix from sequences.

pbtools.interaction_graph(matrix)

Create a networkx graph object from a (square) matrix.

Parameters

matrix (numpy.ndarray) –

Matrix of mutual information, the information for the edges is taken from the upper matrix

Returns

graph – The graph with MI as weighted edges and positions as nodes

Return type

networkx.Graph()

Raises

AssertionError – If the matrix is not square

pbtools.mutual_information(pos1, pos2)

Computes the Mutual Information from 2 Series of Protein Blocks.

Parameters
  • pos1 (pandas.Series) – Protein Blocks of a given sequence position.

  • pos2 (pandas.Series) – Protein Blocks of a given sequence position.

Returns

MI – Mutual Information of the 2 positions.

Return type

float

Raises

AssertionError – If Series are not provided or have different lengths.

pbtools.mutual_information_matrix(sequences)

Return the matrix of Mutual Information for all positions.

Parameters

sequences (list of str) – Sequences obtained from the file(s)

Returns

MI_matrix – Matrix of Mutual Informations.

Return type

numpy.ndarray