You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .github/ISSUE_TEMPLATE/question.md
+4-2Lines changed: 4 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,11 +1,13 @@
1
1
---
2
2
name: Usage Question
3
-
about: Ask how to solve your problem using cell2location.
3
+
about: Template for posting a question to scverse Discourse.
4
4
title: ''
5
5
labels: question
6
6
assignees: ''
7
7
---
8
8
9
+
## Please use the template below to post a question to https://discourse.scverse.org/c/ecosytem/cell2location/.
10
+
9
11
### Problem
10
12
11
13
<!-- Please describe your problem below: -->
@@ -14,7 +16,7 @@ assignees: ''
14
16
-[ ] I follow the instructions from the [cell2location tutorial (using on scvi-tools)](https://cell2location.readthedocs.io/en/latest/notebooks/cell2location_tutorial.html).
15
17
-[ ] I have adjusted required hyperparameters to my dataset and tissue `N_cells_per_location` and `detection_alpha`.
16
18
-[ ] I have provided 10X reaction/inlet as `batch_key` for reference NB regression.
17
-
-[ ] I have checked [Cell2location Community Forum](https://github.com/BayraktarLab/cell2location/discussions), [scvi-tools forum](https://discourse.scvi-tools.org/) and did not find a solution
19
+
-[ ] I have checked [scverse Discourse](https://discourse.scverse.org/c/ecosytem/cell2location/) and [old Cell2location Community Forum](https://github.com/BayraktarLab/cell2location/discussions), and did not find a solution.
18
20
19
21
20
22
### Description of the data input and hyperparameters
Copy file name to clipboardExpand all lines: README.md
+143-8Lines changed: 143 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,6 +15,8 @@ If you use cell2location please cite our paper:
15
15
Kleshchevnikov, V., Shmatko, A., Dann, E. et al. Cell2location maps fine-grained cell types in spatial transcriptomics. Nat Biotechnol (2022). https://doi.org/10.1038/s41587-021-01139-4
Please note that cell2locations requires 2 user-provided hyperparameters (N_cells_per_location and detection_alpha) - for detailed guidance on setting these hyperparameters and their impact see [the flow diagram and the note](https://github.com/BayraktarLab/cell2location/blob/master/docs/images/Note_on_selecting_hyperparameters.pdf). Many real datasets (especially human) show within-slide variability in RNA detection sensitivity - requiring you to try both recommended settings of the `detection_alpha` parameter: `detection_alpha=200` for low within-slide technical variability and `detection_alpha=20` for high within-slide technical variability.
19
+
18
20
Cell2location is a principled Bayesian model that can resolve fine-grained cell types in spatial transcriptomic data and create comprehensive cellular maps of diverse tissues. Cell2location accounts for technical sources of variation and borrows statistical strength across locations, thereby enabling the integration of single cell and spatial transcriptomics with higher sensitivity and resolution than existing tools. This is achieved by estimating which combination of cell types in which cell abundance could have given the mRNA counts in the spatial data, while modelling technical effects (platform/technology effect, contaminating RNA, unexplained variance).
19
21
20
22
<palign="center">
@@ -24,11 +26,9 @@ Overview of the spatial mapping approach and the workflow enabled by cell2locati
24
26
25
27
## Usage and Tutorials
26
28
27
-
The tutorial covering the estimation of expresson signatures of reference cell types, spatial mapping with cell2location and the downstream analysis can be found here: https://cell2location.readthedocs.io/en/latest/
28
-
29
-
You can also try cell2location on [Google Colab](https://colab.research.google.com/github/BayraktarLab/cell2location/blob/master/docs/notebooks/cell2location_tutorial.ipynb) on a smaller data subset containing somatosensory cortex.
29
+
The tutorial covering the estimation of expresson signatures of reference cell types, spatial mapping with cell2location and the downstream analysis can be found here and tried on [Google Colab](https://colab.research.google.com/github/BayraktarLab/cell2location/blob/master/docs/notebooks/cell2location_tutorial.ipynb): https://cell2location.readthedocs.io/en/latest/
30
30
31
-
Please report bugs via https://github.com/BayraktarLab/cell2location/issues and ask any usage questions in https://github.com/BayraktarLab/cell2location/discussions.
31
+
Please report bugs via https://github.com/BayraktarLab/cell2location/issues and ask any usage questions about [cell2location](https://discourse.scverse.org/c/ecosytem/cell2location/42), [scvi-tools](https://discourse.scverse.org/c/help/scvi-tools/7) or [Visium data](https://discourse.scverse.org/c/general/visium/32) in scverse community discourse.
32
32
33
33
Cell2location package is implemented in a general way (using https://pyro.ai/ and https://scvi-tools.org/) to support multiple related models - both for spatial mapping, estimating reference cell type signatures and downstream analysis.
Before installing cell2location and it's dependencies, it could be necessary to make sure that you are creating a fully isolated conda environment by telling python to NOT use user site for installing packages, ideally by adding this line to your `~/.bashrc` file , but this would also work during a terminal session:
64
+
Before installing cell2location and it's dependencies, it could be necessary to make sure that you are creating a fully isolated conda environment by telling python to NOT use user site for installing packagesby running this line before creating conda environment and every time before activatin conda environment in a new terminal session:
65
65
66
66
```bash
67
-
export PYTHONNOUSERSITE="someletters"
67
+
export PYTHONNOUSERSITE="literallyanyletters"
68
68
```
69
69
70
70
@@ -79,12 +79,147 @@ Cell2location architecture is designed to simplify extended versions of the mode
79
79
We thank all paper authors for their contributions:
80
80
Vitalii Kleshchevnikov, Artem Shmatko, Emma Dann, Alexander Aivazidis, Hamish W King, Tong Li, Artem Lomakin, Veronika Kedlian, Mika Sarkin Jain, Jun Sung Park, Lauma Ramona, Liz Tuck, Anna Arutyunyan, Roser Vento-Tormo, Moritz Gerstung, Louisa James, Oliver Stegle, Omer Ali Bayraktar
81
81
82
-
We also thank Krzysztof Polanski, Luz Garcia Alonso, Carlos Talavera-Lopez, Ni Huang for feedback on the package, Martin Prete for dockerising cell2location and other software support.
82
+
We also thank Pyro developers (Fritz Obermeyer, Martin Jankowiak), Krzysztof Polanski, Luz Garcia Alonso, Carlos Talavera-Lopez, Ni Huang for feedback on the package, Martin Prete for dockerising cell2location and other software support.
83
83
84
84
## FAQ
85
85
86
86
See https://github.com/BayraktarLab/cell2location/discussions
87
87
88
88
## Future development and experimental features
89
+
Future developments of cell2location are focused on 1) scalability to 100k-mln+ locations using amortised inference of cell abundance (same ideas as used in VAE), 2) extending cell2location to related spatial analysis tasks that require modification of the model (such as using cell type hierarchy information), and 3) incorporating features presented by more recently proposed methods (such as CAR spatial proximity modelling). We are also experimenting with Numpyro and JAX (https://github.com/vitkl/cell2location_numpyro).
### Issues with package version mismatches often originate from python user site rather than conda environment being used to install a subset of packages
108
+
109
+
Before installing cell2location and it's dependencies, it could be necessary to make sure that you are creating a fully isolated conda environment by telling python to NOT use user site for installing packages by running this line before creating conda environment and every time before activatin conda environment in a new terminal session:
89
110
90
-
We also provide an experimental numpyro translation of the model which has improved memory efficiency (allowing analysis of multiple Visium samples on Google Colab) and minor improvements in speed - https://github.com/vitkl/cell2location_numpyro. You can try it on Google Colab [](https://colab.research.google.com/github/vitkl/cell2location_numpyro/blob/main/docs/notebooks/cell2location_short_demo_colab.ipynb) - however note that both numpyro itself and cell2location_numpyro are in very active development. Numpyro+JAX are being introduces into scvi-tools so follow updates on that.
111
+
```bash
112
+
export PYTHONNOUSERSITE="literallyanyletters"
113
+
```
114
+
115
+
### Useful code for reading and combining multiple Visium sections
116
+
117
+
Keeping info on distinct sections in a csv file (Google Sheet).
118
+
119
+
```python
120
+
sample_annot = pd.read_csv('./sample_annot.csv')
121
+
122
+
from glob import glob
123
+
sample_annot['path'] = pd.Series(
124
+
glob(f'{sp_data_folder}*'),
125
+
index=[sub('^.+WTSI_', '', sub('_GRCh38-2020-A$', '', i)) for i in glob(f'{sp_data_folder}*')]
126
+
)[sample_annot['Sample_ID']].values
127
+
import os
128
+
sample_annot['file'] = [os.path.basename(i) for i in sample_annot['path']]
0 commit comments