Question: subset sample in phyloseq
0
gravatar for Bioinfonext
8 months ago by
Bioinfonext170
Korea
Bioinfonext170 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:

summary(sample_data(physeq)$Tissue)

Leaf   Root       Soil

And each tissue has given 3 treatment.

summary(sample_data(physeq)$Treatment)

T1     T2     T3

Thanks

next-gen R • 1.4k views
ADD COMMENTlink modified 8 months ago by genomax74k • written 8 months ago by Bioinfonext170
1
gravatar for Chris Fields
8 months 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:

https://joey711.github.io/phyloseq/preprocess.html

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 8 months 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 8 months ago by Bioinfonext170
1

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

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

Thanks

ADD REPLYlink written 8 months ago by Bioinfonext170

Hello,

I subset my data (based on only one time point) in phyloseq and wanted to performed a PCoA only with this subset but I still have the all dataset that appear in my PCoA even if the unwanted samples are not any more labelled.

Global subset:

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

After subsetting:

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

Any idea? Thanks,

ADD REPLYlink modified 3 months ago • written 3 months ago by nichecanicheca0

You only have subset samples not taxa, you need to remove taxa which have 0 counts in your all samples. look at the prune_taxa command.

ADD REPLYlink written 3 months ago by Bioinfonext170
Please log in to add an answer.

Help
Access

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