R:M3C库-重复的row.names错误消息 [英] R: M3C library - Duplicate row.names error message

查看:232
本文介绍了R:M3C库-重复的row.names错误消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用R中的M3C库运行共识聚类.我的数据集包含451个样本和〜2500个基因.行名称是基因的ENTREZ ID(数值).我已经使用"any(duplicated(colnames(MyData)))"命令对数据集进行了交叉检查,以确保行名中没有重复的条目.我运行以下命令以使用M3C库执行共识性聚类:

I am trying to run consensus clustering using M3C library in R. My dataset contains 451 samples and ~2500 genes. The row names are the ENTREZ IDs (numeric values) of the genes. I have crosschecked the dataset using "any(duplicated(colnames(MyData)))" command to make sure that there is no duplicate entries in the row names. I ran the following command to perform the consensus clustering using M3C library:

res <- M3C(MyData, cores=8, seed = 123, des = annotation, removeplots = TRUE, analysistype = 'chi', doanalysis = TRUE, variable = 'class')

我遇到以下错误:

Warning message:
"non-unique values when setting 'row.names': "

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

1. M3C(MyData, cores = 8, seed = 123, des = meta, removeplots = TRUE, 
 .     analysistype = "chi", doanalysis = TRUE, variable = "class")
2. M3Creal(as.matrix(mydata), maxK = maxK, reps = repsreal, pItem = 0.8, 
 .     pFeature = 1, clusterAlg = clusteralg, distance = distance, 
 .     title = "/home/christopher/Desktop/", printres = printres, 
 .     showheatmaps = showheatmaps, printheatmaps = printheatmaps, 
 .     des = des, x1 = pacx1, x2 = pacx2, seed = seed, removeplots = removeplots, 
 .     silent = silent, doanalysis = doanalysis, analysistype = analysistype, 
 .     variable = variable, fsize = fsize, method = method)
3. `row.names<-`(`*tmp*`, value = newerdes$ID)
4. `row.names<-.data.frame`(`*tmp*`, value = newerdes$ID)
5. `.rowNamesDF<-`(x, value = value)
6. stop("duplicate 'row.names' are not allowed")

任何人都可以帮助我解决问题吗?

Can anyone please help me to resolve the issue?

谢谢

推荐答案

我使用M3C运行了以下内容:

I ran the equivalent of the following using M3C:

df_wide_matrix  # my expression matrix
any(duplicated(colnames(df_wide_matrix)))  # result = FALSE

M3C::M3C(df_wide_matrix, iters=2, repsref=2, repsreal=2, clusteralg="hc", objective="PAC")

除了::我还遇到了与M3C完全相同的错误消息:

I ran into the exact same error message with M3C, in addition to:

In addition: Warning message:
non-unique values when setting 'row.names': ‘ABCDEF’, ‘ABCDGH’ 

我认为问题是由这些功能中每个功能的前四个字符相等引起的.因此,在运行M3C之前,我临时更改了各自的名称:

I assumed the issue is caused by the fact the first four characters of each of these features are equal. I therefore temporarily changed their respective names prior to running M3C:

dup_ids <- which(colnames(dissADJ) %in% c("ABCDEF", "ABCDGH"))
colnames(dissADJ)[dup_ids] <- c("A", "B")

M3C::M3C(df_wide_matrix, iters=2, repsref=2, repsreal=2, clusteralg="hc", objective="PAC")

M3C然后正确运行.不是理想的解决方案,但对我有用-我已将其发布为问题: https://github.com/crj32/M3C/issues/6 .

M3C then runs correctly. Not an ideal solution but worked for me - I've posted it as an issue: https://github.com/crj32/M3C/issues/6.

这篇关于R:M3C库-重复的row.names错误消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆