This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Phyloseq sample data error: non-zero dimensions?

I'm trying to filter/extract out individuals from the genetic data that has a gut gene data. Got an Error message saying that my Phyloseq object (sample_data) is zero dimension but when I looked at the gut_phyloseq object attribute, it said Name: sam_data Type: list[128x185] (phyloseq::sample_data) Value: A data.frame with 128 and 185 columns Where is the problem and why is it saying that my phyloseq sample_data object is zero-dimension?

Full code of what I was working on:

# Get SampleID from the host genetic data

dis_mtx_file <- "plinkdismtx.gut.mdist.id"
dis_mtx <- read.table(dis_mtx_file, header = FALSE, stringsAsFactors = FALSE)
sample_ids_with_dis <- dis_mtx$V1

# Filter out individuals data who also have the gut data, then we extract those gut data out.
gut_phyloseq <- readRDS('gut_phyloseq.rds')
filt_physeq <- subset_samples(gut_phyloseq, sample_names(gut_phyloseq) %in% sample_ids_with_dis)

> Error in validObject(.Object) : 
  invalid class “sample_data” object: Sample Data must have non-zero dimensions.
r object phyloseq gwas

I think it would be helpful to reformat the structure of your post. It is difficult to read and unclear what your question is.

Edited the post. I dont understand why R is saying my sample_data object for phyloseq is zero-dimension when it shouldn't be but not sure where I made the mistake to get that error.

You are likely receiving this error because this expression does not evaluate to TRUE:

sample_names(gut_phyloseq) %in% sample_ids_with_dis

In other words, none of the sample names returned by sample_names() match any of the sample names in sample_ids_with_dis. You can verify this by running the following:

 any(sample_names(gut_phyloseq) %in% sample_ids_with_dis)

If this evaluates to FALSE, then I would recommend inspecting the content of these two objects to diagnose the issue.

0 answers

No answers yet.

Log in to answer this question.