MDS Plot R
0
0
Entering edit mode
4.7 years ago
BioBaby ▴ 20

Hi, I am new to R and need to generate MDS plot for 4 different sample with 3 replicates each, indicate with four different color (replicate should have color).I tried this code:

library("limma")
library("edgeR")
library("ggplot2")
x <- read.delim("IR_all",row.names="gene")
group <- factor(c(1,1,1,2,2,2,3,3,3,4,4,4))
y <- DGEList(counts=x,group=group)
y <- calcNormFactors(y)
design <- model.matrix(~group)
y <- estimateDisp(y,design)
plotMDS(y,col=c(rep("green",3),rep("blue",3),rep("green",3), rep("black",3)))
RNA-Seq • 9.4k views
ADD COMMENT
0
Entering edit mode

...and, voilĂ !, what happened when you tried that code?

Take a look at the example in the EdgeR vignette: MDS plot

ADD REPLY
0
Entering edit mode

i did not generate plot

ADD REPLY
0
Entering edit mode

Which system are you using? Also, is it a remote server? Ensure that you have not already opened the output stream somewhere else by running dev.off() multiple times

ADD REPLY
0
Entering edit mode

no i did not use dev.off().....yes I am using server which give mds plot very late but I got after 6-8 hrs. i already got mds plot with column name itself but i want to define column by specific color and I try this code. but no output even after one day.

ADD REPLY
0
Entering edit mode

You have configured X11 protocol so that the R plot window will open up in your local OS, right? Is there any message after you run plotMDS()? Check that it has not saved the figure to a default PDF name in your working directory on the server itself.

ADD REPLY
0
Entering edit mode

no R plot window open even at local OS......no message came after running plotMDS()...Outfile generate but it is 0 kb.

ADD REPLY
0
Entering edit mode

What is the output of dev.off()?

ADD REPLY
0
Entering edit mode

now I got output...thanks Kevin....now I want to mention that which sample representing which color (legend)....after above code I am giving this code:

 legend("topleft", legend=c("a", "b","c","d"), pch=19,col=c(rep("red",3),rep("blue",3),rep("green",3), rep("black",3)))

but it is giving "a", "b", "c" in Red color and "d" in blue.I want a in red, b in blue, c in green, d in black color....how to do that?

ADD REPLY
0
Entering edit mode
 legend(
  "topleft",
  bty = 'n',
  c("a", "b","c","d"),
  pch = 19,
  fill = c("red", "blue", "green", "black"))
ADD REPLY
0
Entering edit mode

thanks kevin...it works....can you tell me how to give 16 different color......if I am giving by this way ...it goes to new line then it is error.

 plotMDS(y,h,col=c(rep("red",3),rep("blue",3),rep("green",3), rep("black",3), rep("brown",3),rep("cyan",3),rep("yellow",3),rep("pink",3),rep("gray",3),rep("magenta",3),rep("orange",3),rep("seagreen",3),rep("turquoise",3),rep("purple",3)+ ep("skyblue",3), rep("salmon",3), pch=19)
ADD REPLY
0
Entering edit mode

Your colour vector there produces 48 colours (?) Sorry, I now have to catch the train / metro.

ADD REPLY
0
Entering edit mode

yes...i am having 16 sample with 3 replicates....whenever you get time please tell me how to deal with this.

ADD REPLY
1
Entering edit mode

Why don't you try to solve it yourself. This is basic R and solving it yourself using google will help improving yourself.

ADD REPLY

Login before adding your answer.

Traffic: 1247 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6