Probably better to also use method="spearman" with cor(), just to be safe and avoid spurious correlations.
I have different cell type total of 5 ,im doing a pairwise comparison, I would like to show the correlation in pairwise condition between the genes. I want to plot how these certain genes are expressed. So would be be suffice to show simple correlation based calculation or i have to do something else.
Any suggestion would be appreciated.
1 answer
It sounds like a simple pairwise correlation with cor() would suffice.
Hi, following this discussion, I've been trying to use cor() after transposing my gene/samples matrix from microarray experiment (so genes are as columns and samples are as rows) but I'm not sure how to define "y", I get this error:
cor<- cor(tm, use="pairwise.complete.obs","spearman") Error in
cor(tm, use = "pairwise.complete.obs", "spearman") : 'y' must be
numeric
Make tm a matrix.
it is a matrix already, I did
tm <- as.matrix(tm)
but the only way to avoid the error is if I set "y<-tm", then I get a correlation table of 900x900 with the correlation of each gene with every other gene but I'm not sure what I'm comparing because y should be 6 samples... I don't know
anyhow I just posted the whole question here
Oh, you need method="spearman", not just "spearman". R is seeing "spearman" as the thing you want to correlate tm with otherwise.
Log in to answer this question.
Also have a look at the corrplot package https://cran.r-project.org/web/packages/corrplot/vignettes/corrplot-intro.html
I use corrplot often but my question was would it be enough to make a correlation to show which genes are coexpreseed or i have to go for WGCNA kind of thing ?
Your question could be better phrased. For finding co-expressed genes, I think you should go for PCIT, WGCNA or some similar method.
sorry for my confusing words but thats what i wanted to ask