Correlation between two expression matrices in blood and tumor
2
0
Entering edit mode
5.3 years ago
Palgrave ▴ 30

I have three gene expression matrices, one from blood one from tumor and one from normal adjacent tissue. I would like to correlate the expression of all rows (genes) in blood and tumor. The matrices are ordered so that they contain the same samples (colnames) and same genes (rownames). What is the best way to do this in R?

My aim is to to check of some of the genes that are highly expressed in blood are also up-regulated in the tumor samples. Since I only have one data set from blood I cannot make a differentially expression analysis on blood alone.

R rna-seq • 1.8k views
1
Entering edit mode
5.3 years ago

Quick answer, there's probably a better way without a loop:

for(i in 1:nrow(blood)){
cor(blood[i,], tumor[i,])
}
0
Entering edit mode

does it work with data frames? My output is empty...

0
Entering edit mode
5.3 years ago

You can just correlate everything with:

m = cor(cbind(blood, tumor))


That makes a nice matrix that you could also make a heatmap out of.

0
Entering edit mode

I have have performed log2 cpm normalization on the two matrices before correlating them. Shoul I perform scaling as well?

0
Entering edit mode

Did you normalize the values before getting the log2(cpm)? log2(cpm) itself is not a robust normalization. I would suggest that you use edgeR/DESeq2/etc. to get properly normalized values to make the CPMs out of (edgeR has a cpm() function, I think).

0
Entering edit mode

I used cpm function in limma, so it should be ok.

0
Entering edit mode

As long as you had all of the samples from all of the groups together, then yes. Then you don't need further normalization.