Last data update: 2014.03.03

R: Run Extended Nearest Insertion and 2-opt on a gene cluster...
NISFunR Documentation

Run Extended Nearest Insertion and 2-opt on a gene cluster identified by OscopeKM function

Description

Run Extended Nearest Insertion and 2-opt on a gene cluster identified by OscopeKM function

Usage

NISFun(ClusterList, DataIn, i, Ndg=3, NChun=4, RdmStart=FALSE, N=20000, NCThre=1000)

Arguments

ClusterList

a list of gene clusters. Each sublist contains a vector of gene names.

DataIn

gene-by-sample matrix or isoform-by-sample matrix.It should be rescaled to values bwteen [-1,1].

i

the cluster of interest. If the second cluster in ClusterList is of interest, specify i=2.

Ndg

degree of polynomial.

NChun

number of starting points for polynomial fitting.

RdmStart

whether the start points are randomly selected.

N,NCThre

The 2-opt algorithm will stop if N iterations has been performed or if the optimal order remains unchanged for over NCThre iterations.

Value

This function performs the extended nearest insertion (ENI) and 2-opt algorithm to a particular cluster identified by OscopeKM function. The ENI algorithm searchs for the optimal sample order which minimizes the MSE of sliding polynomial regression (SPR). This function will call PipeShiftCDF() function, which fits SPR to each row of the data. For each gene/isoform, SPR fits NChun polynomial curves with different starting points (samples). The samples with smaller order than the start point will be appended to follow the last sample when fitting. So each fitting consider same number of samples. If RdmStart = TRUE, the start points are randomly selected. Otherwise they are evenly sampled along the sample order. The aggregated MSE of a fit (using a specific start point) is defined as the summation of the MSEs of all genes/isoforms considered here. The MSE of the SPR is defined as the largest aggregated MSE across fits using different start points. The output of PipeShiftCDF() returns the optimal order which provides the smallest SPR MSE. The 2-opt algorithm is then applied to improve the optimal order searching of the ENI. In each iteration, 2-opt algorithm will randomly choose two points (samples), the flip the samples between these two points. The new order will be adapted if it provides smaller SPR MSE. The output returns the optimal order for the cluster of interest.

Author(s)

Ning Leng

Examples

aa <- sin(seq(0,1,.1))
bb <- sin(seq(0.5,1.5,.1))
cc <- sin(seq(0.9,1.9,.1))
res <- NISFun(list(c("aa","bb"),"cc"), rbind(aa,bb,cc),i=1, NChun=2, N=50)

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(Oscope)
Loading required package: EBSeq
Loading required package: blockmodeling
Loading required package: gplots

Attaching package: 'gplots'

The following object is masked from 'package:stats':

    lowess

Loading required package: testthat
Loading required package: cluster
Loading required package: BiocParallel
> png(filename="/home/ddbj/snapshot/RGM3/R_BC/result/Oscope/NISFun.Rd_%03d_medium.png", width=480, height=480)
> ### Name: NISFun
> ### Title: Run Extended Nearest Insertion and 2-opt on a gene cluster
> ###   identified by OscopeKM function
> ### Aliases: NISFun
> 
> ### ** Examples
> 
> aa <- sin(seq(0,1,.1))
> bb <- sin(seq(0.5,1.5,.1))
> cc <- sin(seq(0.9,1.9,.1))
> res <- NISFun(list(c("aa","bb"),"cc"), rbind(aa,bb,cc),i=1, NChun=2, N=50)
ENI of ; inserting samples:
   |                                                                               |                                                                      |   0%   |                                                                               |==========                                                            |  14%   |                                                                               |====================                                                  |  29%   |                                                                               |==============================                                        |  43%   |                                                                               |========================================                              |  57%   |                                                                               |==================================================                    |  71%   |                                                                               |============================================================          |  86%   |                                                                               |======================================================================| 100%
2-opt of 
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>