Hi, I have gene expression data from two tissues of the same mouse model(Tissue A and Tissue B). I want to do a correlation test and need to work only on the significantly correlated genes between Tissue A and Tissue B. Finally, I would like to show a heatmap and correlation network graph. To give you an idea of how my data look like, here I stimulated with the following line of codes in R.
llibrary(Hmisc) library(multtest) library(reshape2) library(dplyr) data(golub) mat = golub rownames(mat) = paste0("G",1:nrow(mat)) #split the samples up randomly m1 = mat[,seq(1,ncol(mat),2)] m2 = mat[,seq(2,ncol(mat),2)] test = rcorr(t(rbind(m1,m2))) n = nrow(m1) ## Now to see correlation between the two tissues: results = melt(test$r[1:n,(n+1):(2*n)],value.name ="pcc") %>% left_join(melt(test$P[1:n,(n+1):(2*n)],value.name ="p"),by=c("Var1","Var2")) ## to get the signficant(FDR) sig = droplevels(results[p.adjust(results$p,"BH")<0.05,]) new.max <- results %>% filter(Var1 %in% sig$Var1 & Var2 %in% sig$Var2) %>% recast(Var1 ~ Var2,data=.,measure.var="pcc")
Now I have the significant genes which I would like to show by heatmap or network graph. However, the new matrix( new.max) is not anymore square, and I am not sure if I can show co-expressed genes in this form of a matrix. Would it be great to advise me on approaching this big matrix in a more meaningful way? I could show the whole matrix as a heatmap, but it is vast, and my computer is not handling it. That is why I restrict to significant genes only! Best, AD