Tax4Fun - 'dimnames'[1]的错误长度不等于数组范围

时间:2016-03-10 16:43:25

标签: r mothur

我正在尝试运行Tax4Fun来预测16S数据的功能。由于到目前为止的分析是在Mothur进行的,我不能使用biom作为输入(biom版本之间的不兼容性,我之前已经知道)。

我将我的mothur biom文件转换为tsv文件,如下所示: biom convert -i *biom -o otu_table.txt --header-key taxonomy --table-type "OTU table" --to-tsv 然后将otu_table.txt文件与Tax4Fun一起使用: data<-importQIIMEData("otu_table.txt") folderReferenceData<- "/nobackup/shared/cgebm/r_packages/Tax4Fun/SILVA119/" results <- Tax4Fun(data,folderReferenceData)

但是我收到以下错误消息: rownames<-中的错误(*tmp*,值= c(“NC-1.S34”,“NC-2.S48”,“PC-1.S27”,:   'dimnames'[1]的长度不等于数组范围

我已经广泛搜索过Google,但却没有找到解决方案的运气!文本文件具有我期望的尺寸,并且在加载到R中时似乎没问题。

欢迎所有建议!

1 个答案:

答案 0 :(得分:1)

我有同样的问题索菲。你能找到解决方案吗?

编辑:我找到了解决这个问题的方法。

问题在于如何格式化分类列。

当您使用席尔瓦参考数据库(我使用Silva119)时,您可以像这样运行脚本:

pick_closed_reference_otus.py -i CombinedFasta_soil/combined_seqs.fna 
-r Silva119_release/rep_set/97/Silva_119_rep_set97.fna 
-t Silva119_release/taxonomy/97/taxonomy_97_raw_taxa.txt 
-o Soil_ClosedRef_Silva/

KEY是使用原始分类法文件。就我而言,它是“taxonomy_97_raw_taxa.txt”。如果您使用任何其他分类法文件,它将无法正常工作。一旦你运行了pick_open_reference_otus.py,你应该只是转换biom文件只是为了安全。

biom convert -i Soil_ClosedRef_Silva/otu_table.biom 
-o Soil_ClosedRef_Silva/otu_table.txt --to-tsv --header-key taxonomy

最终的R代码如下所示:

file <- "otu_table.txt"
QiimeData <- importQIIMEData(file)
print(QiimeData)
# SO is my dir for SO answer work
folderReferenceData <- "~/Downloads/Tax4FunData/SILVA119/"
Tax4FunOutput <- Tax4Fun(QiimeData, folderReferenceData, fctProfiling 
=TRUE, refProfile = "UProC", shortReadMode = TRUE, normCopyNo = TRUE)
print(Tax4FunOutput)
Tax4FunProfile <- Tax4FunOutput$Tax4FunProfile
Tax4FunProfile <- data.frame(t(Tax4FunOutput$Tax4FunProfile))
View(Tax4FunProfile)
#save to excel 
write.table(Tax4FunProfile,"Tax4FunProfile_Export.csv",sep="\t")

如果在.cel文件中看起来不正确,您可能需要将生成的.csv文件的文件扩展名更改为.txt。

相关问题