ggml_ot.gene.ranking#
- ggml_ot.gene.ranking(adata, components=None, *, n_genes=None, polarity='both', gene_symbols=None, show=None, save=None)[source]#
Rank and plot gene contributions for each GGML component.
- Parameters:
- adata
AnnData Annotated data matrix.
- components
UnionType[str,Sequence[int],None] (default:None) For example,
'1,2,3'means[1, 2, 3], first, second, third principal component.- n_genes
Optional[int] (default:None) Number of genes to plot for each component.
- polarity
Literal['positive','negative','both'] (default:'both') Which loading direction to show:
'positive'for largest positive loadings,'negative'for largest-magnitude negative loadings, or'both'for positive and negative loadings. For'negative', scores are sign-flipped before calling Scanpy’s ranking plotter, so the plotted y-axis is inverted relative to the original GGML loadings.- gene_symbols
Optional[str] (default:None) Key for field in .var that stores gene symbols if you do not want to use .var_names.
- show
Optional[bool] (default:None) Show the plot.
- save
UnionType[str,bool,None] (default:None) If True or a str, save the figure. A string is appended to the default filename. Infer the filetype if ending on {‘.pdf’, ‘.png’, ‘.svg’}.
- adata
- Return type:
ndarray- Returns:
np.ndarray Array of shape
(n_components, n_genes)with the shown genes. Forpolarity='both', the first half are the highest positive loadings and the second half are the lowest negative loadings.