Colouring limma MA plot
1
0
Entering edit mode
adam_pgsql ▴ 70
@adam_pgsql-3901
Last seen 9.6 years ago
I am trying to colour a limma generated MA plot by fold change. I can do it this way: status <- bugs.colour(RG,1) attr(status,"values") <- c("nonsignificant", "present", "absent", "Blank", "Buffer", "ACTB", "GAPDH", "Positive") attr(status,"col") <- c("black", "red", "green", "black", "brown", "pink", "yellow", "orange", "grey") plotMA(RG, array=1, status=status) bugs.colour <- function(RG, array) { status <- RG$genes$Status for (i in 1:length(status)) { if (status[i] == "gene") { if is.na(RG$other$LogRatio[i,array])) { status[i] = "nonsignificant" } else if (RG$other$LogRatio[i,array] > 0) { status[i] = "present" } else { status[i] = "absent" } } } status } but this seems to be a bit of a hack has i have hijacked the control status... my question is, is there a better more efficient way to do this? thanks adam
limma limma • 1.3k views
ADD COMMENT
0
Entering edit mode
@wolfgang-huber-3550
Last seen 3 months ago
EMBL European Molecular Biology Laborat…
Hi Adam, Efficiency: have a look at the "ifelse" function for vectorised if-functionality that allows you to avoid the for-loop in your 'bugs.colour' function. Goodness: I don't think you need to be worrying about hijacking the control status for your purpose, since it's the limma::plotMA function that hijacked plot's "col" argument in the first place. However, if this leads to serious trouble, the cleanest is probably to write your own function on top of graphics::plot (or lattice::xyplot), since the added functionality of limma::plotMA is not that complex. Best wishes Wolfgang adam_pgsql scripsit 12/04/10 16:19: > I am trying to colour a limma generated MA plot by fold change. I can do it this way: > > status <- bugs.colour(RG,1) > attr(status,"values") <- c("nonsignificant", "present", "absent", "Blank", "Buffer", "ACTB", "GAPDH", "Positive") > attr(status,"col") <- c("black", "red", "green", "black", "brown", "pink", "yellow", "orange", "grey") > plotMA(RG, array=1, status=status) > > bugs.colour <- function(RG, array) { > status <- RG$genes$Status > > for (i in 1:length(status)) { > if (status[i] == "gene") { > if is.na(RG$other$LogRatio[i,array])) { > status[i] = "nonsignificant" > } > else if (RG$other$LogRatio[i,array] > 0) { > status[i] = "present" > } > else { status[i] = "absent" } > } > } > status > } > > but this seems to be a bit of a hack has i have hijacked the control status... my question is, is there a better more efficient way to do this? > > thanks > > adam > _______________________________________________ > Bioconductor mailing list > Bioconductor at stat.math.ethz.ch > https://stat.ethz.ch/mailman/listinfo/bioconductor > Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor -- Wolfgang Huber EMBL http://www.embl.de/research/units/genome_biology/huber
ADD COMMENT

Login before adding your answer.

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