Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@_doc_params(show_save_ax=doc_show_save_ax)
def clustermap(
adata: AnnData,
obs_keys: str = None,
use_raw: Optional[bool] = None,
show: Optional[bool] = None,
save: Union[bool, str, None] = None,
**kwds,
):
"""\
Hierarchically-clustered heatmap.
Wraps :func:`seaborn.clustermap` for :class:`~anndata.AnnData`.
Parameters
----------
adata
@_doc_params(show_save_ax=doc_show_save_ax)
def rank_genes_groups_heatmap(
adata: AnnData,
groups: Union[str, Sequence[str]] = None,
n_genes: int = 10,
groupby: Optional[str] = None,
key: str = None,
show: Optional[bool] = None,
save: Optional[bool] = None,
**kwds,
):
"""\
Plot ranking of genes using heatmap plot (see :func:`~scanpy.pl.heatmap`)
Parameters
----------
adata
@_doc_params(n_pcs=doc_n_pcs, use_rep=doc_use_rep)
def compute_neighbors(
self,
n_neighbors: int = 30,
knn: bool = True,
n_pcs: Optional[int] = None,
use_rep: Optional[str] = None,
method: _Method = 'umap',
random_state: Optional[Union[int, RandomState]] = 0,
write_knn_indices: bool = False,
metric: _Metric = 'euclidean',
metric_kwds: Mapping[str, Any] = MappingProxyType({}),
) -> None:
"""\
Compute distances and connectivities of neighbors.
Parameters
@_doc_params(show_save_ax=doc_show_save_ax)
def highest_expr_genes(
adata: AnnData,
n_top: int = 30,
show: Optional[bool] = None,
save: Optional[Union[str, bool]] = None,
ax: Optional[Axes] = None,
gene_symbols: Optional[str] = None,
log: bool = False,
**kwds,
):
"""\
Fraction of counts assigned to each gene over all cells.
Computes, for each gene, the fraction of counts assigned to that gene within
a cell. The `n_top` genes with the highest mean fraction over all cells are
plotted as boxplots.
@_doc_params(n_pcs=doc_n_pcs, use_rep=doc_use_rep)
def neighbors(
adata: AnnData,
n_neighbors: int = 15,
n_pcs: Optional[int] = None,
use_rep: Optional[str] = None,
knn: bool = True,
random_state: Optional[Union[int, RandomState]] = 0,
method: Optional[_Method] = 'umap',
metric: Union[_Metric, _MetricFn] = 'euclidean',
metric_kwds: Mapping[str, Any] = MappingProxyType({}),
copy: bool = False,
) -> Optional[AnnData]:
"""\
Compute a neighborhood graph of observations [McInnes18]_.
The neighbor search efficiency of this heavily relies on UMAP [McInnes18]_,
@_doc_params(doc_org=_doc_org, doc_host=_doc_host, doc_use_cache=_doc_use_cache)
def biomart_annotations(
org: str,
attrs: Iterable[str],
*,
host: str = "www.ensembl.org",
use_cache: bool = False,
) -> pd.DataFrame:
"""\
Retrieve gene annotations from ensembl biomart.
Parameters
----------
{doc_org}
attrs
Attributes to query biomart for.
{doc_host}
@_doc_params(scatter_temp=doc_scatter_basic, show_save_ax=doc_show_save_ax)
def scatter(
adata: AnnData,
x: Optional[str] = None,
y: Optional[str] = None,
color: Union[str, Collection[str]] = None,
use_raw: Optional[bool] = None,
layers: Union[str, Collection[str]] = None,
sort_order: bool = True,
alpha: Optional[float] = None,
basis: Optional[_Basis] = None,
groups: Union[str, Iterable[str]] = None,
components: Union[str, Collection[str]] = None,
projection: Literal['2d', '3d'] = '2d',
legend_loc: str = 'right margin',
legend_fontsize: Union[int, float, _FontSize, None] = None,
legend_fontweight: Union[int, _FontWeight, None] = None,
@_doc_params(
doc_adata_basic=doc_adata_basic,
doc_expr_reps=doc_expr_reps,
doc_obs_qc_args=doc_obs_qc_args,
doc_qc_metric_naming=doc_qc_metric_naming,
doc_obs_qc_returns=doc_obs_qc_returns,
doc_var_qc_returns=doc_var_qc_returns,
)
def calculate_qc_metrics(
adata: AnnData,
*,
expr_type: str = "counts",
var_type: str = "genes",
qc_vars: Collection[str] = (),
percent_top: Collection[int] = (50, 100, 200, 500),
layer: Optional[str] = None,
use_raw: bool = False,
@_doc_params(show_save_ax=doc_show_save_ax)
def rank_genes_groups_stacked_violin(
adata: AnnData,
groups: Union[str, Sequence[str]] = None,
n_genes: int = 10,
groupby: Optional[str] = None,
key: Optional[str] = None,
show: Optional[bool] = None,
save: Optional[bool] = None,
**kwds,
):
"""\
Plot ranking of genes using stacked_violin plot (see :func:`~scanpy.pl.stacked_violin`)
Parameters
----------
adata
@_doc_params(show_save_ax=doc_show_save_ax)
def dendrogram(
adata: AnnData,
groupby: str,
*,
dendrogram_key: Optional[str] = None,
orientation: Literal['top', 'bottom', 'left', 'right'] = 'top',
remove_labels: bool = False,
show: Optional[bool] = None,
save: Union[str, bool, None] = None,
ax: Optional[Axes] = None,
):
"""\
Plots a dendrogram of the categories defined in `groupby`.
See :func:`~scanpy.tl.dendrogram`.