Melt count matrix into long format

meltCounts(object, ...)

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

Arguments

object

Object.

assay

vector(1). Name or index of count matrix slotted in assays(). When passing in a string, the name must be defined in assayNames().

minCounts

integer(1). Minimum count threshold to apply. 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).

...

Additional arguments.

Value

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

See also

Examples

data(rse, package = "acidtest") x <- meltCounts(rse)
#> 499 / 500 features passed minimum rowSums() >= 1 expression cutoff.
#> # A tibble: 5,988 x 6 #> # Groups: colname, rowname [5,988] #> rowname colname counts condition sampleName interestingGroups #> <fct> <fct> <int> <fct> <fct> <fct> #> 1 gene001 sample01 1 A sample01 A #> 2 gene002 sample01 30 A sample01 A #> 3 gene003 sample01 27 A sample01 A #> 4 gene004 sample01 253 A sample01 A #> 5 gene005 sample01 0 A sample01 A #> 6 gene006 sample01 1 A sample01 A #> 7 gene007 sample01 5 A sample01 A #> 8 gene008 sample01 23 A sample01 A #> 9 gene009 sample01 21 A sample01 A #> 10 gene010 sample01 36 A sample01 A #> # … with 5,978 more rows