tfcomb.analysis module

tfcomb.analysis.orientation(rules, verbosity=1)[source]

Perform orientation analysis on the TF pairs in a directional / strand-specific table. The analysis counts different scenarios depending on the input.

If the input matrix is symmetric, the analysis contains two scenarios:

1. Same:      ⟝(TF1+)⟶  ⟝(TF2+)⟶  =  ⟝(TF2+)⟶  ⟝(TF1+)⟶  =  ⟵(TF1-)⟞  ⟵(TF2-)⟞  =  ⟵(TF2-)⟞  ⟵(TF1-)⟞
2. Opposite:  ⟝(TF1+)⟶  ⟵(TF2-)⟞  =  ⟝(TF2+)⟶  ⟵(TF1-)⟞  =  ⟵(TF1-)⟞  ⟝(TF2+)⟶  =  ⟵(TF2-)⟞  ⟝(TF1+)⟶

If the input is directional, the analysis contains four different scenarios:

1. TF1-TF2:     ⟝(TF1+)⟶  ⟝(TF2+)⟶   =   ⟵(TF2-)⟞  ⟵(TF1-)⟞
2. TF2-TF1:     ⟝(TF2+)⟶  ⟝(TF1+)⟶   =   ⟵(TF1-)⟞  ⟵(TF2-)⟞
3. convergent:  ⟝(TF1+)⟶  ⟵(TF2-)⟞   =   ⟝(TF2+)⟶  ⟵(TF1-)⟞
4. divergent:   ⟵(TF1-)⟞  ⟝(TF2+)⟶   =   ⟵(TF2-)⟞  ⟝(TF1+)⟶
Parameters:
  • rules (pd.DataFrame) – The .rules output of a CombObj analysis.

  • verbosity (int) – A value between 0-3 where 0 (only errors), 1 (info), 2 (debug), 3 (spam debug). Default: 1.

Returns:

  • An OrientationAnalysis object (subclass of pd.DataFrame). The table contains frequencies of pairs related to each scenario.

  • The dataframe has the following columns

    • TF1: name of the first TF in pair

    • TF2: name of the second TF in pair

    • TF1_TF2_count: The total count of TF1-TF2 co-occurring pairs

    • If symmetric:
      • Same

      • Opposite

    • If directional:
      • TF1_TF2

      • TF2_TF1

      • convergent

      • divergent

    • std: Standard deviation of scenario frequencies

    • pvalue: A chi-square test to test the hypothesis that the scenarios are equally distributed

class tfcomb.analysis.OrientationAnalysis(*args: Any, **kwargs: Any)[source]

Bases: DataFrame

Analysis of the orientation of TF co-ocurring pairs

plot_heatmap(yticklabels=False, figsize=(6, 6), save=None, **kwargs)[source]

Plot a heatmap of orientation scenarios for the output of the orientation analysis.

Parameters:
  • yticklabels (bool, optional) – Show yticklabels (TF-pairs) in plot. Default: False.

  • figsize (tuple) – The size of the output heatmap. Default: (6,6)

  • save (str, optional) – Save the plot to the file given in ‘save’. Default: None.

  • kwargs (arguments) – Any additional arguments are passed to sns.clustermap.

Return type:

seaborn.matrix.ClusterGrid