gene-by-sample matrix or isoform-by-sample matrix. It should be rescaled to values bwteen
[-1,1].
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.
Seq
a vector indicates the sample order obtained from the ENI.
Ndg
degree of polynomial.
NChun
number of starting points for polynomial fitting.
RdmStart
whether the start points are randomly selected.
Value
This function performs the
the 2-opt algorithm to improve the optimal order searching of the Extended Nearest Insertion (ENI).
In each iteration, the function 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 and its SPR MSE.
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 <- ImpShift(rbind(aa,bb,cc), NChun=2)
res2 <- Opt2Shift(rbind(aa,bb,cc), NChun=2, N=50, Seq=res)
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/Opt2Shift.Rd_%03d_medium.png", width=480, height=480)
> ### Name: Opt2Shift
> ### Title: Run the 2-opt algorithm to improve the optimal order searching
> ### of the Extended Nearest Insertion
> ### Aliases: Opt2Shift
>
> ### ** Examples
>
> aa <- sin(seq(0,1,.1))
> bb <- sin(seq(0.5,1.5,.1))
> cc <- sin(seq(0.9,1.9,.1))
> res <- ImpShift(rbind(aa,bb,cc), NChun=2)
| | | 0% | |========== | 14% | |==================== | 29% | |============================== | 43% | |======================================== | 57% | |================================================== | 71% | |============================================================ | 86% | |======================================================================| 100%
> res2 <- Opt2Shift(rbind(aa,bb,cc), NChun=2, N=50, Seq=res)
updated at iteration 1 ; updated at iteration 22 ; >
>
>
>
>
> dev.off()
null device
1
>