mirror of
https://github.com/chanzuckerberg/cellxgene.git
synced 2026-10-11 00:20:56 +08:00
Very minor changes to elaborate in a few places
This commit is contained in:
@@ -60,23 +60,23 @@ _For help with the scanpy engine_
|
||||
|
||||
### Scanpy
|
||||
|
||||
To prepare you data you will need to format your data into AnnData format using scanpy and calculate PCA and nearest neighbors and save in h5ad format.
|
||||
To prepare your data you will need to format your data into AnnData format using scanpy and calculate PCA and nearest neighbors and save in h5ad format.
|
||||
|
||||
1. [Load data into scanpy](https://scanpy.readthedocs.io/en/latest/api/index.html#exporting)
|
||||
1. [Load data into scanpy](https://scanpy.readthedocs.io/en/latest/api/index.html#reading)
|
||||
|
||||
- Ensure that `obs`'s index is the cell names
|
||||
- Ensure that `obs`'s index is the cell names: `print(data.obs_names)` should show your cell indices. If it shows gene names, you may need to just call `data.transpose()`.
|
||||
|
||||
2. Calculate PCA
|
||||
|
||||
sc.pp.pca(data)
|
||||
sc.pp.pca(data) ## sc is scanpy.api
|
||||
|
||||
3. Calculate nearest neighbors (depending on layout algorithm)
|
||||
|
||||
```
|
||||
# For umap layout algorithm
|
||||
# For umap layout algorithm, you need to use the "umap" method for neighbors
|
||||
sc.pp.neighbors(data, method="umap", metric="euclidean", use_rep="X_pca")
|
||||
|
||||
# For tsne layout algorithm
|
||||
# For tsne layout algorithm, you can use either "umap" or "gauss"; we recommend "gauss"
|
||||
sc.pp.neighbors(data, method="gauss", metric="euclidean", use_rep="X_pca")
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user