alphapepttools.tl.prepare_pca_1d_loadings_data_to_plot

alphapepttools.tl.prepare_pca_1d_loadings_data_to_plot#

alphapepttools.tl.prepare_pca_1d_loadings_data_to_plot(data, dim_space, dim, nfeatures, embeddings_name=None)#

Prepare the gene loadings (1d) of a PC for plotting.

Parameters:
  • data (ad.AnnData) – AnnData to plot.

  • dim_space (str, optional) – The dimension space used in PCA. Can be either “obs” (default) for sample projection or “var” for feature projection. By default “obs”.

  • dim (int) – The PC number from which to get loadings (1-indexed, i.e. the first PC is 1, not 0).

  • nfeatures (int) – The number of top absolute loadings features to plot.

  • embeddings_name (str | None, optional) – The custom embeddings name used in PCA. If None, uses default naming convention. By default None.

Return type:

DataFrame

Returns:

dataframe DataFrame containing the top nfeatures loadings for the specified PC dimension.