scanpy.external.exporting.cellbrowser#
- scanpy.external.exporting.cellbrowser(adata, data_dir, data_name, *, embedding_keys=None, annot_keys=('louvain', 'percent_mito', 'n_genes', 'n_counts'), cluster_field='louvain', nb_marker=50, skip_matrix=False, html_dir=None, port=None, do_debug=False)[source]#
Export adata to a UCSC Cell Browser project directory.
If
html_diris set, subsequently build the html files from the project directory intohtml_dir. Ifportis set, start an HTTP server in the background and servehtml_dironport.By default, export all gene expression data from
adata.raw, the annotationslouvain,percent_mito,n_genesandn_countsand the topnb_markercluster markers. All existing files in data_dir are overwritten, exceptcellbrowser.conf.See UCSC Cellbrowser for details.
- Parameters:
- adata
AnnData Annotated data matrix
- data_dir
Path|str Path to directory for exported Cell Browser files. Usually these are the files
exprMatrix.tsv.gz,meta.tsv, coordinate files liketsne.coords.tsv, and cluster marker gene lists likemarkers.tsv. A filecellbrowser.confis also created with pointers to these files. As a result, each adata object should have its own project_dir.- data_name
str Name of dataset in Cell Browser, a string without special characters. This is written to
data_dir/cellbrowser.conf. Ideally this is a short unique name for the dataset, like"pbmc3k"or"tabulamuris".- embedding_keys
Iterable[str] |Mapping[str,str] |str|None(default:None) 2-D embeddings in
adata.obsmto export. The prefixX_orX_draw_graph_is not necessary. Coordinates missing fromadataare skipped. By default (or when specifying'all'orNone), these keys are tried: ["tsne","umap","pagaFa","pagaFr","pagaUmap","phate","fa","fr","kk","drl","rt","trimap"]. For these, default display labels are automatically used. For other values, you can specify a mapping from coordinate name to display label, e.g.{"tsne": "t-SNE by Scanpy"}.- annot_keys
Iterable[str] |Mapping[str,str] |None(default:('louvain', 'percent_mito', 'n_genes', 'n_counts')) Annotations in
adata.obsmto export. Can be a mapping from annotation column name to display label. SpecifyNonefor all available columns in.obs.- skip_matrix
bool(default:False) Do not export the matrix. If you had previously exported this adata into the same
data_dir, then there is no need to export the whole matrix again. This option will make the export a lot faster, e.g. when only coordinates or meta data were changed.- html_dir
Path|str|None(default:None) If this variable is set, the export will build html files from
data_dirtohtml_dir, creating html/js/json files. Usually there is one global html output directory for all datasets. Often,html_diris located under a webserver’s (like Apache) htdocs directory or is copied to one. A directoryhtml_dir/project_namewill be created and an index.html will be created underhtml_dirfor all subdirectories. Existing files will be overwritten. If do not to use html_dir, you can use the command line toolcbBuildto build the html directory.- port
int|None(default:None) If this variable and
html_dirare set, Python’s built-in web server will be spawned as a daemon in the background and serve the files underhtml_dir. To kill the process, callcellbrowser.cellbrowser.stop().- do_debug
bool(default:False) Activate debugging output
- adata
Examples
See this tutorial.