perSampleDominantTaxa {mia} | R Documentation

## Get dominant taxa

### Description

These functions return information about the most dominant taxa in a `SummarizedExperiment` object.

### Usage

    perSampleDominantTaxa(x, abund_values = "counts", rank = NULL, ...)

    ## S4 method for signature 'SummarizedExperiment'
    perSampleDominantTaxa(x, abund_values = "counts", rank = NULL, ...)

    addPerSampleDominantTaxa(x, name = "dominant_taxa", ...)

    ## S4 method for signature 'SummarizedExperiment'
    addPerSampleDominantTaxa(x, name = "dominant_taxa", ...)

### Arguments

`x` | A `SummarizedExperiment` object.
`abund_values` | A single character value for selecting the `assay` to use for identifying dominant taxa.
`rank` | A single character defining a taxonomic rank. Must be a value of the output of `taxonomicRanks()`.
`...` | Additional arguments passed on to `agglomerateByRank()` when `rank` is specified.
`name` | A name for the column of the `colData` where the dominant taxa will be stored in when using `addPerSampleDominantTaxa`.

### Details

`addPerSampleDominantTaxa` extracts the most abundant taxa in a `SummarizedExperiment` object, and stores the information in the `colData`. It is a wrapper for `perSampleDominantTaxa`.

With `rank` parameter, it is possible to agglomerate taxa based on taxonomic ranks. E.g. if 'Genus' rank is used, all abundances of same Genus are added together, and those families are returned. See `agglomerateByRank()` for additional arguments to deal with missing values or special characters.

### Value

`perSampleDominantTaxa` returns a named character vector `x` while `addPerSampleDominantTaxa` returns `SummarizedExperiment` with additional column in `colData` named `*name*`.

### Author(s)

Leo Lahti, Tuomas Borman and Sudarshan A. Shetty.

### Examples

    data(GlobalPatterns)
    x <- GlobalPatterns

    # Finds the dominant taxa.
    sim.dom <- perSampleDominantTaxa(x, rank="Genus")

    # Add information to colData
    x <- addPerSampleDominantTaxa(x, rank = "Genus", name="dominant_genera")
    colData(x)

[Package mia version 1.2.7 Index]