Extract tumor immune quantifications from a SummarizedExperiment object, previously processed with run_quantiseqr()

extract_ti_from_se(se)

Arguments

se

A SummarizedExperiment object, or any of its derivates, which contains the quantifications extracted via quantiseqr in its colData slot.

Value

A data.frame, formatted as required by downstream functions

Examples

data(dataset_racle)
dim(dataset_racle$expr_mat)
#> [1] 32467     4

# using a SummarizedExperiment object
library("SummarizedExperiment")
#> Loading required package: MatrixGenerics
#> Loading required package: matrixStats
#> 
#> Attaching package: ‘matrixStats’
#> The following objects are masked from ‘package:Biobase’:
#> 
#>     anyMissing, rowMedians
#> 
#> Attaching package: ‘MatrixGenerics’
#> The following objects are masked from ‘package:matrixStats’:
#> 
#>     colAlls, colAnyNAs, colAnys, colAvgsPerRowSet, colCollapse,
#>     colCounts, colCummaxs, colCummins, colCumprods, colCumsums,
#>     colDiffs, colIQRDiffs, colIQRs, colLogSumExps, colMadDiffs,
#>     colMads, colMaxs, colMeans2, colMedians, colMins, colOrderStats,
#>     colProds, colQuantiles, colRanges, colRanks, colSdDiffs, colSds,
#>     colSums2, colTabulates, colVarDiffs, colVars, colWeightedMads,
#>     colWeightedMeans, colWeightedMedians, colWeightedSds,
#>     colWeightedVars, rowAlls, rowAnyNAs, rowAnys, rowAvgsPerColSet,
#>     rowCollapse, rowCounts, rowCummaxs, rowCummins, rowCumprods,
#>     rowCumsums, rowDiffs, rowIQRDiffs, rowIQRs, rowLogSumExps,
#>     rowMadDiffs, rowMads, rowMaxs, rowMeans2, rowMedians, rowMins,
#>     rowOrderStats, rowProds, rowQuantiles, rowRanges, rowRanks,
#>     rowSdDiffs, rowSds, rowSums2, rowTabulates, rowVarDiffs, rowVars,
#>     rowWeightedMads, rowWeightedMeans, rowWeightedMedians,
#>     rowWeightedSds, rowWeightedVars
#> The following object is masked from ‘package:Biobase’:
#> 
#>     rowMedians
#> Loading required package: GenomicRanges
#> Loading required package: stats4
#> Loading required package: S4Vectors
#> 
#> Attaching package: ‘S4Vectors’
#> The following object is masked from ‘package:utils’:
#> 
#>     findMatches
#> The following objects are masked from ‘package:base’:
#> 
#>     I, expand.grid, unname
#> Loading required package: IRanges
#> Loading required package: GenomeInfoDb
se_racle <- SummarizedExperiment(
  assays = List(
    abundance = dataset_racle$expr_mat
  ),
  colData = DataFrame(
    SampleName = colnames(dataset_racle$expr_mat)
  )
)

res_run_SE <- quantiseqr::run_quantiseq(
    expression_data = se_racle,
    signature_matrix = "TIL10",
    is_arraydata = FALSE,
    is_tumordata = TRUE,
    scale_mRNA = TRUE
)
#> 
#> Running quanTIseq deconvolution module
#> Gene expression normalization and re-annotation (arrays: FALSE)
#> Removing 17 noisy genes
#> Removing 15 genes with high expression in tumors
#> Signature genes found in data set: 135/138 (97.83%)
#> Mixture deconvolution (method: lsei)
#> Deconvolution successful!

extract_ti_from_se(res_run_SE)
#> Found quantifications for the TIL10 signature...
#>          Sample    B.cells Macrophages.M1 Macrophages.M2 Monocytes Neutrophils
#> LAU125   LAU125 0.02320356   0.0110013588    0.000000000 0.1774731   0.0000000
#> LAU355   LAU355 0.43141254   0.0005513951    0.000000000 0.0000000   0.0000000
#> LAU1255 LAU1255 0.02499868   0.0278718306    0.002192758 0.0000000   0.1864949
#> LAU1314 LAU1314 0.49243066   0.0020238340    0.013047188 0.0000000   0.0000000
#>           NK.cells T.cells.CD4 T.cells.CD8      Tregs Dendritic.cells
#> LAU125  0.04899147  0.01012092  0.00000000 0.02337843               0
#> LAU355  0.00000000  0.44238123  0.02927432 0.09638052               0
#> LAU1255 0.00000000  0.00000000  0.09247654 0.05988438               0
#> LAU1314 0.00000000  0.37709982  0.05259234 0.06280617               0
#>                Other
#> LAU125  7.058312e-01
#> LAU355  1.163725e-16
#> LAU1255 6.060809e-01
#> LAU1314 1.145087e-16