Closed carloelle closed 2 years ago
Hi Carlo
We never saw a benefit from using the exact cell numbers in the current version of cell2location because this value is used as a prior and has a weak effect on the results: there are 2 layers of variables between this value (n_s
andz_sr
) and estimated cell abundance (w_sf
). This might change in future versions. Another issue with cell numbers, especially using them directly rather than as a prior, is that discrete cell number does not account for the proportion of each particular cell captured in the 2D section. This also means that this option is not fully supported and not tested.
That said feel free to compare the results using a single value and the exact cell numbers.
N_cells_per_location
input needs to be a scalar or np.array
with shape (n_location, 1)
and data type 'float32'
.
Dear developers,
I had an issue when I want to give to C2L the exact numbers of cells (calculated by segmentation per spot) per spot. Indeed when I run:
with
A1_fil
is the spatial dataset anndata-formatted with scvi-tools,inf_aver_filraw_A1
is the dataframe coming out from the regression model,numcellsA['N_cells']
is a int-64 vector of the same length ofA1_fil
's total spots, containing the exact number of cells per each spot.the error is the following:
This error does not appear if I specify
N_cells_per_location
=8 (or any other number). How can I proceed? I noticed that providing the exact number of cells per each spot is what you called 'advanced mode', where you also recommend to add 0.1 as pseudocount (though herenumcellsA['N_cells']
is not zero in any spot) and to modify vn in order to make the prior more informative. How can I additionally do that?Thanks a lot, Best, Carlo