R中pcpr2包中的Datamatrix格式问题

问题描述

我一直在尝试使用以下教程运行 pcpr2 包:https://github.com/JoeRothwell/pcpr2

此包的数据可在此链接中找到:https://github.com/JoeRothwell/pcpr2/raw/master/data/PCPR2data.RData

我的数据矩阵文件是https://github.com/dtonmoy/PCPR2-data/blob/main/test_matrix.csv

我的元数据文件是https://github.com/dtonmoy/PCPR2-data/blob/main/test_trait.csv

我的代码

transcripts <- read.csv("test_matrix.csv",row.names = 1)

Z_metadata <- read.csv("test_trait.csv")

output <- runPCPR2(transcripts,Z_metadata,pct.threshold = 0.8)

每次我尝试使用我的数据运行 pcpr2 包中的代码时,我都会收到以下错误:

Error in runPCPR2(transcripts,pct.threshold = 0.8) : 
  is.numeric(X_DataMatrix) is not TRUE

我尝试通过以下命令将我的数据矩阵转换为数字格式:

transcripts  = lapply(transcripts,as.double) 

transcripts  = do.call("cbind",transcripts)

然而,这也不起作用。我收到另一条错误消息:

Error in solve.default(crossprod(model.matrix(mod))) : 
  Lapack routine dgesv: system is exactly singular: U[15,15] = 0

我可以看出我的数据矩阵格式有问题,因为数据类型和类与教程中使用的不同。但是,我不明白如何解决这个问题。任何形式的帮助都会得到极大的帮助。

解决方法

导入 test_matrix 数据集时要小心(有行名,它应该是一个矩阵):

transcripts=as.matrix(read.csv("https://raw.githubusercontent.com/dtonmoy/PCPR2-data/main/test_matrix.csv",row.names=1))
Z_metadata=read.csv("https://raw.githubusercontent.com/dtonmoy/PCPR2-data/main/test_trait.csv")

output <- runPCPR2(transcripts,Z_metadata,pct.threshold = 0.8)

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...