troutpy.tl.get_gene_interaction_strength

troutpy.tl.get_gene_interaction_strength#

troutpy.tl.get_gene_interaction_strength(source_proportions, target_proportions, gene_symbol='', return_interactions=False, save=False, output_path='', format='pdf')#

Calculates the interaction strength between source and target cell types for a specified gene by multiplying the proportions of the gene in the source and target cell types. The interaction matrix can be visualized using a chord diagram, with the option to save the resulting plot.

Parameters:
  • source_proportions (DataFrame) – A DataFrame where rows represent genes and columns represent source cell types. Each value indicates the proportion of the gene in the respective source cell type.

  • target_proportions (DataFrame) – A DataFrame where rows represent genes and columns represent target cell types. Each value indicates the proportion of the gene in the respective target cell type.

  • gene_symbol (str (default: '')) – The gene symbol for which the interaction strength is to be computed and visualized (default: ‘’).

  • return_interactions (bool (default: False)) – If True, returns the interaction matrix as a NumPy array (default: False).

  • save (bool (default: False)) – If True, saves the chord diagram plot to the specified output path (default: False).

  • output_path (str (default: '')) – The directory path where the plot will be saved. If save=True, this path will be used to store the file (default: ‘’). A ‘figures’ subdirectory is created if it doesn’t exist.

  • format (str) – The file format for saving the plot (e.g., ‘pdf’, ‘png’). This is used only if save=True (default: ‘pdf’).

Return type:

None

Returns:

  • None or np.ndarray

Notes

  • The function computes the interaction matrix by multiplying the proportions of the gene in the source and target cell types.

  • The chord diagram visualizes the interaction strength between the cell types.

  • If save=True, the plot is saved in the specified format and location.