plots
- sofa.plots.plots.plot_enrichment(gene_list: list, background: list, db: list, top_n: list, ax: Union[None, matplotlib.axes._axes.Axes] = None) matplotlib.axes._axes.Axes
Plot bar plot of adjusted p-values for gene set overrepresentation analysis based on a provided gene_list. The gene set overrepresentation analysis uses the enrichr api and calculates whether gene sets from chosen databases are significantly overrepresented vs a background gene set.
- Parameters
gene_list (list) – Gene list to perform gene set overrepresentation analysis on.
background (list) – Background gene list, a good choice would be all the genes that are considered in the analysis (i.e. all the genes in X).
db (list) – List of strings of databases to perform gene set overrepresentation analysis on. A list of possible databases can be found here https://maayanlab.cloud/Enrichr/#libraries.
top_n (list) – List of integers of the number of top gene sets to plot for each database.
ax (Union[None,Axes], optional) – Axes to plot on, if None, a new figure is created, by default None.
- Returns
Bar plot of adjusted p-values for gene set overrepresentation analysis.
- Return type
matplotlib Axes object
- sofa.plots.plots.plot_factor_metadata_cor(model: sofa.models.SOFA.SOFA, metadata: pandas.core.frame.DataFrame, ax: Union[None, matplotlib.axes._axes.Axes] = None) matplotlib.axes._axes.Axes
Plot the correlation between the factors and covariates.
- Parameters
model (SOFA) – The trained SOFA model.
metavar (pandas.DataFrame) – A dataframe with the covariates.
ax (matplotlib Axes object, optional) – The axes to plot on. If None, a new figure is created.
- Returns
Heatmap with the correlation between the factors and covariates.
- Return type
matplotlib Axes object
- sofa.plots.plots.plot_fit(model: sofa.models.SOFA.SOFA, view: str) matplotlib.axes._axes.Axes
Plot the scatter plot with predicted X vs input X, to assess the model fit.
- Parameters
model (SOFA) – The trained SOFA model.
view (str) – The name of the view to plot.
- Returns
Scatter plot with predicted X vs input X.
- Return type
matplotlib Axes object
- sofa.plots.plots.plot_loadings(model: sofa.models.SOFA.SOFA, view: str, factor: int) matplotlib.axes._axes.Axes
Plot the loadings of a specific factor for a given view in the SOFA model.
- Parameters
model (SOFA) – The SOFA model to plot the loadings for.
view (str) – The name of the view to plot the loadings for.
factor (int, optional) – The index of the factor to plot the loadings for.
- Returns
Plot with loadings for the specified factor and view.
- Return type
matplotlib Axes object
- sofa.plots.plots.plot_top_loadings(model: sofa.models.SOFA.SOFA, view: int, factor: int, top_n: int = 10, sign: Union[None, str] = None, highlight: Union[None, str] = None, ax: Union[None, matplotlib.axes._axes.Axes] = None) matplotlib.axes._axes.Axes
Plot the top loadings of a factor in a given view.
- Parameters
model (SOFA) – The trained model object.
view (int) – The index of the view to plot.
factor (str) – The name of the factor to plot.
top_n (int, optional) – The number of top loadings to plot, by default 10.
sign (str, optional) – The sign of the loadings to plot. If None, plot the top absolute loadings. If “+” or “-”, plot the top positive or negative loadings, respectively.
highlight (list, optional) – A list of feature names to highlight in red, by default None.
ax (matplotlib Axes object, optional) – The axes to plot on. If None, a new figure is created.
- Returns
Plot with top loadings.
- Return type
matplotlib Axes object
- sofa.plots.plots.plot_variance_explained(model: sofa.models.SOFA.SOFA, ax: Union[None, matplotlib.axes._axes.Axes] = None) matplotlib.axes._axes.Axes
Plot the variance explained by each factor for each view.
- Parameters
model (SOFA) – The trained SOFA model.
ax (matplotlib Axes object, optional) – The axes to plot on. If None, a new figure is created.
- Returns
Plot with variance explained by each factor for each view.
- Return type
matplotlib Axes object
- sofa.plots.plots.plot_variance_explained_factor(model: sofa.models.SOFA.SOFA, ax: Union[None, matplotlib.axes._axes.Axes] = None) matplotlib.axes._axes.Axes
Plots the variance explained by each factor.
- Parameters
model (SOFA) – The trained SOFA model.
ax (matplotlib Axes object, optional) – The axes to plot on. If None, a new figure is created.
- Returns
Plot with variance explained by each factor.
- Return type
matplotlib Axes object
- sofa.plots.plots.plot_variance_explained_view(model: sofa.models.SOFA.SOFA, ax: Union[None, matplotlib.axes._axes.Axes] = None) matplotlib.axes._axes.Axes
Plots the variance explained of each view.
- Parameters
model (SOFA) – The trained SOFA model.
ax (matplotlib Axes object, optional) – The axes to plot on. If None, a new figure is created.
- Returns
Plot with variance explained of each view.
- Return type
Axes