Reputation: 1
I'm attempting to run Tax4Fun to predict functional capabilities from 16S data. As the analysis up to this point was carried out in Mothur, I could not use biom as an input (incompatibility between biom versions, which I knew about beforehand).
I converted my mothur biom file to a tsv file as follows:
biom convert -i *biom -o otu_table.txt --header-key taxonomy --table-type "OTU table" --to-tsv
The otu_table.txt file was then used with Tax4Fun:
data<-importQIIMEData("otu_table.txt")
folderReferenceData<- "/nobackup/shared/cgebm/r_packages/Tax4Fun/SILVA119/"
results <- Tax4Fun(data,folderReferenceData)
However I get the following error message:
Error in rownames<-
(*tmp*
, value = c("NC-1.S34", "NC-2.S48", "PC-1.S27", :
length of 'dimnames' [1] not equal to array extent
I've searched Google extensively but have had no luck in finding an a solution! The text file has the dimensions that I would expect and seems to be OK when being loaded into R.
All suggestions welcome!
Upvotes: 0
Views: 2924
Reputation: 309
I'm having the same issue Sophie. Were you able to find a solution?
Edit: I found the solution to this problem.
The issue is how the taxonomy column is formatted.
When you use the Silva reference database (I used Silva119) you would run your script like this:
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/
The KEY is to use the raw taxonomy file. In my case it was the "taxonomy_97_raw_taxa.txt". If you use any of the other taxonomy files it will not work. Once you have ran the pick_open_reference_otus.py you should probably just convert the biom file just to be safe.
biom convert -i Soil_ClosedRef_Silva/otu_table.biom
-o Soil_ClosedRef_Silva/otu_table.txt --to-tsv --header-key taxonomy
Final R code looks like this:
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")
You might need to change the file extension on the resulting .csv file to .txt if it doesn't look right in excel.
Upvotes: 1