How to output MDS plot for RNAseq samples with ggplot2?

Dear all.

I am trying to output an MDS plot to understand the relationship between RNAseq data.

I was able to output the MDS plot using “diffExpr.P0.001_C2.matrix” output by edgeR. However, I would like to use ggplot2 to output it in a more readable form.

I have tried the following steps, but I am getting an error.
What is the problem with my pipeline?

Thank you very much for your advices!

> d <- dist(1 - rho)
> d
           Control1   Control2       Dry1       Dry2    DryRec1    DryRec2    PreRec1    PreRec2    Predry1
Control2 0.06502264                                                                                        
Dry1     1.48474438 1.52669729                                                                             
Dry2     1.62197906 1.66162549 0.22807033                                                                  
DryRec1  1.63688521 1.67153910 0.45567746 0.34034233                                                       
DryRec2  1.54150125 1.57960816 0.30996896 0.28957991 0.23296231                                            
PreRec1  1.60822608 1.64742160 0.24699751 0.15173269 0.34458096 0.28891000                                 
PreRec2  1.63382533 1.67045446 0.35367499 0.20514152 0.28429467 0.32059748 0.18160279                      
Predry1  1.54096592 1.58217537 0.15757815 0.19393518 0.42187210 0.29722224 0.18873484 0.30663769           
Predry2  1.63482837 1.67433055 0.25604187 0.11518698 0.33440870 0.29088779 0.13758830 0.19564874 0.18327134
> mds <- cmdscale(d)
> plot(mds, type = "n")
> text(mds, labels = colnames(count))
> mds2 <- as.data.frame(as.matrix(mds))
> ggplot(mds2, aes(x = `1`, y = `2`, color = dex, shape = cell))
Error in FUN(X[[i]], ...) : object '1' not found

> dput(mds2)
structure(list(V1 = c(-1.25870472974072, -1.29753868680971, 0.214130257699255, 
0.359880006140221, 0.354475784656956, 0.269322460991461, 0.34548218958249, 
0.366016370053708, 0.273662948738074, 0.373273398688271), V2 = c(-0.00570676794533206, 
0.0186976427031538, -0.153998283521261, -0.060516886861918, 0.266222331907919, 
0.126701199467327, -0.0536343596445791, 0.0529305521126579, -0.13730725971642, 
-0.0533881685015465)), class = "data.frame", row.names = c("Control1", 
"Control2", "Dry1", "Dry2", "DryRec1", "DryRec2", "PreRec1", 
"PreRec2", "Predry1", "Predry2"))

Read more here: Source link