r - R:M3C 库 - 重复的 row.names 错误消息
问题描述
我正在尝试使用 R 中的 M3C 库运行共识聚类。我的数据集包含 451 个样本和约 2500 个基因。行名称是基因的 ENTREZ ID(数值)。我已经使用“any(duplicated(colnames(MyData)))”命令交叉检查了数据集,以确保行名中没有重复的条目。我运行以下命令来使用 M3C 库执行共识集群:
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")
谁能帮我解决这个问题?
谢谢
解决方案
我使用 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")
除了:
In addition: Warning message:
non-unique values when setting 'row.names': ‘ABCDEF’, ‘ABCDGH’
我认为这个问题是由于这些特征中的每一个的前四个字符是相等的这一事实引起的。因此,我在运行 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 。
推荐阅读
- c# - 如何在 C# MVC 中的列表中添加对象列表
- ios - 服务器请求 Google Calendar API 使用来自客户端的访问令牌
- ios - 如何使用 iOS Compression Framework 压缩多个文件?
- java - 如何完美隐藏底部导航栏
- jsf - 允许用户以 jsf/adf 形式在日期时间选择器中输入毫秒
- r - 如何将 2 列矩阵转换为数据框表
- amazon-web-services - AWS cognito 机器对机器 oauth
- css - 有角度的 CSS 线性渐变在 Firefox 和边缘中不平滑
- gcloud - 如何获取 gcloud composer 命令的输出?
- angularjs - 如何使用spring mvc和angular js检索数据