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

Gian Maria Niccolò Benucci gian.benucci at gmail.com
Thu Jun 25 18:11:27 CEST 2015


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_35  0.01 0.01 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
0.00 0.00 0.00 0.01 0.00 0.01 0.06
OTU_4   0.01 0.00 0.00 0.00 0.00 0.00 0.01 0.31 0.08 0.00 0.07 0.05 0.00
0.00 0.00 0.00 0.00 0.07 0.41 0.00
OTU_3   0.00 0.00 0.00 ...

So I do not have the taxonomic hierarchy inside the normal dataset, but
only the OTUs.

Anyway, have taxonomic ranks embedded it in the phyloseq object:

> fungi
phyloseq-class experiment-level object
otu_table()   OTU Table:         [ 150 taxa and 20 samples ]
sample_data() Sample Data:       [ 20 samples by 5 sample variables ]
tax_table()   Taxonomy Table:    [ 150 taxa by 7 taxonomic ranks ]

That's I wondered why to do it using this kind of data. I think that many
other researcher that work with huge species dataset (this one is not very
big but I worked with thousands of OTUs) will have this problem.
Do you have an idea how to deal with this kind of data object?
Thank you,
Gian





On 25 June 2015 at 11:51, Peter Solymos <solymos at ualberta.ca> wrote:

> 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 <gian.benucci at gmail.com> ezt írta (2015.
> június 25., csütörtök):
>
>> 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 abundances of the OTUs present in my
>> dataset. For example, if I want to know what is the relative abundance of
>> each Phylum (or of each Family, or each Genus) how can I do? There is a
>> way
>> to do that inside R?
>> Thank you very much in advance,
>>
>>
>> --
>> ​Gian​
>>
>>
>>
>> *----- Do not print this email unless you really need to. Save paper and
>> protect the environment! -----*
>>
>>         [[alternative HTML version deleted]]
>>
>> _______________________________________________
>> R-sig-ecology mailing list
>> R-sig-ecology at r-project.org
>> https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
>
>
>
> --
> --
> Péter Sólymos
> 780-492-8534 | solymos at ualberta.ca | peter.solymos.org
> Alberta Biodiversity Monitoring Institute http://www.abmi.ca
> Boreal Avian Modelling Project http://www.borealbirds.ca
>
>


-- 


*----- Do not print this email unless you really need to. Save paper and
protect the environment! -----*

	[[alternative HTML version deleted]]



More information about the R-sig-ecology mailing list