How to determine the total count for each gene in lymphotype B
0
0
Entering edit mode
7 months ago

Hello

I really need help!! I don't speak English very well so sorry

I have RDS object, this file is processed, normalized (using sct transform approach) and clusters were identified (in other words it ready to use seurat object).

My question is how to determine the number of counts for each gene in lymphocyte B in both control and patients (I have 2 controls and 2 patients). The final result should be an object where genes are in row and all other information are in columns.

NB: Clusters are stored in meta.data@clusters and patients/control are stored in meta.data@orig.ident

Thank you in advance

enter image description here

scRNAseq Seurat • 556 views
ADD COMMENT
0
Entering edit mode

A quick way is

# select only B cells
Idents(rds_obj) <- "clusters"
rds_obj <- subset(rds_obj, idents = "lymphocyte B", invert = FALSE) 

# separate controls from patients
Idents(rds_obj) <- "orig.ident"
controls <- subset(rds_obj, idents = "Controls", invert = FALSE) 
patients <- subset(rds_obj, idents = "Controls", invert = TRUE) 

counts_table <- data.frame(controls = rowSums(controls@assays$RNA@counts), 
                           patients = rowSums(patients@assays$RNA@counts))

That should return a data.frame containing 2 columns and n rows as the genes in the dataset.

# dummy dataset, you should expect real and different values
           controls patients
MIR1302-2HG       12       12
AL627309.1       453      453 
AL627309.3        28       28 
AL627309.5       643      643
AL627309.4        37       37 
AP006222.2        45       45
...
ADD REPLY
0
Entering edit mode

thank you very much for your response I'm really grateful !!

but I'm still confused because for example for patients I have 2 replicates for each type of mutations , for example for the mutation COPA1 I have ( COPA1_1 and COPA1_2 and it's the same thing for COPA2) .

I want to genrate a table with 4 columns with averages of counts for each gene for one type of mutation (average count per gene for COPA1 mutations for both patients together, and the same for the 2 patients who have the COPA2 mutation and finally a column for average count of control.

ADD REPLY
1
Entering edit mode

If you want the average expression, you should look at AverageExpression from seurat which returns the average instead of the sum. AverageExpression(rds_obj, group.by = "orig.ident",...) should do.

ADD REPLY

Login before adding your answer.

Traffic: 1848 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6