I am seeking some advice on how to do the following task:
I am analyzing a single-cell RNAseq dataset. I have my normalized expression data in a table ( each column has an unique cell ID, each row is a gene).
I also have an annotation matrix where I have the information of each cell (each row is a cell ID, each column is a piece of info (such as patient ID, site,etc.)
For downstream analyses, I would like to have different grouping based on the info available in the annotation matrix. Do you guys have any suggestion how I might be able to do that????
For example, I have this
expression_matrix<-matrix(c(1:4), nrow = 4,ncol =4, dimnames = list(c("gene1", "gene2", "gene3", "gene4"),c("cell1","cell2","cell3","cell4")))
annotation_matrix<-matrix(c("1526","1788", "1526","1788","controller","noncontroller","controller","noncontroller","LN","PB","LN","PB"), nrow = 4,ncol =3, dimnames = list(c("cell1","cell2","cell3","cell4"),c("ID","Status","Site")))
I want to group based on "site" so that I can combine cell 1 and 3 in one group and cell2 and cell4 in another group. How do I use match the info from the annotation matrix to the expression_matrix?
Say, I want to compare between controller and non-controller so I need to somehow match the cell ID in the normalized_expression table to the patient group info available in the annotation matrix