Metabolomics Society Forum

Software => R => XCMS => Topic started by: AlanP on April 04, 2012, 03:13:06 AM

Title: Passing parameters to the xcmsRaw image method
Post by: AlanP on April 04, 2012, 03:13:06 AM
Hi,
      I think I checked all the obvious answers to this...

How do I change the title, etc. when I create an image of a single chromatogram? Using main="" did not work.

Thanks!

Alan
Title: Re: Passing parameters to the xcmsRaw image method
Post by: Ralf on April 04, 2012, 11:08:17 AM
No it is not implemented to change the title at the moment. The ... are used to pass all additional arguments to profRange(...).
I think the easiest way is to simply copy a few lines of source code and create a function "image2" with the changes that you want, e.g.

Code: [Select]
image2 <- function(x, col = rainbow(256), main="XC/MS Log Intensity Image", ...) {
    sel <- profRange(x, ...)

    zlim <- log(range(x@env$intensity))

    if (zlim[1] < 0) {
        zlim <- log(exp(zlim)+1)
        image(profMz(x)[sel$massidx], x@scantime[sel$scanidx],
              log(x@env$profile[sel$massidx, sel$scanidx]+1),
              col = col, zlim = zlim, main = main, xlab="m/z", ylab="Seconds")
    } else
        image(profMz(x)[sel$massidx], x@scantime[sel$scanidx],
              log(x@env$profile[sel$massidx, sel$scanidx]),
              col = col, zlim = zlim, main = main, xlab="m/z", ylab="Seconds")
}
Title: Re: Passing parameters to the xcmsRaw image method
Post by: AlanP on April 10, 2012, 04:08:05 AM
Ralf,

thanks for the fast reply... Perfect!

In the line of teaching me to fish, instead of giving me fish....

In general, how do I get to see the code? As I understand it, the standard way is typing in functions with no parameters at the command line, but that didn't work in this case.

Thanks for the great support.

Alan
Title: Re: Passing parameters to the xcmsRaw image method
Post by: sneumann on April 10, 2012, 11:56:50 AM
Hi,

just typing the function name does not work for object methods
in R's object orientation with S4 objects.

You can download the xcms source from bioconductor,
http://bioconductor.org/packages/2.11/b ... /xcms.html (http://bioconductor.org/packages/2.11/bioc/html/xcms.html) (Package Sources)
or view files directly in the version control system
https://hedgehog.fhcrc.org/bioconductor ... acks/xcms/ (https://hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/xcms/)
(user: readonly, pass: readonly).

Yours,
Steffen