tanaylab / metacells

Metacells - Single-cell RNA Sequencing Analysis
MIT License
86 stars 8 forks source link

How can I save meta cells and its gene count as a txt file? #64

Closed jrahimik closed 7 months ago

orenbenkiki commented 7 months ago

Not sure what you are asking for. You can always access the data through the API and then use standard numpy/pandas functions to save it as text.

jrahimik commented 7 months ago

I am using R, and mistakenly open the ticket in python section. The question was what is the slot in meta cell data structure where the metacell by gene count is saved.

orenbenkiki commented 7 months ago

There's no gene count per MC. The (global) number of genes is available as the number of variables (the n_vars member of the AnnData object).

jrahimik commented 7 months ago

Do you guys have any recommendations for getting a count for a gene in a metacell? Like the average or median count?

orenbenkiki commented 7 months ago

Not sure what you mean by "a count for a gene in a metacell". If you are talking about a UMIs counts, then this doesn't have a single answer. A metacell is a combination of multiple cells. Each cell has an integer UMIs count per gene and a different total number of UMIs. We estimate the gene expression level (fraction of total UMIs) for each gene in each metacell. This is a floating point number (their sum is 1.0). To decide on an integer UMIs count per gene per metacell you have to pick an arbitrary total number of UMIs per metacells. Even then, you'll get a floating point number of UMIs per gene per metacell. However number of UMIs must be an integer so you need to do something like stochastic rounding (otherwise all weakly expressed genes will have zero UMIs).

jrahimik commented 7 months ago

Great, thanks!