Melt count matrix into long format

meltCounts(object, ...)

# S4 method for matrix
meltCounts(object, minCounts = 1L,
  minCountsMethod = c("perFeature", "absolute"), trans = c("identity",
  "log2", "log10"))

# S4 method for SummarizedExperiment
meltCounts(object, assay = 1L,
  minCounts = 1L, minCountsMethod = c("perFeature", "absolute"),
  trans = c("identity", "log2", "log10"))

Arguments

object

Object.

minCounts

integer(1) or NULL. Minimum count threshold to apply. Disable with NULL. Filters using "greater than or equal to" logic internally. Note that this threshold gets applied prior to logarithmic transformation, when trans argument applies.

minCountsMethod

character(1). Uses match.arg().

  • perFeature: Recommended. Applies cutoff per row feature (i.e. gene). Internally, rowSums() values are checked against this cutoff threshold prior to the melt operation.

  • absolute: Applies hard cutoff to counts column after the melt operation. This applies to all counts, not per feature.

trans

character(1). Apply a log transformation (e.g. log2(x + 1L)) to the count matrix prior to melting, if desired. Use "identity" to return unmodified (default).

assay

vector(1). Assay name or index position.

...

Additional arguments.

Value

grouped_df. Grouped by colname (e.g. sample ID) and rowname (e.g. gene ID).

Note

Updated 2019-08-11.

See also

Examples

data(RangedSummarizedExperiment, package = "acidtest") rse <- RangedSummarizedExperiment dim(rse)
#> [1] 500 12
x <- meltCounts(rse, minCounts = NULL) nrow(x)
#> [1] 6000
#> # A tibble: 6,000 x 6 #> # Groups: colname, rowname [6,000] #> rowname colname counts condition sampleName interestingGroups #> <fct> <fct> <int> <fct> <fct> <fct> #> 1 gene001 sample01 4 A sample01 A #> 2 gene002 sample01 49 A sample01 A #> 3 gene003 sample01 73 A sample01 A #> 4 gene004 sample01 0 A sample01 A #> 5 gene005 sample01 6 A sample01 A #> 6 gene006 sample01 12 A sample01 A #> 7 gene007 sample01 13 A sample01 A #> 8 gene008 sample01 146 A sample01 A #> 9 gene009 sample01 6 A sample01 A #> 10 gene010 sample01 10 A sample01 A #> # … with 5,990 more rows