Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tyring to subset phyloseq object - error sample data must have no zero dimensions #1467

Open
Avtober opened this issue May 20, 2021 · 3 comments

Comments

@Avtober
Copy link

Avtober commented May 20, 2021

Hi, I imported my files from qiime2 into a phyloseq object:

physeq1<-qza_to_phyloseq(
features="DADA2-table4.qza",
tree="rooted-tree4.qza",
"NCBI_LSURef_97_10_uniq_5-8-300_classification_blast.qza",
metadata = "metadata-1.txt")
physeq1

phyloseq-class experiment-level object
otu_table() OTU Table: [ 1842 taxa and 192 samples ]
sample_data() Sample Data: [ 192 samples by 5 sample variables ]
tax_table() Taxonomy Table: [ 1842 taxa by 7 taxonomic ranks ]
phy_tree() Phylogenetic Tree: [ 1842 tips and 1840 internal nodes ]

I then tried to split my data into samples from Namibia and from South Africa and used the following code:

Namdata <- subset_samples(physeq1, country %in% c("Namibia"))

and got the following error message:
Error in validObject(.Object) :
invalid class “sample_data” object: Sample Data must have non-zero dimensions.

When I look at the head of my Sample data it looks like this:
head(sample_data(physeq1))
Sample Data: [6 samples by 5 sample variables]:
snail.id country site morph.id.genus
020221-AT-1 N.1A.Lym1.5 Namibia 1A Lymnaea/Radix
020221-AT-10 N.1D.Bul1.3 Namibia 1D Bulinus
020221-AT-100 SA.1Db.Biom.un South Africa 1D Biomphlaria
020221-AT-101 SA.1D.Bmp.1 South Africa 1D Biomphlaria
020221-AT-102 SA.5A.Bmp.1 South Africa 5A Biomphlaria
020221-AT-103 SA.5A.Bmp.2 South Africa 5A Biomphlaria
shedding
020221-AT-1 no
020221-AT-10 no
020221-AT-100 no
020221-AT-101 no
020221-AT-102 no
020221-AT-103 no

Not sure if it is in the right format as it is a .txt file but it was working in qiime2

Thanks
Anya

@spholmes
Copy link
Contributor

spholmes commented May 20, 2021 via email

@Avtober
Copy link
Author

Avtober commented May 20, 2021

Hi Susan,
Thanks for your reply, I had a look at my data and noticed that "Namibia" was actually "Namibia ". Adding the space into my code fixed the problem!

Best, Anya

@spholmes
Copy link
Contributor

spholmes commented May 20, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants