keep_variable() takes as input A `tbl` (with at least three columns for sample, feature and transcript abundance) or `SummarizedExperiment` (more convenient if abstracted to tibble with library(tidySummarizedExperiment)) and returns a consistent object (to the input) with additional columns for the statistics from the hypothesis test.

keep_variable(
  .data,
  .abundance = NULL,
  top = 500,
  transform = log1p,
  log_transform = TRUE
)

# S4 method for class 'SummarizedExperiment'
keep_variable(.data, top = 500, transform = log1p)

# S4 method for class 'RangedSummarizedExperiment'
keep_variable(.data, top = 500, transform = log1p)

Arguments

.data

A `tbl` (with at least three columns for sample, feature and transcript abundance) or `SummarizedExperiment` (more convenient if abstracted to tibble with library(tidySummarizedExperiment))

.abundance

The name of the transcript/gene abundance column

top

Integer. Number of top transcript to consider

transform

A function that will tranform the counts, by default it is log1p for RNA sequencing data, but for avoinding tranformation you can use identity

log_transform

DEPRECATED. Use transform instead.

Value

A consistent object (to the input) with additional columns for the statistics from the hypothesis test (e.g., log fold change, p-value and false discovery rate).

Underlying method: s <- rowMeans((x - rowMeans(x)) ^ 2) o <- order(s, decreasing = TRUE) x <- x[o[1L:top], , drop = FALSE] variable_trancripts = rownames(x)

A `SummarizedExperiment` object

A `SummarizedExperiment` object

Details

`r lifecycle::badge("maturing")`

At the moment this function uses edgeR https://doi.org/10.1093/bioinformatics/btp616

References

Mangiola, S., Molania, R., Dong, R., Doyle, M. A., & Papenfuss, A. T. (2021). tidybulk: an R tidy framework for modular transcriptomic data analysis. Genome Biology, 22(1), 42. doi:10.1186/s13059-020-02233-7

Examples

## Load airway dataset for examples

  data('airway', package = 'airway')
  # Ensure a 'condition' column exists for examples expecting it

    SummarizedExperiment::colData(airway)$condition <- SummarizedExperiment::colData(airway)$dex





  keep_variable(airway, top = 500)
#> Warning: tidybulk says: highly abundant transcripts were not identified (i.e. identify_abundant()) or filtered (i.e., keep_abundant), therefore this operation will be performed on unfiltered data. In rare occasions this could be wanted. In standard whole-transcriptome workflows is generally unwanted.
#> Getting the 500 most variable genes
#> # A SummarizedExperiment-tibble abstraction: Features=500 | Samples=8 | 
#> #   Assays=counts
#> #                                 |----------------- COVARIATES ---------------|
#>      .feature    .sample | counts | SampleName cell  dex   albut Run   avgLength
#>      <chr>       <chr>   | <chr>  | <fct>      <fct> <fct> <fct> <fct> <chr>    
#> 1    ENSG000001… SRR103… | 4846   | GSM1275862 N613… untrt untrt SRR1… 126      
#> 2    ENSG000002… SRR103… | 0      | GSM1275862 N613… untrt untrt SRR1… 126      
#> 3    ENSG000001… SRR103… | 1358   | GSM1275862 N613… untrt untrt SRR1… 126      
#> 4    ENSG000000… SRR103… | 1507   | GSM1275862 N613… untrt untrt SRR1… 126      
#> 5    ENSG000001… SRR103… | 676    | GSM1275862 N613… untrt untrt SRR1… 126      
#>      --------    ------- - ------ - ---------- ----  ---   ----- ---   ---------
#> 3996 ENSG000001… SRR103… | 395    | GSM1275875 N061… trt   untrt SRR1… 98       
#> 3997 ENSG000001… SRR103… | 2      | GSM1275875 N061… trt   untrt SRR1… 98       
#> 3998 ENSG000001… SRR103… | 3      | GSM1275875 N061… trt   untrt SRR1… 98       
#> 3999 ENSG000002… SRR103… | 0      | GSM1275875 N061… trt   untrt SRR1… 98       
#> 4000 ENSG000002… SRR103… | 0      | GSM1275875 N061… trt   untrt SRR1… 98       
#> # ℹ 15 more variables: Experiment <fct>, Sample <fct>, BioSample <fct>,
#> #   condition <fct>, `|` <|>, gene_id <chr>, gene_name <chr>, entrezid <chr>,
#> #   gene_biotype <chr>, gene_seq_start <chr>, gene_seq_end <chr>,
#> #   seq_name <chr>, seq_strand <chr>, seq_coord_system <chr>, symbol <chr>