rstoolbox.plot.distribution_quality

rstoolbox.plot.distribution_quality(df, refdata, values, ascending, names, fig)

Locate the quantile position of each putative DesingSerie in a list of score distributions.

Parameters:
  • df (DataFrame) – Data container.
  • grid (tuple with two int) – Shape of the grid to plot the values in the figure (rows x columns).
  • refdata (DataFrame) – Data content to use as reference.
  • values (list() of str) – Contents from the data container that are expected to be plotted.
  • ascending (list() of bool) – Way the data should be sorted. True if the score is better when lower, False otherwise.
  • names (list() of str) – Columns to use as identifiers for the query data.
  • fig (Figure) – Figure into which the data is going to be plotted.
Returns:

Axes

Raises:
ValueError:If columns are requested that do not exist in the DataFrame of data and reference.
ValueError:If there isn’t a ascending definition for each value.
ValueError:If refdata or df are not DataFrame.
valueError:If the requested names do not exist in the input data.

Example:

In [1]: from rstoolbox.plot import distribution_quality
   ...: from rstoolbox.utils import load_refdata
   ...: import matplotlib.pyplot as plt
   ...: df = load_refdata('scop')
   ...: qr = pd.DataFrame([['2F4V', 'C'], ['3BFU', 'B'], ['2APJ', 'C'],
   ...:                    ['2C37', 'V'], ['2I6E', 'H']],
   ...:                   columns=['pdb', 'chain'])
   ...: qr = qr.merge(df, on=['pdb', 'chain'])
   ...: refs = []
   ...: for i, t in qr.iterrows():
   ...:     refs.append(df[(df['length'] >= (t['length'] - 5)) &
   ...:                    (df['length'] <= (t['length'] + 5))])
   ...: fig = plt.figure(figsize=(25, 6))
   ...: ax = distribution_quality(df=qr, refdata=refs,
   ...:                           values=['score', 'pack', 'avdegree',
   ...:                                   'cavity', 'psipred'],
   ...:                           ascending=[True, False, True, True, False],
   ...:                           names=['pdb', 'chain'], fig=fig)
   ...: plt.tight_layout()
   ...: 

In [2]: plt.show()

In [3]: plt.close()
../_images/distribution_quality_docs1.png