metadata <-readr::read_tsv(“metadata_for78_SeqLib_2021.tsv”, comment = “#q2:type”)
ASV_35K<-read_qza(“asv_or100_feature-table_78_relfreq.qza”)
count_tab ← ASV_35K$data %>% as.data.frame() %>%
rownames_to_column(“Feature.ID”)
fit_adjust_batch ← adjust_batch(feature_abd = count_tab, batch = “SeqLib”, covariates = NULL, data = metadata, control = list(verbose = FALSE))
Error in floor(feature_abd) : :
non-numeric argument to mathematical function!
I coded in string for count_tab, str(count_tab), and the first column has class of chr, how to I stop R from reading the first column?
metadata_for78_SeqLib_2021.tsv (11.9 KB)
I also have a qza file but it work upload. If anyone can give insight.on how to upload that here.
The feature_abd
argument should be a matrix, and having rownames should be alright. I think changing the command creating count_tab
to the following should fix your problem:
count_tab ← ASV_35K$data %>% as.data.frame() %>% as.matrix()
Thank you for your insight, when changing it to that, it now shows error in rownames_to _column(., “Feature.ID”): is.data.frame(def) is not TRUE
I am working with @katejane. I found the solution to my error. For those working with the qiime2r package to import files for this package, I had to also add column_to_rownames(“SampleID”) to my metadata file:
metadata <-readr::read_tsv("metadata.tsv", comment = "#q2:type") %>% as.data.frame() %>% column_to_rownames("SampleID")
ASV<-read_qza("asv_feature-table.qza")
count_tab <- ASV$data %>% as.data.frame() %>% as.matrix()
Thanks.