Last data update: 2014.03.03

R: Converts vector to matrix based on spot layout
v2mR Documentation

Converts vector to matrix based on spot layout

Description

This functions converts a vector to a matrix based on a given spot layout. Optionally, it produces a 2D-plot.

Usage

v2m(V,Ngc,Ngr,Nsc,Nsr,visu=FALSE,color.lim=c(-1,1),xlab="Columns",ylab="Rows",...) 

Arguments

V

vector of real values

Ngc

number of columns for the grid matrix

Ngr

number of rows for the grid matrix

Nsc

number of columns for the spot matrix

Nsr

number of rows for the spot matrix

visu

If FALSE, MXY plot is generated.

color.lim

Limits of color range for MXY plot

xlab

label of x -axis of MXY plot

ylab

label of y-axis of MXY plot

...

Further optional parameters for the image function generating the MXY plot

Details

The function v2m converts a vector V (as e.g. derived by maM(object)[,index]) to a matrix representing the spatial distribution of the values of V across the array. Note that this function assumes a specific mapping between the data points and the location of spot (i.e. the same mapping rule that is used for marrayRaw/marrayNorm objects.) The validity of this mapping should be carefully checked (see also the documentation of packet marray.) The option for spatial visualisation is rather restricted to logged fold-changes as the corresponding colour range is centred around zero and follows the conventional colouring (green for negative, red for positive fold-changes). The MXY plot produced by v2n does not include a colour bar. To have a colour included, you can use mxy.plot.

Value

A 2D-matrix with (Ngc*Nsc) columns and (Ngr*Nsr) is produced. This matrix represents the spatial distribution of the values of vector V given the print-layout.

Author(s)

Matthias E. Futschik, http://itb.biologie.hu-berlin.de/~futschik

See Also

mxy.plot, m2v, marrayRaw

Examples


# LOADING DATA NOT-NORMALISED
data(sw.olin) 
# CONVERSION FROM VECTOR TO MATRIX
M <- v2m(maM(sw.olin)[,1],Ngc=maNgc(sw.olin),Ngr=maNgr(sw.olin),
         Nsc=maNsc(sw.olin),Nsr=maNsr(sw.olin),visu=TRUE)

# BACK-CONVERSION FROM MATRIX TO VECTOR
V <- m2v(M,Ngc=maNgc(sw.olin),Ngr=maNgr(sw.olin),
             Nsc=maNsc(sw.olin),Nsr=maNsr(sw.olin),visu=TRUE)

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(OLIN)
Loading required package: locfit
locfit 1.5-9.1 	 2013-03-22
Loading required package: marray
Loading required package: limma
> png(filename="/home/ddbj/snapshot/RGM3/R_BC/result/OLIN/v2m.Rd_%03d_medium.png", width=480, height=480)
> ### Name: v2m
> ### Title: Converts vector to matrix based on spot layout
> ### Aliases: v2m
> ### Keywords: manip
> 
> ### ** Examples
> 
> 
> # LOADING DATA NOT-NORMALISED
> data(sw.olin) 
> # CONVERSION FROM VECTOR TO MATRIX
> M <- v2m(maM(sw.olin)[,1],Ngc=maNgc(sw.olin),Ngr=maNgr(sw.olin),
+          Nsc=maNsc(sw.olin),Nsr=maNsr(sw.olin),visu=TRUE)
> 
> # BACK-CONVERSION FROM MATRIX TO VECTOR
> V <- m2v(M,Ngc=maNgc(sw.olin),Ngr=maNgr(sw.olin),
+              Nsc=maNsc(sw.olin),Nsr=maNsr(sw.olin),visu=TRUE)
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>