Question: subset sample in phyloseq
gravatar for Bioinfonext
11 days ago by
Bioinfonext140 wrote:

I do have three tissue and three treatment conditions in physeq object. My aim is to only want to use the soil sample and want to see the treatment effect on microbial abundance.

How should I remove other tissue and only retain the soil sample in phyloseq object.

sample details:


Leaf   Root       Soil

And each tissue has given 3 treatment.


T1     T2     T3


next-gen R • 79 views
ADD COMMENTlink modified 11 days ago by genomax64k • written 11 days ago by Bioinfonext140
gravatar for Chris Fields
11 days ago by
Chris Fields2.1k
University of Illinois Urbana-Champaign
Chris Fields2.1k wrote:

You should read the phyloseq documentation for this, there are a ton of examples for subsetting or pruning data. Also:

More specifically, look up the online documentation in R for subset_samples, prune_samples, subset_taxa, and prune_taxa. I also recommend the F1000 paper which is a pretty great walkthrough for phyloseq.

ADD COMMENTlink written 11 days ago by Chris Fields2.1k

Thanks a lot, I tried below code but it is showing error, could please suggest how I can correct this mistake:

> physeq

phyloseq-class experiment-level object

otu_table()   OTU Table:         [ 67405 taxa and 162 samples ]

sample_data() Sample Data:       [ 162 samples by 5 sample variables ]

tax_table()   Taxonomy Table:    [ 67405 taxa by 7 taxonomic ranks ]

phy_tree()    Phylogenetic Tree: [ 67405 tips and 67229 internal nodes ]

> physeq_soil <- subset_samples(physeq, SampleType=="Soil")
Error in eval(e, x, parent.frame()) : object 'SampleType' not found
ADD REPLYlink written 11 days ago by Bioinfonext140

Thanks, I got it, if I replace SampleType with Tissue then its works:

physeq_soil <- subset_samples(physeq, Tissue=="Soil")


ADD REPLYlink written 11 days ago by Bioinfonext140
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 874 users visited in the last hour