This function summarize features on a specific taxonomic level

summarize.features(siamcat, level = 'g__',
                    feature.type='original', verbose=1)

Arguments

siamcat

object of class siamcat-class

level

string, at which level to summarize (e.g. g__ = genus)

feature.type

string, on which type of features should the function work? Can be either "original", "filtered", or "normalized". Please only change this paramter if you know what you are doing!

verbose

integer, control output: 0 for no output at all, 1 for only information about progress and success, 2 for normal level of information and 3 for full debug information, defaults to 1

Value

object of class siamcat-class with a summarized feature table

Details

This function will summarize features at different taxonomic levels, e.g. transform species-level relative abundance into genus-level taxonomic profiles.

The function expects feature names which encode taxonomic information, e.g.

k__Bacteria;p__Actinobacteria;c__Actinobacteria;o__Acidimicrobiales;..

Then, for a given taxonomic level (e.g. g__), the function will sum up all the relative abundances of features belonging to the same group at that specific taxonomic level.

Please note that this function is currently maturing and not necessarily reliable!!!

Examples

## load the phyloseq example data data("GlobalPatterns") feat <- otu_table(GlobalPatterns)[1:500,] label <- create.label(meta=sample_data(GlobalPatterns), label = "SampleType", case = c("Freshwater", "Freshwater (creek)", "Ocean"))
#> Label used as case: #> Freshwater,Freshwater (creek),Ocean #> Label used as control: #> rest
#> + finished create.label.from.metadata in 0.002 s
# rename features to create feature names containing taxonomic information temp <- tax_table(GlobalPatterns)[1:500,] test <- apply(temp, 1, FUN=function(vec){ out <- '' for (i in seq_along(vec)){ end <- ifelse(i == ncol(temp), '', ';') x <- colnames(temp)[i] x2 <- tolower(substr(x, 1, 1)) out <- paste0(out, x2, '__', vec[i], end) } return(out)}) rownames(feat) <- test # run the constructor function siamcat <- siamcat(feat=feat, label=label, verbose=1)
#> Warning: ### Warning: The data do not seem to consist of relative abundances!
#> Data set has only 8 training examples of class Case . #> Note that a dataset this small/skewed is not necessarily suitable for analysis in this pipeline.
#> Data succesfully validated
siamcat <- summarize.features(siamcat, level='g__', verbose=3)
#> + starting summarize.features
#> +++ summarizing on level: g__
#> +++ summarized features table contains: 33 features
#> + finished summarize.features in 0.026 s