Clustering by M3C package : Error in `[.data.frame`(df, neworder2) : undefined columns selected

Viewed 302

I had a similar problem to what posted here. To resolve the issue, followed the answer by @Jack Gisby there. Now a new error showed up:

Working on TCGA data , I am getting the same error (first error):

Error in `.rowNamesDF<-`(x, value = value) : 
  duplicate 'row.names' are not allowed

running duplicated() on each relevant field returned FALSE.

Her is the second error (just after trimming identifiers to not start with a common string like "TCGA-"):

Error in `[.data.frame`(df, neworder2) : undefined columns selected
> traceback()
5: stop("undefined columns selected")
4: `[.data.frame`(df, neworder2)
3: df[neworder2]
2: M3Creal(as.matrix(mydata), maxK = maxK, reps = repsreal, pItem = pItem, 
       pFeature = 1, clusterAlg = clusteralg, distance = distance, 
       title = "/home/christopher/Desktop/", des = des, lthick = lthick, 
       dotsize = dotsize, x1 = pacx1, x2 = pacx2, seed = seed, removeplots = removeplots, 
       silent = silent, fsize = fsize, method = method, objective = objective)
1: M3C(pro.vst, des = clin, removeplots = FALSE, iters = 25, objective = "PAC", 
       fsize = 8, lthick = 1, dotsize = 1.25)

I've added to an opened issue on the M3C GitHub.

1 Answers

I got the same error as Hamid Ghaedi while running M3C. I managed to track it down to the following line of code (line 476 on the M3C.R file):

df <- data.frame(m_matrix)

Many of my sample names (column names) started with a number and the data.frame() function added an "X" to the beginning of each name that started with a number ("1" becomes "X1"). This caused a mismatch with the names listed in neworder2.

To get around this problem, I changed all of my sample names to start with a letter and M3C is now running correctly.

Edit: This workaround can be easily applied by using the data.frame() function on your input dataset before running M3C.

Related