meltAssay {mia} | R Documentation

## Converting a `SummarizedExperiment` object into a long data.frame

### Description

`meltAssay` Converts a `SummarizedExperiment` object into a long data.frame which can be used for `tidyverse`-tools.

### Usage

    meltAssay(
      x,
      abund_values = "counts",
      add_row_data = NULL,
      add_col_data = NULL,
      feature_name = "FeatureID",
      sample_name = "SampleID",
      ...
    )

    ## S4 method for signature 'SummarizedExperiment'
    meltAssay(
      x,
      abund_values = "counts",
      add_row_data = NULL,
      add_col_data = NULL,
      feature_name = "FeatureID",
      sample_name = "SampleID",
      ...
    )

### Arguments

`x` | A numeric matrix or a `SummarizedExperiment`
`abund_values` | a `character` value to select an `assayNames`
`add_row_data` | `NULL`, `TRUE` or a `character` vector to select information from the `rowData` to add to the molten assay data. If `add_row_data = NULL` no data will be added, if `add_row_data = TRUE` all data will be added and if `add_row_data` is a `character` vector, it will be used to subset to given column names in `rowData`. (default: `add_row_data = NULL`)
`add_col_data` | `NULL`, `TRUE` or a `character` vector to select information from the `colData` to add to the molten assay data. If `add_col_data = NULL` no data will be added, if `add_col_data = TRUE` all data will be added and if `add_col_data` is a `character` vector, it will be used to subset to given column names in `colData`. (default: `add_col_data = NULL`)
`feature_name` | a `character` scalar to use as the output's name for the feature identifier. (default: `feature_name = "FeatureID"`)
`sample_name` | a `character` scalar to use as the output's name for the sample identifier. (default: `sample_name = "SampleID"`)
`...` | optional arguments: check_names A boolean value passed to data.frame function's check.name argument. Determines if sample names are checked that they are syntactically valid variable names and are not duplicated. If they are not, sample names are modified. (default: `check_names = TRUE`)

### Details

If the `colData` contains a column “SampleID” or the `rowData` contains a column “FeatureID”, they will be renamed to “SampleID_col” and “FeatureID_row”, if row names or column names are set.

### Value

A `tibble` with the molten data. The assay values are given in a column named like the selected assay `abund_values`. In addition, a column “FeatureID” will contain the rownames, if set, and analogously a column “SampleID” with the colnames, if set

### Author(s)

Sudarshan A. Shetty

### Examples

    data(GlobalPatterns)
    molten_se <- meltAssay(GlobalPatterns,
                           abund_values = "counts",
                           add_row_data = TRUE,
                           add_col_data = TRUE
                           )
    molten_se

[Package mia version 1.2.7 Index]