How do I access the scale_sampler
method? For a given cell type, I would like to compute the scale1
value (the normalized expression) that is reported from model.differential_expression
.
For example, let's say I want to get the normalized expression of all genes on the ASK neurons. Right now, I can do that by doing:
de = model.differential_expression(group1='ASK',group2='ASJ',groupby='cell_type')
ASK_normalized_expression= de['scale1']
However this takes ~10s and is computing a bunch of other things that I don't need. I want to build a matrix of the normalized expression for all cell types (150 cell types x 11k genes) so doing this 150 times takes ~25 min and I'd want to make it quicker if possible..
The scale_sampler
is described here:
https://docs.scvi-tools.org/en/stable/_modules/scvi/core/utils/differential.html#DifferentialComputation
normalized_expression_matrix = model.get_normalized_expression(batch_size=1000)
but still crashes... the adata is n_obs × n_vars = 100955 × 11569
, other than getting more RAM is there something I could do to get this to run on colab?