Hi,
You please imagine I have 23 differenrially expressed genes between tumour (26 samples) and normal (30 samples) tissues.
I have calculated the Pearson correlation values between the expression of these 23 differentially expressed genes in individual samples (56 samples) and the mean of expression of this gene in tumour (cor1)
and normal (cor2)
like below
> head(pred)
cor1 cor2 scores samples
cl1 0.8824150 0.7623499 0.06003256 tomour
cl1.1 0.7928945 0.6831890 0.05485271 tomour
cl1.2 0.8434347 0.7933102 0.02506226 tomour
cl1.3 0.7174795 0.5120342 0.10272268 tomour
cl1.4 0.6571185 0.6084326 0.02434294 tomour
cl1.5 0.5273702 0.6716480 -0.07213889 tomour
> dim(pred) [1] 56 4
And I have calculated a score like so
(cor1 – cor2)/2 (range: −1 to +1)
+1 says this is tomour sample and -1 says this is a normail sample
With such tables how I can represent a correlation plot like this picture? in this plot nicely samples were divided by scores and correlation
By this code
b <- ggplot(pred1, aes(x = tomour, y =normal))
b + geom_point(aes(color =samples, shape = samples))+
geom_smooth(aes(color = samples, fill = samples), method = "lm") +
geom_rug(aes(color =samples)) +
scale_color_manual(values = c("#00AFBB", "#E7B800", "#FC4E07"))+
scale_fill_manual(values = c("#00AFBB", "#E7B800", "#FC4E07"))
I have plotted
But this is not similar to what I want at all
What have you tried? What is the
ggplot
code you have written so far?Side note: Two ways to spell tumor are
tumor
ortumour
. "Toumor" is not a valid word.Hi Thank you
I have found a function to calculate correlation, then I need to plot these correlations
Trying to "adjust" your data to a function found somewhere won't really work well. You have a good grasp on what you need, why not start at the basics and try plotting a correlation plot between two vectors of numbers, then expand step-by-step until you get to where you want? That's how you'll learn, not by trying to fit datasets into random code.
You al right Sorry for that
"I need to complete this soon" cannot be a reason for not learning. If you need to get it done soon, you can always hire an expert to do it for you. You have spent enough time and invested enough effort to take your time and get it done right.