I have number of cells in three cell types T, B, M in a Seurat object

For two groups of patients, cancers and controls like

> table(Idents(pbmc), pbmc$samples)
    PN0252_0001 PN0252_0002 PN0252_0003 PN0252_0004 PN0252_0005 PN0252_0006 PN0252_0008
  T        3550         568         136         268        1835           2        1678
  B         136         129          11          25         133           0         203
  M         120          22          18          26         159           0          59
> dput(table(Idents(pbmc), pbmc$samples))
structure(c(3550L, 136L, 120L, 568L, 129L, 22L, 136L, 11L, 18L, 
268L, 25L, 26L, 1835L, 133L, 159L, 2L, 0L, 0L, 1678L, 203L, 59L
), .Dim = c(3L, 7L), .Dimnames = structure(list(c("T", "B", "M"
), c("PN0252_0001", "PN0252_0002", "PN0252_0003", "PN0252_0004", 
"PN0252_0005", "PN0252_0006", "PN0252_0008")), .Names = c("", 
"")), class = "table")

Patients PN0252_0001, PN0252_0002, PN0252_0003, PN0252_0004 are controls

and PN0252_0005, PN0252_0006, PN0252_0008 are cancers

I want to look at the difference of the proportion of cells in each cell type between cancer and control

But I am confused for getting proportion should I divide the number of cells on total cells in the object or total cells in each group

Basically I need a box plot like although here numbers are not correct

enter image description here

  • 1
    $\begingroup$ This looks like a ggplot with a facet added to it. What have you tried? $\endgroup$
    – Ram RS
    Jul 29, 2021 at 19:40
  • $\begingroup$ What I plotted here is what I have tried but I am not sure about the proportions $\endgroup$
    – Mahta Mira
    Jul 30, 2021 at 8:34
  • $\begingroup$ Your boxplot seems correct. What do you think is wrong about it? $\endgroup$
    – story
    Jul 30, 2021 at 10:37
  • $\begingroup$ I don't know proportion of T cells for example, I should divide the number of T cells in each patients on the total number of cells or total cells in controls and cancers separately $\endgroup$
    – Mahta Mira
    Jul 30, 2021 at 20:19
  • $\begingroup$ The answer to that depends on the question you're asking and what you wish to showcase. In any case, only you can answer it, we can't do that for you. $\endgroup$
    – Ram RS
    Jul 30, 2021 at 21:55


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.