mirror of
https://github.com/chanzuckerberg/cellxgene.git
synced 2026-09-29 19:58:11 +08:00
Rename "layout" to "embedding" in the UI (#921)
* rename "layout" to "embedding" in the UI * docs changes for layout * fix typo in data docs * new help text, per PR review
This commit is contained in:
@@ -25,12 +25,12 @@ def common_args(func):
|
||||
"""
|
||||
@click.option("--title", "-t", help="Title to display (if omitted will use file name).")
|
||||
@click.option(
|
||||
"--layout",
|
||||
"-l",
|
||||
"--embedding",
|
||||
"-e",
|
||||
default=[],
|
||||
multiple=True,
|
||||
show_default=True,
|
||||
help="Layout name, eg, 'umap'."
|
||||
show_default=False,
|
||||
help="Embedding name, eg, 'umap'. Repeat option for multiple embeddings. Defaults to all."
|
||||
)
|
||||
@click.option("--obs-names", default=None, metavar="", help="Name of annotation field to use for observations.")
|
||||
@click.option("--var-names", default=None, metavar="", help="Name of annotation to use for variables.")
|
||||
@@ -53,9 +53,9 @@ def common_args(func):
|
||||
return wrapper
|
||||
|
||||
|
||||
def parse_engine_args(layout, obs_names, var_names, max_category_items, diffexp_lfc_cutoff):
|
||||
def parse_engine_args(embedding, obs_names, var_names, max_category_items, diffexp_lfc_cutoff):
|
||||
return {
|
||||
"layout": layout,
|
||||
"layout": embedding,
|
||||
"max_category_items": max_category_items,
|
||||
"diffexp_lfc_cutoff": diffexp_lfc_cutoff,
|
||||
"obs_names": obs_names,
|
||||
@@ -101,7 +101,7 @@ def launch(
|
||||
open_browser,
|
||||
port,
|
||||
host,
|
||||
layout,
|
||||
embedding,
|
||||
obs_names,
|
||||
var_names,
|
||||
max_category_items,
|
||||
@@ -122,7 +122,7 @@ def launch(
|
||||
|
||||
> cellxgene launch <url>"""
|
||||
|
||||
e_args = parse_engine_args(layout, obs_names, var_names, max_category_items, diffexp_lfc_cutoff)
|
||||
e_args = parse_engine_args(embedding, obs_names, var_names, max_category_items, diffexp_lfc_cutoff)
|
||||
try:
|
||||
data_locator = DataLocator(data)
|
||||
except RuntimeError as re:
|
||||
|
||||
+10
-10
@@ -8,12 +8,12 @@ from scipy.sparse.csc import csc_matrix
|
||||
@click.command()
|
||||
@click.argument("data", nargs=1, metavar="<dataset: file or path to data>", required=True)
|
||||
@click.option(
|
||||
"--layout",
|
||||
"-l",
|
||||
"--embedding",
|
||||
"-e",
|
||||
default=["umap", "tsne"],
|
||||
multiple=True,
|
||||
type=click.Choice(["umap", "tsne"]),
|
||||
help="Layout algorithm",
|
||||
help="Embedding algorithm",
|
||||
show_default=True,
|
||||
)
|
||||
@click.option(
|
||||
@@ -42,7 +42,7 @@ from scipy.sparse.csc import csc_matrix
|
||||
)
|
||||
def prepare(
|
||||
data,
|
||||
layout,
|
||||
embedding,
|
||||
recipe,
|
||||
output,
|
||||
plotting,
|
||||
@@ -59,7 +59,7 @@ def prepare(
|
||||
This tool runs a series of scanpy routines for preparing a dataset
|
||||
for use with cellxgene. It loads data from different formats
|
||||
(h5ad, loom, or a 10x directory), runs dimensionality reduction,
|
||||
computes nearest neighbors, computes a layout, performs clustering,
|
||||
computes nearest neighbors, computes an embedding, performs clustering,
|
||||
and saves the results. Includes additional options for naming
|
||||
annotations, ensuring sparsity, and plotting results."""
|
||||
|
||||
@@ -162,18 +162,18 @@ def prepare(
|
||||
def run_louvain(adata):
|
||||
sc.tl.louvain(adata)
|
||||
|
||||
def run_layout(adata):
|
||||
def run_embedding(adata):
|
||||
if len(unique(adata.obs["louvain"].values)) < 10:
|
||||
palette = "tab10"
|
||||
else:
|
||||
palette = "tab20"
|
||||
|
||||
if "umap" in layout:
|
||||
if "umap" in embedding:
|
||||
sc.tl.umap(adata)
|
||||
if plotting:
|
||||
sc.pl.umap(adata, color="louvain", palette=palette, save="_louvain")
|
||||
|
||||
if "tsne" in layout:
|
||||
if "tsne" in embedding:
|
||||
sc.tl.tsne(adata)
|
||||
if plotting:
|
||||
sc.pl.tsne(adata, color="louvain", palette=palette, save="_louvain")
|
||||
@@ -190,12 +190,12 @@ def prepare(
|
||||
"run_pca": "Running PCA",
|
||||
"run_neighbors": "Calculating neighbors",
|
||||
"run_louvain": "Calculating clusters",
|
||||
"run_layout": "Computing layout",
|
||||
"run_embedding": "Computing embedding",
|
||||
}
|
||||
if item is not None:
|
||||
return names[item.__name__]
|
||||
|
||||
steps = [calculate_qc_metrics, make_sparse, run_recipe, run_pca, run_neighbors, run_louvain, run_layout]
|
||||
steps = [calculate_qc_metrics, make_sparse, run_recipe, run_pca, run_neighbors, run_louvain, run_embedding]
|
||||
|
||||
click.echo(f"[cellxgene] Loading data from {data}, please wait...")
|
||||
adata = load_data(data)
|
||||
|
||||
Reference in New Issue
Block a user