meltAssay
Converts a
SummarizedExperiment
object into a
long data.frame which can be used for tidyverse
-tools.
meltAssay(
x,
assay.type = assay_name,
assay_name = "counts",
add_row_data = NULL,
add_col_data = NULL,
feature_name = "FeatureID",
sample_name = "SampleID",
...
)
# S4 method for SummarizedExperiment
meltAssay(
x,
assay.type = assay_name,
assay_name = "counts",
add_row_data = NULL,
add_col_data = NULL,
feature_name = "FeatureID",
sample_name = "SampleID",
...
)
A numeric matrix or a
SummarizedExperiment
a character
value to select an
assayNames
a single character
value for specifying which
assay to use for calculation.
(Please use assay.type
instead. At some point assay_name
will be disabled.)
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
)
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
)
a character
scalar to use as the output's name
for the feature identifier. (default: feature_name = "FeatureID"
)
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
)
A tibble
with the molten data. The assay values are given in a
column named like the selected assay assay.type
. In addition, a
column “FeatureID” will contain the rownames, if set, and analogously
a column “SampleID” with the colnames, if set
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.
data(GlobalPatterns)
molten_tse <- meltAssay(GlobalPatterns,
assay.type = "counts",
add_row_data = TRUE,
add_col_data = TRUE
)
molten_tse
#> # A tibble: 499,616 × 17
#> FeatureID SampleID counts Kingdom Phylum Class Order Family Genus Species
#> <fct> <fct> <dbl> <chr> <chr> <chr> <chr> <chr> <chr> <chr>
#> 1 549322 CL3 0 Archaea Crenarcha… Ther… NA NA NA NA
#> 2 549322 CC1 0 Archaea Crenarcha… Ther… NA NA NA NA
#> 3 549322 SV1 0 Archaea Crenarcha… Ther… NA NA NA NA
#> 4 549322 M31Fcsw 0 Archaea Crenarcha… Ther… NA NA NA NA
#> 5 549322 M11Fcsw 0 Archaea Crenarcha… Ther… NA NA NA NA
#> 6 549322 M31Plmr 0 Archaea Crenarcha… Ther… NA NA NA NA
#> 7 549322 M11Plmr 0 Archaea Crenarcha… Ther… NA NA NA NA
#> 8 549322 F21Plmr 0 Archaea Crenarcha… Ther… NA NA NA NA
#> 9 549322 M31Tong 0 Archaea Crenarcha… Ther… NA NA NA NA
#> 10 549322 M11Tong 0 Archaea Crenarcha… Ther… NA NA NA NA
#> # ℹ 499,606 more rows
#> # ℹ 7 more variables: X.SampleID <fct>, Primer <fct>, Final_Barcode <fct>,
#> # Barcode_truncated_plus_T <fct>, Barcode_full_length <fct>,
#> # SampleType <fct>, Description <fct>