visualization
Visualization class
- class idpet.visualization.Visualization(analysis)[source]
Bases:
object
Visualization class for ensemble analysis.
- Parameters:
analysis (EnsembleAnalysis): An instance of EnsembleAnalysis providing data for visualization.
- alpha_angles(bins=50, save=False, ax=None)[source]
Alpha angles: Angles between four consecutive Cα atoms along the protein backbone. This method calculates the alpha angles for each ensemble in the analysis and plots their distribution
- Return type:
Axes
Parameters
- binsint
The number of bins for the histogram. Default is 50.
- savebool, optional
If True, the plot will be saved as an image file. Default is False.
- axplt.Axes, optional
The axes on which to plot. Default is None, which creates a new figure and axes.
Returns
- plt.Axes
The Axes object containing the plot.
- asphericity(bins=50, hist_range=None, violin_plot=True, summary_stat='mean', dpi=96, save=False, color='lightblue', multiple_hist_ax=False, x_ticks_rotation=45, ax=None)[source]
Plot asphericity distribution in each ensemble. Asphericity is calculated based on the gyration tensor.
- Return type:
Axes
Parameters
- binsint, optional
The number of bins for the histogram. Default is 50.
- hist_range: Tuple, optional
A tuple with a min and max value for the histogram range. Default is None, which corresponds to using the min a max value across all data.
- violin_plotbool, optional
If True, a violin plot is visualized. Default is True.
- summary_statstr, optional
Specifies whether to display the “mean”, “median”, or “both” as reference lines on the plots. This applies when violin_plot is True or when multiple_hist_ax is True for histograms.
- dpi: int, optional
The DPI (dots per inch) of the output figure. Default is 96.
- savebool, optional
If True, the plot will be saved as an image file in the specified directory. Default is False.
- colorstr, optional
Color of the violin plot. Default is lightblue.
- multiple_hist_axbool, optional
If True, each histogram will be plotted on separate axes. Default is False.
- x_ticks_rotationint, optional
The rotation angle of the x-axis tick labels for the violin plot. Default is 45
- axUnion[None, plt.Axes, np.ndarray, List[plt.Axes]], optional
The axes on which to plot. Default is None, which creates a new figure and axes.
Returns
- plt.Axes
The Axes object containing the plot.
- comparison_matrix(score, featurization_params={}, bootstrap_iters=None, bootstrap_frac=1.0, bootstrap_replace=True, confidence_level=0.95, significance_level=0.05, bins=50, random_seed=None, verbose=False, ax=None, figsize=(6.0, 5.0), dpi=100, cmap='viridis_r', title=None, cbar_label=None, textcolors=('black', 'white'))[source]
Generates and visualizes the pairwise comparison matrix for the ensembles. This function computes the comparison matrix using the specified score type and feature. It then visualizes the matrix using a heatmap.
- Return type:
dict
Parameters:
score, featurization_params, bootstrap_iters, bootstrap_frac, bootstrap_replace, bins, random_seed, verbose:
See the documentation of EnsembleAnalysis.comparison_scores for more information about these arguments.
- ax: Union[None, plt.Axes], optional
Axes object where to plot the comparison heatmap. If None (the default value) is provided, a new Figure will be created.
- figsize: Tuple[int], optional
The size of the figure for the heatmap. Default is (6.00, 5.0). Only takes effect if ax is not None.
- dpi: int, optional
DPIs of the figure for the heatmap. Default is 100. Only takes effect if ax is not None.
confidence_level, significance_level, cmap, title, cbar_label, textcolors:
See the documentation of dpet.visualization.plot_comparison_matrix for more information about these arguments.
Returns:
- results: dict
- A dictionary containing the following keys:
ax: the Axes object with the comparison matrix heatmap. scores: comparison matrix. See EnsembleAnalysis.comparison_scores
for more information.
codes: codes of the ensembles that were compared. fig: Figure object, only returned when a new figure is created
inside this function.
Notes:
The comparison matrix is annotated with the scores, and the axes are labeled with the ensemble labels.
- contact_prob_maps(log_scale=True, avoid_zero_count=False, threshold=0.8, dpi=96, color='Blues', save=False, ax=None)[source]
Plot the contact probability map based on the threshold.
- Return type:
Union
[List
[Axes
],ndarray
]
Parameters
- log_scalebool, optional
If True, use log scale range. Default is True.
- avoid_zero_count: bool, optional
If True, avoid contacts with zero counts by adding to all contacts a pseudo count of 1e-6.
- thresholdfloat, optional
Determining the threshold for calculating the contact frequencies. Default is 0.8 [nm].
- dpiint, optional
The DPI (dots per inch) of the output figure. Default is 96.
- colorstr, optional
The colormap to use for the contact probability map. Default is ‘Blues’.
- savebool, optional
If True, the plot will be saved as an image file in the specified directory. Default is False.
- axUnion[None, List[plt.Axes], np.ndarray], optional
The axes on which to plot. If None, new axes will be created. Default is None.
Returns
- Union[List[plt.Axes], np.ndarray]
Returns a list or array of Axes objects representing the subplot grid.
- dimensionality_reduction_scatter(color_by='rg', save=False, ax=None, kde_by_ensemble=False, dpi=96, size=10, plotly=False, cmap_label='viridis', n_components=2)[source]
Plot the results of dimensionality reduction using the method specified in the analysis.
- Return type:
List
[Axes
]
Parameters
- color_bystr, optional
The feature extraction method used for coloring points in the scatter plot. Options are “rg”, “prolateness”, “asphericity”, “sasa”, and “end_to_end”. Default is “rg”.
- savebool, optional
If True, the plot will be saved in the data directory. Default is False.
- axUnion[None, List[plt.Axes]], optional
A list of Axes objects to plot on. Default is None, which creates new axes.
- kde_by_ensemblebool, optional
If True, the KDE plot will be generated for each ensemble separately. If False, a single KDE plot will be generated for the concatenated ensembles. Default is False.
- dpiint, optional
The DPI (dots per inch) of the output figure. Default is 96.
- sizeint, optional
The size of the points in the scatter plot. Default is 10.
- plotlybool, optional
If True, the plot will be generated using Plotly. Default is False.
- cmap_labelstr, optional
The colormap to use for the feature-colored labels. Default is ‘viridis’.
- n_componentsint, optional
The number of components for dimensionality reduction.
Returns
- List[plt.Axes]
List containing Axes objects for the scatter plot of original labels, clustering labels, and feature-colored labels, respectively.
Raises
- NotImplementedError
If the dimensionality reduction method specified in the analysis is not supported.
- distance_maps(min_sep=2, max_sep=None, distance_type='both', get_names=True, inverse=False, color='plasma', dpi=96, save=False, ax=None)[source]
Plot CA and/or COM distance maps for one or more protein ensembles.
- Return type:
List
[Axes
]
Parameters
- min_sepint, default=2
Minimum sequence separation between residues to consider.
- max_sepint or None, optional
Maximum sequence separation. If None, no upper limit is applied.
- distance_type{‘ca’, ‘com’, ‘both’}, default=’both’
Specifies which type of distance map(s) to plot.
- get_namesbool, default=True
Whether to return feature names from featurization (used internally).
- inversebool, default=False
If True, compute and plot 1/distance instead of distance.
- colorstr, default=’plasma’
Colormap to use for the distance maps.
- dpiint, default=96
The DPI (dots per inch) of the output figure.
- savebool, default=False
If True, the plot will be saved as an image file in the specified directory.
- axmatplotlib Axes or array-like, optional
Axes on which to plot. If None, a new figure and axes will be created.
Returns
- List[matplotlib.axes.Axes]
List of axes objects used for plotting.
- end_to_end_distances(rg_norm=False, bins=50, hist_range=None, violin_plot=True, summary_stat='mean', dpi=96, save=False, color='lightblue', multiple_hist_ax=False, x_ticks_rotation=45, ax=None)[source]
Plot end-to-end distance distributions.
- Return type:
Union
[Axes
,List
[Axes
]]
Parameters
- rg_norm: bool, optional
Normalize end-to-end distances on the average radius of gyration.
- binsint, optional
The number of bins for the histogram. Default is 50.
- hist_range: Tuple, optional
A tuple with a min and max value for the histogram. Default is None, which corresponds to using the min a max value across all data.
- violin_plotbool, optional
If True, a violin plot is visualized. Default is True.
- summary_stat: str, optional
Specifies whether to display the “mean”, “median”, or “both” as reference lines on the plots. This applies when violin_plot is True or when multiple_hist_ax is True for histograms.
- dpiint, optional
The DPI (dots per inch) of the output figure. Default is 96.
- savebool, optional
If True, the plot will be saved as an image file in the specified directory. Default is False.
- axUnion[None, plt.Axes, np.ndarray, List[plt.Axes]], optional
The axes on which to plot. Default is None, which creates a new figure and axes.
- color: str, optional
Change the color of the violin plot. Default is lightblue.
- multiple_hist_ax: bool, optional
If True, it will plot each histogram in a different axis.
- x_ticks_rotation: int, optional
The rotation angle of the x-axis tick labels for the violin plot. Default is 45
Returns
- Union[plt.Axes, List[plt.Axes]]
The Axes object or a list of Axes objects containing the plot(s).
- global_sasa(bins=50, hist_range=None, violin_plot=True, summary_stat='mean', save=False, dpi=96, color='lightblue', multiple_hist_ax=False, x_ticks_rotation=45, ax=None)[source]
Plot the distribution of SASA for each conformation within the ensembles.
- Return type:
Axes
Parameters
- binsint, optional
The number of bins for the histogram. Default is 50.
- hist_range: Tuple, optional
A tuple with a min and max value for the histogram. Default is None, which corresponds to using the min a max value across all data.
- violin_plotbool, optional
If True, a violin plot is visualized. Default is True.
- summary_stat: str, optional
Specifies whether to display the “mean”, “median”, or “both” as reference lines on the plots. This applies when violin_plot is True or when multiple_hist_ax is True for histograms.
- dpiint, optional
The DPI (dots per inch) of the output figure. Default is 96.
- savebool, optional
If True, the plot will be saved as an image file in the specified directory. Default is False.
- colorstr, optional
Color of the violin plot. Default is lightblue.
- multiple_hist_axbool, optional
If True, it will plot each histogram in a different axis.
- x_ticks_rotationint, optional
The rotation angle of the x-axis tick labels for the violin plot. Default is 45.
- axUnion[None, plt.Axes, np.ndarray, List[plt.Axes]], optional
The matplotlib Axes object on which to plot. If None, a new Axes object will be created. Default is None.
Returns
- plt.Axes
The Axes object containing the plot.
- pca_1d_histograms(save=False, sel_components=0, bins=30, ax=None, dpi=96)[source]
Plot 1D histogram when the dimensionality reduction method is “pca” or “kpca”.
- Return type:
List
[Axes
]
Parameters
- save: bool, optional
If True the plot will be saved in the data directory. Default is False.
- dim: int, optional
To select the specific component (dimension) for which you want to visualize the histogram distribution. Default is 0 (first principal component in PCA).
- n_bins: int, optional
Number of bins in the histograms.
- ax: Union[None, List[plt.Axes]], optional
A list of Axes objects to plot on. Default is None, which creates new axes.
- dpiint, optional
For changing the quality and dimension of the output figure. Default is 96.
Returns
- List[plt.Axes]
A list of plt.Axes objects representing the subplots created.
- pca_2d_landscapes(save=False, sel_components=[0, 1], ax=None, dpi=96)[source]
Plot 2D landscapes when the dimensionality reduction method is “pca” or “kpca”.
- Return type:
List
[Axes
]
Parameters
- save: bool, optional
If True the plot will be saved in the data directory. Default is False.
- sel_components: List[int], optional
Indices of the selected principal components to analyze, starting from 0. The default components are the first and second.
- ax: Union[None, List[plt.Axes]], optional
A list of Axes objects to plot on. Default is None, which creates new axes.
- dpiint, optional
For changing the quality and dimension of the output figure. Default is 96.
Returns
- List[plt.Axes]
A list of plt.Axes objects representing the subplots created.
- pca_cumulative_explained_variance(save=False, dpi=96, ax=None)[source]
Plot the cumulative variance. Only applicable when the dimensionality reduction method is “pca”.
- Return type:
Axes
Parameters
- save: bool, optional
If True, the plot will be saved in the data directory. Default is False.
- dpi: int, optional
The DPI (dots per inch) of the output figure. Default is 96.
- ax: Union[None, plt.Axes], optional
An Axes object to plot on. Default is None, which creates a new axes.
Returns
- plt.Axes, cumvar
The Axes object for the cumulative explained variance plot and a numpy array with the cumulative variance.
- pca_residue_correlation(sel_components=[0, 1, 2], save=False, ax=None, dpi=96, cmap='RdBu', cmap_range=None, scale_loadings=False)[source]
Plot the loadings (weights) of each pair of residues for a list of principal components (PCs).
- Return type:
List
[Axes
]
Parameters
- sel_componentsList[int], optional
A list of indices specifying the PC to include in the plot.
- savebool, optional
If True, the plot will be saved as an image file. Default is False.
- axUnion[None, List[plt.Axes]], optional
A list of Axes objects to plot on. Default is None, which creates new axes.
- dpiint, optional
For changing the quality and dimension of the output figure. Default is 96.
- cmap: str, optional
Matplotlib colormap name.
- cmap_range: Union[None, Tuple[float]], optional
Range of the colormap. Defaults to ‘None’, the range will be identified automatically. If a tuple, the first and second elements are the min. and max. of the range.
- scale_loadings: bool, optional
Scale loadings by explained variance. Some definitions use correlation coefficients as loadings, when input features are standardized.
Returns
- List[plt.Axes]
A list of plt.Axes objects representing the subplots created.
Notes
This method generates a correlation plot showing the weights of pairwise residue distances for selected PCA dimensions. The plot visualizes the correlation between residues based on the PCA weights.
The analysis is only valid on PCA and kernel PCA dimensionality reduction with ‘ca_dist’ feature extraction.
- pca_rg_correlation(save=False, ax=None, dpi=96, sel_components=0)[source]
Examine and plot the correlation between PC dimension 1 and the amount of Rg. Typically high correlation can be detected in case of IDPs/IDRs .
- Return type:
List
[Axes
]
Parameters
- savebool, optional
If True, the plot will be saved in the data directory. Default is False.
- ax: Union[None, List[plt.Axes]], optional
A list of Axes objects to plot on. Default is None, which creates new axes.
- dpiint, optional
For changing the quality and dimension of the output figure. Default is 96.
- sel_components: int, optional
Index of the selected principal component to analyze, defaults to 0 (first principal component).
Returns
- List[plt.Axes], dict
A list of plt.Axes objects representing the subplots created and a dictionary with all the raw data being plotted.
- per_residue_mean_sasa(probe_radius=0.14, n_sphere_points=960, figsize=(15, 5), dpi=96, size=3, auto_xticks=True, xtick_interval=5, pointer=None, save=False, ax=None)[source]
Plot the average solvent-accessible surface area (SASA) for each residue among all conformations in an ensemble. This function uses the Shrake–Rupley algorithm as implemented in MDTraj (mdtraj.shrake_rupley) to compute the solvent-accessible surface area.
- Return type:
Axes
Parameters
- probe_radius: float, optional
The radius of the probe sphere used in the Shrake–Rupley algorithm. Default is 0.14 nm.
- n_sphere_points: int, optional
The number of points representing the surface of each atom, higher values leads to more accuracy. Default is 960.
- figsize: Tuple[int, int], optional
Tuple specifying the size of the figure. Default is (15, 5).
- dpi: int, optional
The DPI (dots per inch) of the output figure. Default is 96.
- size: int, optional
The size of the marker points. Default is 3.
- auto_xticks: bool, optional
If True, use matplotlib default xticks. Default is True.
- xtick_interval: int, optional
If auto_xticks is False, this parameter defines the interval between displayed residue indices on the x-axis. Always start with 1, followed by every xtick_interval residues (e.g., 1, 5, 10, 15, … if `xtick_interval`=5).
- pointer: List[int], optional
List of desired residues to highlight with vertical dashed lines. Default is None.
- savebool, optional
If True, the plot will be saved as an image file. Default is False.
- axUnion[None, plt.Axes], optional
The matplotlib Axes object on which to plot. If None, a new Axes object will be created. Default is None.
Returns
- plt.Axes
Axes object containing the plot.
- plot_histogram_grid(feature='ca_dist', ids=None, n_rows=2, n_cols=3, subplot_width=2.0, subplot_height=2.2, bins=None, dpi=90, save=False)[source]
Plot a grid if histograms for distance or angular features. Can only be used when analyzing ensembles of proteins with same number of residues. The function will create a new matplotlib figure for histogram grid.
- Return type:
Axes
Parameters
- feature: str, optional
Feature to analyze. Must be one of ca_dist (Ca-Ca distances), a_angle (alpha angles), phi or psi (phi or psi backbone angles).
- ids: Union[list, List[list]], optional
Residue indices (integers starting from zero) to define the residues to analyze. For angular features it must be a 1d list with N indices of the residues. For distance features it must be 2d list/array of shape (N, 2) in which N is the number of residue pairs to analyze are 2 their indices. Each of the N indices (or pair of indices) will be plotted in an histogram of the grid. If this argument is not provided, random indices will be sampled, which is useful for quickly comparing the distance or angle distributions of multiple ensembles.
- n_rows: int, optional
Number of rows in the histogram grid.
- n_cols: int, optional
Number of columns in the histogram grid.
- subplot_width: int, optional
Use to specify the Matplotlib width of the figure. The size of the figure will be calculated as: figsize = (n_cols*subplot_width, n_rows*subplot_height).
- subplot_height: int, optional
See the subplot_width argument.
- bins: Union[str, int], optional
Number of bins in all the histograms.
- dpi: int, optional
The DPI (dots per inch) of the output figure. Default is 96.
- save: bool, optional
If True, the plot will be saved as an image file in the specified directory. Default is False.
Returns
- ax: plt.Axes
The Axes object for the histogram grid.
- plot_rama_grid(ids=None, n_rows=2, n_cols=3, subplot_width=2.0, subplot_height=2.2, dpi=90, save=False)[source]
Plot a grid if Ramachandran plots for different residues. Can only be be used when analyzing ensembles of proteins with same number of residues. The function will create a new matplotlib figure for the scatter plot grid.
- Return type:
Axes
Parameters
- ids: Union[list, List[list]], optional
Residue indices (integers starting from zero) to define the residues to analyze. For angular features it must be a 1d list with N indices of the residues. Each of the N indices will be plotted in an scatter plot in the grid. If this argument is not provided, random indices will be sampled, which is useful for quickly comparing features of multiple ensembles.
- n_rows: int, optional
Number of rows in the scatter grid.
- n_cols: int, optional
Number of columns in the scatter grid.
- subplot_width: int, optional
Use to specify the Matplotlib width of the figure. The size of the figure will be calculated as: figsize = (n_cols*subplot_width, n_rows*subplot_height).
- subplot_height: int, optional
See the subplot_width argument.
- dpi: int, optional
The DPI (dots per inch) of the output figure. Default is 96.
- savebool, optional
If True, the plot will be saved as an image file in the specified directory. Default is False.
Returns
- ax: plt.Axes
The Axes object for the scatter plot grid.
- prolateness(bins=50, hist_range=None, violin_plot=True, summary_stat='mean', dpi=96, save=False, color='lightblue', multiple_hist_ax=False, x_ticks_rotation=45, ax=None)[source]
Plot prolateness distribution in each ensemble. Prolateness is calculated based on the gyration tensor.
- Return type:
Axes
Parameters
- binsint, optional
The number of bins for the histogram. Default is 50.
- hist_rangeTuple, optional
A tuple with a min and max value for the histogram. Default is None, which corresponds to using the min a max value across all data.
- violin_plotbool, optional
If True, a violin plot is visualized. Default is True.
- summary_statstr, optional
Specifies whether to display the “mean”, “median”, or “both” as reference lines on the plots. This applies when violin_plot is True or when multiple_hist_ax is True for histograms.
- savebool, optional
If True, the plot will be saved as an image file in the specified directory. Default is False.
- colorstr, optional
Color of the violin plot. Default is lightblue.
- multiple_hist_axbool, optional
If True, each histogram will be plotted on separate axes. Default is False.
- x_ticks_rotationint, optional
The rotation angle of the x-axis tick labels for the violin plot. Default is 45
- dpiint, optional
The DPI (dots per inch) of the output figure. Default is 96.
- axUnion[None, plt.Axes, np.ndarray, List[plt.Axes]], optional
The axes on which to plot. Default is None, which creates a new figure and axes.
Returns
- plt.Axes
The Axes object containing the plot.
- radius_of_gyration(bins=50, hist_range=None, multiple_hist_ax=False, violin_plot=True, x_ticks_rotation=45, summary_stat='mean', color='lightblue', dpi=96, save=False, ax=None)[source]
Plot the distribution of the radius of gyration (Rg) within each ensemble.
- Return type:
Union
[Axes
,List
[Axes
]]
Parameters
- binsint, optional
The number of bins for the histogram. Default is 50.
- hist_rangeTuple, optional
A tuple with a min and max value for the histogram. Default is None, which corresponds to using the min and max value across all data.
- multiple_hist_ax: bool, optional
If True, it will plot each histogram in a different axis.
- violin_plotbool, optional
If True, a violin plot is visualized. Default is True.
- x_ticks_rotationint, optional
The rotation angle of the x-axis tick labels for the violin plot. Default is 45
- summary_stat: str, optional
Specifies whether to display the “mean”, “median”, or “both” as reference lines on the plots. This applies when violin_plot is True or when multiple_hist_ax is True for histograms.
- colorstr, optional
Color of the violin plot. Default is lightblue.
- dpiint, optional
The DPI (dots per inch) of the output figure. Default is 96.
- savebool, optional
If True, the plot will be saved as an image file. Default is False.
- axUnion[None, plt.Axes, np.ndarray, List[plt.Axes]], optional
The axes on which to plot. If None, new axes will be created. Default is None.
Returns
- Union[plt.Axes, List[plt.Axes]]
Returns a single Axes object or a list of Axes objects containing the plot(s).
Notes
This method plots the distribution of the radius of gyration (Rg) within each ensemble in the analysis.
The Rg values are binned according to the specified number of bins (bins) and range (hist_range) and displayed as histograms. Additionally, dashed lines representing the mean and median Rg values are overlaid on each histogram.
- ramachandran_plots(two_d_hist=True, bins=(-180, 180, 80), dpi=96, color='viridis', log_scale=True, save=False, ax=None)[source]
Ramachandran plot. If two_d_hist=True it returns a 2D histogram for each ensemble. If two_d_hist=False it returns a simple scatter plot for all ensembles in one plot.
- Return type:
Union
[List
[Axes
],Axes
]
Parameters
- two_d_histbool, optional
If True, it returns a 2D histogram for each ensemble. Default is True.
- binstuple, optional
You can customize the bins for 2D histogram. Default is (-180, 180, 80).
- log_scalebool, optional
If True, the histogram will be plotted on a logarithmic scale. Default is True.
- colorstr, optional
The colormap to use for the 2D histogram. Default is ‘viridis’.
- dpiint, optional
The DPI (dots per inch) of the output figure. Default is 96.
- savebool, optional
If True, the plot will be saved as an image file in the specified directory. Default is False.
- axUnion[None, plt.Axes, np.ndarray, List[plt.Axes]], optional
The axes on which to plot. If None, new axes will be created. Default is None.
Returns
- Union[List[plt.Axes], plt.Axes]
If two_d_hist=True, returns a list of Axes objects representing the subplot grid for each ensemble. If two_d_hist=False, returns a single Axes object representing the scatter plot for all ensembles.
- relative_dssp_content(dssp_code='H', dpi=96, auto_xticks=False, xtick_interval=5, figsize=(10, 5), save=False, ax=None)[source]
Plot the relative ss content in each ensemble for each residue.
- Return type:
Axes
Parameters
- dssp_codestr, optional
The selected dssp code , it could be selected between ‘H’ for Helix, ‘C’ for Coil and ‘E’ for strand. It works based on the simplified DSSP codes
- dpiint, optional
The DPI (dots per inch) of the output figure. Default is 96.
- auto_xticks: bool, optional
If True, use matplotlib default xticks.
- xtick_interval: int, optional
If auto_xticks is False, this parameter defines the interval between displayed residue indices on the x-axis. Residue 1 is always included,followed by every xtick_interval residues (e.g., 1, 5, 10, 15 if `xtick_interval`=5).
- figsizeTuple[float, float], optional
The size of the figure in inches. Default is (10, 5).
- savebool, optional
If True, the plot will be saved as an image file in the specified directory. Default is False.
- axplt.Axes, optional
The axes on which to plot. Default is None, which creates a new figure and axes.
Returns
- plt.Axes
The Axes object containing the plot.
- rg_vs_asphericity(dpi=96, save=False, size=4, ax=None, verbose=True)[source]
Plots the Rg versus Asphericity and calculates the pearson correlation coefficient to evaluate the correlation between Rg and Asphericity.
- Return type:
Axes
Parameters
- dpi: int, optional
The DPI (dots per inch) of the output figure. Default is 96.
- savebool, optional
If True, the plot will be saved as an image file in the specified directory. Default is False.
- size: int, optional
The size of the scatter points. Default is 4.
- ax: plt.Axes, optional
The axes on which to plot. Default is None, which creates a new figure and axes.
- verbose: bool, optional
Verbosity for the output of the method. Showin the Pearson correlation coefficient for each ensemble.
Returns
- plt.Axes
The Axes object containing the plot.
- rg_vs_prolateness(dpi=96, size=4, save=False, ax=None, verbose=True)[source]
Plot the Rg versus Prolateness and get the Pearson correlation coefficient to evaluate the correlation between Rg and Prolateness.
- Return type:
Axes
Parameters
- dpi: int, optional
The DPI (dots per inch) of the output figure. Default is 96.
- size: int, optional
The size of the scatter marker points. Default is 4.
- save: bool, optional
If True, the plot will be saved as an image file in the specified directory. Default is False.
- ax: plt.Axes, optional
The axes on which to plot. Default is None, which creates a new figure and axes.
- verbose: bool, optional
Verbosity for the output of the method.
Returns
- plt.Axes
The Axes object containing the plot.
- site_specific_flexibility(pointer=None, auto_xticks=False, xtick_interval=5, dpi=96, figsize=(15, 5), save=False, ax=None)[source]
Generate a plot of the site-specific flexibility parameter.
This plot shows the site-specific measure of disorder, which is sensitive to local flexibility based on the circular variance of the Ramachandran angles φ and ψ for each residue in the ensemble. The score ranges from 0 for identical dihedral angles for all conformers at the residue i to 1 for a uniform distribution of dihedral angles at the residue i. (For more information about this method look at here https://onlinelibrary.wiley.com/doi/full/10.1002/pro.4906)
- Return type:
Axes
Parameters
- pointer: List[int], optional
A list of desired residues. Vertical dashed lines will be added to point to these residues. Default is None.
- auto_xticks: bool, optional
If True, use matplotlib default xticks.
- xtick_interval: int, optional
If auto_xticks is False, this parameter defines the interval between displayed residue indices on the x-axis. Always start with 1, followed by every xtick_interval residues (e.g., 1, 5, 10, 15, … if `xtick_interval`=5).
- figsize: Tuple[int, int], optional
The size of the figure. Default is (15, 5).
- dpi: int, optional
The DPI (dots per inch) of the output figure. Default is 96.
- savebool, optional
If True, the plot will be saved as an image file. Default is False.
- axUnion[None, plt.Axes], optional
The matplotlib Axes object on which to plot. If None, a new Axes object will be created. Default is None.
Returns
- plt.Axes
The matplotlib Axes object containing the plot.
- site_specific_order(pointer=None, auto_xticks=True, xtick_interval=5, dpi=96, figsize=(15, 5), save=False, ax=None)[source]
Generate a plot of the site-specific order parameter. The function computes and plots per-residue order parameters that quantify how consistently each residue’s backbone orientation is aligned with the rest of the chain across all conformers in an ensemble. The result is a per-residue value between 0 and 1: values near 1 indicate high orientational order (rigid or structured regions), while values near 0 reflect disorder (flexible or unstructured regions). This measure captures long-range orientational correlations in the backbone and is particularly useful for detecting weakly ordered segments in intrinsically disordered proteins. (For more information about this method look at here https://onlinelibrary.wiley.com/doi/full/10.1002/pro.4906)
- Return type:
Axes
Parameters
- pointer: List[int], optional
A list of desired residues. Vertical dashed lines will be added to point to these residues. Default is None.
- auto_xticks: bool, optional
If True, use matplotlib default xticks.
- xtick_interval: int, optional
If auto_xticks is False, this parameter defines the interval between displayed residue indices on the x-axis. Always start with 1, followed by every xtick_interval residues (e.g., 1, 5, 10, 15, … if `xtick_interval`=5).
- figsize: Tuple[int, int], optional
The size of the figure. Default is (15, 5).
- savebool, optional
If True, the plot will be saved as an image file. Default is False.
- axUnion[None, plt.Axes], optional
The matplotlib Axes object on which to plot. If None, a new Axes object will be created. Default is None.
Returns
- plt.Axes
The matplotlib Axes object containing the plot.
- idpet.visualization.plot_comparison_matrix(ax, comparison_out, codes, confidence_level=0.95, significance_level=0.05, cmap='viridis_r', title='New Comparison', cbar_label='score', textcolors=('black', 'white'))[source]
Plot a matrix with all-vs-all comparison scores of M ensembles as a heatmap. If plotting the results of a regular all-vs-all analysis (no bootstraping involved), it will just plot the M x M comparison scores, with empty values on the diagonal. If plotting the results of an all-vs-all analysis with bootstrapping it will plot the M x M confidence intervals for the scores. The intervals are obtained by using the ‘percentile’ method. Additionally, it will plot an asterisk for those non-diagonal entries in for which the inter-ensemble scores are significantly higher than the intra-ensemble scores according to a Mann–Whitney U test.
Parameters
- ax: plt.Axes
Axes object where the heatmap should be created.
- comparison_out: dict
A dictionary containing the output of the comparison_scores method of the dpet.ensemble_analysis.EnsembleAnalysis class. It must contain the following key-value pairs: scores: NumPy array with shape (M, M, B) containing the comparison scores for M ensembles and B bootstrap iterations. If no bootstrap analysis was performed, B = 1, otherwise it will be B > 1. p_values (optional): used only when a bootstrap analysis was performed. A (M, M) NumPy array storiging the p-values obtained by comparing with a statistical test the inter-ensemble and intra-ensemble comparison scores.
- codes: List[str]
List of strings with the codes of the ensembles.
- confidence_level: float, optional
Condifence level for the bootstrap intervals of the comparison scores.
- significance_level: float, optional
Significance level for the statistical test used to compare inter and intra-ensemble comparison scores.
- cmap: str, optional
Matplotlib colormap name to use in the heatmap.
- title: str, optional
Title of the heatmap.
- cbar_label: str, optional
Label of the colorbar.
- textcolors: Union[str, tuple], optional
Color of the text for each cell of the heatmap, specified as a string. By providing a tuple with two elements, the two colors will be applied to cells with color intensity above/below a certain threshold, so that ligher text can be plotted in darker cells and darker text can be plotted in lighter cells.
Returns
- ax: plt.Axes
The same updated Axes object from the input. The comparison_out will be updated to store confidence intervals if performing a bootstrap analysis.
Notes
The comparison matrix is annotated with the scores, and the axes are labeled with the ensemble labels.
- idpet.visualization.plot_histogram(ax, data, labels, bins=50, range=None, title='Histogram', xlabel='x', ylabel='Density', location=None)[source]
Plot an histogram for different features.
Parameters
- ax: plt.Axes
Matplotlib axis object where the histograms will be for plotted.
- data: List[np.array]
List of NumPy array storing the data to be plotted.
- labels: List[str]
List of strings with the labels of the arrays.
- bins:
Number of bins.
- range: Tuple, optional
A tuple with a min and max value for the histogram. Default is None, which corresponds to using the min a max value across all data.
- title: str, optional
Title of the axis object.
- xlabel: str, optional
Label of the horizontal axis.
- ylabel: str, optional
Label of the vertical axis.
Returns
- plt.Axes
Axis objects for the histogram plot of original labels.
- idpet.visualization.plot_violins(ax, data, labels, summary_stat='mean', title='Histogram', xlabel='x', color='blue', x_ticks_rotation=45)[source]
Make a violin plot.
Parameters
- ax: plt.Axes
Matplotlib axis object where the histograms will be for plotted.
- data: List[np.array]
List of NumPy array storing the data to be plotted.
- labels: List[str]
List of strings with the labels of the arrays.
- summary_stat: str, optional
Select between “median” or “mean” to show in violin plot. Default value is “mean”
- title: str, optional
Title of the axis object.
- xlabel: str, optional
Label of the horizontal axis.
Returns
- plt.Axes
Axis objects for the histogram plot of original labels.