R terminated when i try HOPACH in a loop,why?
1
0
Entering edit mode
Xiao Shi ▴ 90
@xiao-shi-1184
Last seen 6.8 years ago
Hi every, When i use MSS in the HOPACH package ,but the R teminated to the shell command line.My script is as follows: ###============== library(som) library(EMV) library(hopach) ## Read data file zheng=read.table(file="/home/jtshi/R/zheng.txt",header=TRUE,row.names= 1) zheng.m=as.matrix(zheng) ## Use knn in the EMV package to estimate the missing value zheng.knn=knn(zheng.m) a=zheng.knn[[1]] ## Caculate the distancematrix for HOPACH zheng.dist<-distancematrix(a,d="euclid") zheng.mss=array(c(0),dim=c(10,10)) ## Then a loop to caculate th MSS value with different SOM cluster number for(i in 2:10){ for(j in 2:10){ zheng.som<-som(a, xdim=i, ydim=j) zheng.visual=zheng.som$visual[,1:2] lable=zheng.visual[,1]+zheng.visual[,2]*i+1 zheng.mss[i,j]=labelstomss(lable,zheng.dist,hierarchical=FALSE) } } ## But the R teminated to shell command line with the following waring message ## R: tnt/vec.h:250: T& TNT::Vector<t>::operator()(TNT::Subscript) [with T = ## double ]: Assertion i <= n_' failed. ## The same thing happens when i try this code on windows. ## Then i try a single run with a set i and j i=7 j=8 zheng.som<-som(a, xdim=i, ydim=j) zheng.visual=zheng.som$visual[,1:2] lable=zheng.visual[,1]+zheng.visual[,2]*i+1 zheng.mss[i,j]=labelstomss(lable,zheng.dist,hierarchical=FALSE) zheng.mss[i,j] [1] 0.3747688 ## So what's wrong with the loop? Any suggestions ?The data file is attached. ## Thanks. [[alternative HTML version deleted]]
hopach hopach • 628 views
0
Entering edit mode
Seth Falcon ★ 7.4k
@seth-falcon-992
Last seen 6.8 years ago
Hi Xiao Shi, Xiao Shi <bioconductor.cn@gmail.com> writes: > When i use MSS in the HOPACH package ,but the R teminated to the shell > command line.My script is as follows: [snip] > ## But the R teminated to shell command line with the following waring > message > ## R: tnt/vec.h:250: T& TNT::Vector<t>::operator()(TNT::Subscript) [with T = > ## double ]: Assertion i <= n_' failed. I'm not familiar with the use of the hopach package. However, the error message suggests to me that you should also try an experiment with i=7, j=3 and see what happens. Also, if you'd like folks to be able to try you data, you may need to make it available on a website for download --- that is generally a much better approach than attaching to a post to this list (most attachments are stripped, which is a good thing for virus and spam reasons). Best, + seth