MA plot in R
1
0
Entering edit mode
g.k • 0
@gk-13275
Last seen 6.0 years ago

hello,

I want to draw an MA plot  using plotWithHighlights() in R,

however there are 2 simple arguments needed for this function which I'm not understanding how to use: status, and values. If someone can help me with them and probably give an example it would be great.

Thank you very much

rstudio r plotMA • 5.2k views
ADD COMMENT
1
Entering edit mode
Guido Hooiveld ★ 4.1k
@guido-hooiveld-2020
Last seen 2 days ago
Wageningen University, Wageningen, the …

Did you already check the help pages?

> library(limma)
> ?plotWithHighlights()


Then see:

status: character vector giving the control status of each point, of same length as x and y. If NULL, then all points are plotted in the background color, symbol and size.

values: character vector giving values of status to be highlighted on the plot. Defaults to unique values of status in decreasing order of frequency, with the most frequent value set as the background value. Ignored if there is no status vector.

... and the example code on that page.

 

Please note that usually you don't want to use the function plotWithHighlights() directly, but rather call it through e.g. the functions plotMA() or plotMD().

You may also want to see the limma user guide paragraph 4.10 (The Spot Types File) for some background on 'types' (aka 'status') and 'values', and 16.3.5 (Weaver Mutant Mice: A Composite 2x2 Factorial Experiment) or 18.1.9 (specifically page 123-124 [plotMD()]) for  application.

 

Finally, for example when reading in Agilent arrays using limma, the (control) status of each probe is (automatically) in RG$genes$ControlType (1=pos ctrl, -1=neg ctrl, 0=regular probe).

 

 

Example when using the raw data downloaded from this dataset:

library(limma)
> GSMfiles <- dir(".", "^GSM")
> GSMfiles
 [1] "GSM1568415_H13.6WTLi1_2_1.txt.gz"  "GSM1568416_H14.6WTLi2_2_2.txt.gz"
 [3] "GSM1568417_H15.6WTLi3_2_3.txt.gz"  "GSM1568418_H16.12WTLi1_2_4.txt.gz"
 [5] "GSM1568419_H17_12WTLi2_1_1.txt.gz" "GSM1568420_H18_12WTLi3_1_2.txt.gz"
 [7] "GSM1568421_H19_6KOLi1_1_3.txt.gz"  "GSM1568422_H20_6KOLi2_1_4.txt.gz"
 [9] "GSM1568423_H21_6KOLi3_2_1.txt.gz"  "GSM1568424_H22_12KOLi1_2_2.txt.gz"
[11] "GSM1568425_H23_12KOLi2_2_3.txt.gz" "GSM1568426_H24_12KOLi3_2_4.txt.gz"
>
>
> RG <- read.maimages(GSMfiles,source="agilent",green.only=TRUE)

> plotMA(RG, status=RG$genes$ControlType, values=c("1"))
>
#The above generates a MA plot for the 1st array vs the average of all other arrays.
#Only the positive controls are colored (because of values = c("1"))
#Just ignore the warning that pops up when the plot is generated!.

 

 

ADD COMMENT

Login before adding your answer.

Traffic: 873 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