Thank you for getting back. Much appreciated.
• 0 views
•
link
Hi
I have a correlation matrix for 34704 genes (size: 24GB). Is it possible to calculate the mutual rank of this file in R studio?
# correlation rank matrix
R <- t(apply(1-C, 1, rank))
# mutual rank matrix
M <- sqrt(R * t(R))
The correlation ranks have to be calculated relative to each gene separately. Try something like this:
R <- matrix(NA, nrow = number.of.genes, ncol = number.of.genes)
# Compute correlation ranks for each gene
for(i in 1:number.of.genes) {
# Rank all genes relative to gene i
# Use 1-cor() because rank() uses ascending order
R[i,] <- rank(apply(gene.data, 1, function(x) 1-cor(t(gene.data[i,]),x)))
}
M <- sqrt(R *t(R)) # Mutual rank
Thank you for getting back. Much appreciated.
Log in to answer this question.
R studio is a development environment/tool, R is the language. You're looking for a solution in R, not R studio.
Please use the formatting bar (especially the
codeoption) to present your post better. I've done it for you this time.Thank you for your suggestions.
I am aware of the difference between R and R studio. My question was whether I can use a big file of 24GB in R studio (Desktop)
Apologies for not being clear.
Best Regards
You can do it in RStudio as long as your computer does have enough RAM. The main issue will probably be the time it takes to read the file.