Re: [R-sig-eco] How to calculate relative abundance along taxonomical hierarchy

2015-06-25 Thread Gian Maria Niccolò Benucci
Thank you guys! I have found a way to do it, rank by rank ("Phylum", "Class", "Order"...) according my dataset. Here is the code I have used: fungi_phyla = tax_glom(fungi, "Phylum") ## extract the taxonomic rank e.g. Phylum tax_table(fungi_phyla) fungi_phyla_ab = transform_sample_counts(fungi_phy

Re: [R-sig-eco] How to calculate relative abundance along taxonomical hierarchy

2015-06-25 Thread Peter Solymos
The tax_table accessor function will give you the taxonomic ranks in a table according to this website: https://web.stanford.edu/class/bios221/labs/phyloseq/lab_phyloseq.html otu_table will give you the data matrix with OTUs as *rows*. So you need to transpose or adjust the code I suggested before

Re: [R-sig-eco] How to calculate relative abundance along taxonomical hierarchy

2015-06-25 Thread Gian Maria Niccolò Benucci
Hello, thank you for the replies. My dataset is something like this: > datafungi BR1 BR2 BR3 BR4 BR5 F1 F2 F3 F4 F5 R1 R2 R3 R4 R5 W1 W2 W3 W4 W5 OTU_1 0.08 0.13 0.56 0.90 0.91 0.36 0.05 0.02 0.13 0.11 0.00 0.00 0.15 0.06 0.00 0.12 0.00 0.00 0.03 0.05 OTU

Re: [R-sig-eco] How to calculate relative abundance along taxonomical hierarchy

2015-06-25 Thread Peter Solymos
Gian, Once you have your samples by OTU matrix row standardized, you can use a level of your hierarchy (a vector matching the columns) and the groupSums(your-matrix, 2, your-groups) function in the mefa4 package to get your relative abundances. Cheers, Peter Gian Maria Niccolò Benucci ezt írta

Re: [R-sig-eco] How to calculate relative abundance along taxonomical hierarchy

2015-06-25 Thread Rich Shepard
On Thu, 25 Jun 2015, Gian Maria Niccolò Benucci wrote: I am working on a fungal dataset with 151 OTUs distributed in 20 samples. I have imported it as phyloseq object and as normal species matrix as well to work with the vegan package. I am trying to find a way to get relative abundances at diff

[R-sig-eco] How to calculate relative abundance along taxonomical hierarchy

2015-06-25 Thread Gian Maria Niccolò Benucci
Hello everyone, I am working on a fungal dataset with 151 OTUs distributed in 20 samples. I have imported it as phyloseq object and as normal species matrix as well to work with the vegan package. I am trying to find a way to get relative abundances at different hierarchical level goruping the abun