This function summarize features on a specific taxonomic level
summarize.features(siamcat, level = 'g__', feature.type='original', verbose=1)
object of class siamcat-class
string, at which level to summarize (e.g.
string, on which type of features should the function
work? Can be either
integer, control output:
object of class siamcat-class with a summarized feature table
This function will summarize features at different taxonomic levels, e.g. transform species-level relative abundance into genus-level taxonomic profiles.
The function expects a SIAMCAT object that either contains an entry in the phyloseqtax_table slot of its phyloseq object, OR a set of feature names which encode taxonomic information, e.g.
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!!!
## load the phyloseq example data data("GlobalPatterns") ## create an example label 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.003 s # run the constructor function siamcat <- siamcat(phyloseq=GlobalPatterns, label=label, verbose=1) #> Warning: ### Warning: The data do not seem to consist of relative abundances! (values ranging between 0 and 1) #> Data set has a limited number of training examples: #> rest 18 #> Case 8 #> Note that a dataset this small/skewed is not necessarily suitable for analysis in this pipeline. #> Data succesfully validated siamcat <- summarize.features(siamcat, level='Genus', verbose=3) #> + starting summarize.features #> +++ summarizing on level: Genus #> +++ summarized features table contains: 984 features #> Warning: Tax table does not seem to be consistent in all cases... #> Will be collapsed at level Genus #> Warning: Phylogenetic tree in original SIAMCAT object had to be deleted... #> + finished summarize.features in 1.56 s