ransy: Ratio Analysis NMR SpectroscopY

Description Usage Arguments Details Author(s) References See Also Examples

Description

Starting from a specified variable (matrix column) called 'driver', it calculates the ratio between this variable and all the other variables in the dataset, returning a barplot indicating the ratio values calculated between the driver and the other variables. This function may help with NMR molecular identification and assignment.

Usage

1
ransy(scaling, driver.peak)

Arguments

scaling

a character string indicating the name of the scaling previously used with the function 'explore.data'

driver.peak

An integer indicating the column number of the dataset to use as 'driver peak'.

Details

'driver.peak' can be chosen through the function 'chose.driver' (see ?chose.driver), which lists all the variables (column names) present in the dataset.

A barplot is generated color-coded for the ratio values calculated between the driver and the other variables. This plot is written within the directory 'RANSY', in the working directory.

Author(s)

Edoardo Gaude, Dimitrios Spiliotopoulos, Francesca Chignola, Silvia Mari, Andrea Spitaleri and Michela Ghitti

References

Wei, S. et al. Ratio Analysis Nuclear Magnetic Resonance Spectroscopy for Selective Metabolite Identification in Complex Samples. (2011) Anal Chem 83(20):7616-7623.

See Also

chose.driver, stocsy.1d

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
## The function is currently defined as
function (scaling, driver.peak) 
{
    pwd.n = paste(getwd(), "/Preprocessing_Data_", scaling, "/ProcessedTable.csv", 
        sep = "")
    x <- read.csv(pwd.n, sep = ",", header = TRUE)
    x.x <- x[, 2:ncol(x)]
    rownames(x.x) <- x[, 1]
    x.t <- x.x
    one = matrix(rep(1, ncol(x.t)), nrow = 1)
    driver = x.t[, driver.peak] %*% one
    D = x.t/driver
    m = matrix(colMeans(D), nrow = 1)
    sd = matrix(apply(D, 2, sd), nrow = 1)
    R = m/sd
    R[, driver.peak] = 1
    R[, driver.peak] = max(R)
    Rt = t(R)
    library(gplots)
    plot(Rt, type = "h", main = paste("RANSY (", rownames(x.x)[driver.peak], 
        ")", sep = ""), ylab = paste("Mean/sd of ratio with ", 
        rownames(x.x)[driver.peak], sep = ""), xlab = "Variables")
    text(Rt, labels = colnames(x.x), cex = 0.6)
    dirout = paste(getwd(), "/RANSY/", sep = "")
    dir.create(dirout)
    out = paste(dirout, "ransy_", colnames(x.x)[driver.peak], 
        ".pdf", sep = "")
    dev.copy2pdf(file = out)
  }

muma documentation built on May 2, 2019, 9:45 a.m.