joey711 / phyloseq

phyloseq is a set of classes, wrappers, and tools (in R) to make it easier to import, store, and analyze phylogenetic sequencing data; and to reproducibly share that data and analysis with others. See the phyloseq front page:
http://joey711.github.io/phyloseq/
581 stars 187 forks source link

MicroViz error Error in (function (cond) : error in evaluating the argument 'object' in selecting a method for function 'otu_table': Can't find column `OTU_ID` in `.data`. #1740

Open Jesuk555 opened 6 months ago

Jesuk555 commented 6 months ago

Hello, I am currently using microViz for beta diversity analysis with OTUID, OTU_ID, taxonomy, and sampleid data from txt files. I tried running the following script to obtain my phyloseq files:

sampledata <- table_dataASCII |>
  column_to_rownames(var = "SampleID") |> 
  sample_data()

otutable  <- feattab |>
  column_to_rownames(var = "OTUID") |> 
  as.matrix() |> 
  otu_table(taxa_are_rows = TRUE)

otutable_RARY  <- feattab_rare |>
  column_to_rownames(var = "OTU_ID") |> 
  as.matrix() |> 
  otu_table(taxa_are_rows = TRUE)

taxatable  <- taxonomy |>
  column_to_rownames(var = "Feature.ID") |> 
  as.matrix() |> 
  tax_table()

Sampledata and taxatable were created successfully. The problem arises when attempting to create the OTU tables, and the following errors occur:

> otutable  <- feattab |>
+   column_to_rownames(var = "OTUID") |> 
+   as.matrix() |> 
+   otu_table(taxa_are_rows = TRUE)
Error in (function (cond)  : 
  error in evaluating the argument 'object' in selecting a method for function 'otu_table': Can't find column `OTUID` in `.data`.
> otutable_RARY  <- feattab_rare |>
+   column_to_rownames(var = "OTU_ID") |> 
+   as.matrix() |> 
+   otu_table(taxa_are_rows = TRUE)
Error in (function (cond)  : 
  error in evaluating the argument 'object' in selecting a method for function 'otu_table': Can't find column `OTU_ID` in `.data`.

Captura de pantalla 2024-03-26 100954 Captura de pantalla 2024-03-26 101032 I have checked, and the tables appear to be correct; they do have "OTUID" and "OTU_ID" as the first column. Do you know how to solve this problem

david-barnett commented 6 months ago

from the screenshot, it looks like your colnames are actually V1 V2 etc, so maybe it will help to check you read the data files (excel or tsv or csv etc) into R correctly, with the first row as names