pivot_sample() 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 `tbl` with only sample-related columns
pivot_sample(.data)
# S4 method for class 'SummarizedExperiment'
pivot_sample(.data)
# S4 method for class 'RangedSummarizedExperiment'
pivot_sample(.data)
A `tbl` with transcript-related information
A consistent object (to the input)
A consistent object (to the input)
`r lifecycle::badge("maturing")`
This functon extracts only sample-related information for downstream analysis (e.g., visualisation). It is disruptive in the sense that it cannot be passed anymore to tidybulk function.
## 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
library(airway)
data(airway)
airway <- airway[1:100, 1:5]
pivot_sample(airway )
#> # A tibble: 5 × 11
#> .sample SampleName cell dex albut Run avgLength Experiment Sample
#> <chr> <fct> <fct> <fct> <fct> <fct> <int> <fct> <fct>
#> 1 SRR1039508 GSM1275862 N61311 untrt untrt SRR1039… 126 SRX384345 SRS50…
#> 2 SRR1039509 GSM1275863 N61311 trt untrt SRR1039… 126 SRX384346 SRS50…
#> 3 SRR1039512 GSM1275866 N052611 untrt untrt SRR1039… 126 SRX384349 SRS50…
#> 4 SRR1039513 GSM1275867 N052611 trt untrt SRR1039… 87 SRX384350 SRS50…
#> 5 SRR1039516 GSM1275870 N080611 untrt untrt SRR1039… 120 SRX384353 SRS50…
#> # ℹ 2 more variables: BioSample <fct>, condition <fct>