Phyloseq sample data error: non-zero dimensions?
0
0
Entering edit mode
6 months ago
Emily ▴ 70

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 • 938 views
ADD COMMENT
0
Entering edit mode

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

ADD REPLY
1
Entering edit mode

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.

ADD REPLY
0
Entering edit mode

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.

ADD REPLY

Login before adding your answer.

Traffic: 1774 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6