The resultNames, result, and results functions enable you to explore the results of the analysis run with seas().

The results that are stored within a SparrowResult object have a more or less 1:1 mapping with the values passed as methods, parameter of the seas() call.

Generates a table to indicate the number of genesets per collection that pass a given FDR. The table provides separate groups of rows for each of the methods run in the seas() call that generated that generated x.

resultNames(x)

result(x, ...)

# S3 method for class 'SparrowResult'
result(
  x,
  name = NULL,
  stats.only = FALSE,
  rank.by = c("pval", "t", "logFC"),
  add.suffix = FALSE,
  as.dt = FALSE,
  ...
)

results(
  x,
  names = resultNames(x),
  stats.only = TRUE,
  rank.by = c("pval", "logFC", "t"),
  add.suffix = length(names) > 1L,
  as.dt = FALSE
)

tabulateResults(
  x,
  names = resultNames(x),
  max.p = 0.2,
  p.col = c("padj", "padj.by.collection", "pval"),
  as.dt = FALSE
)

Arguments

x

A SparrowResult() object.

...

pass through arguments

name

the names of the results desired

stats.only

logical, set to FALSE if you want to return all (column-wise) data for each result. By default only the pvalues, adjusted pvalues, and rank are returned.

rank.by

the statistic to use to append a rank column for the geneset result. By default we rank by pvalue calculated by the GSEA method. You can rank the results based on the trimmed mean of the logFC's calculated for all of the features in the geneset ("logFC"), or the trimmed t-statistics of the these features ("t").

add.suffix

If TRUE, adds .name as a suffix to the columns of the method-specific statistics returned, ie. the pval column from the "camera" result will be turned to pval.camera.

as.dt

If FALSE (default), the data.frame like thing that this funciton returns will be set to a data.frame. Set this to TRUE to keep this object as a data.table

names

the names of the GSEA methods to be reported. By default, this function will display results for all methods.

max.p

The maximum padj value to consider a result significant

p.col

use padj or padj.by.collection?

Value

a data.table with the results from the requested method.

a data.table that summarizes the significant results per method per collection for the GSEA that was run

Details

The product of an indivdual GSEA is consumed by the corresponding do.<METHOD> function and converted into a data.table of results that is internally stored.

Use the resultNames() function to identify which results are available for interrogation. The result() function returns the statistics of one individual result, and the results() function combines the results from the specified methods into an arbitrarily wide data.table with method-suffixed column names.

Use the tabulateResults() function to create a summary table that tallies the number of significant genesets per collection, per method at the specified FDR thresholds.

Examples

res <- exampleSparrowResult()
resultNames(res)
#> [1] "cameraPR" "fgsea"    "ora"      "ora.down" "ora.up"  
head(result(res, "camera"))
#> Error in invalidMethods(x, name, as.error = TRUE): Illegal result names queried: camera
head(results(res))
#>   collection                                          name active  N  n
#> 1         c2                        BIOCARTA_AGPCR_PATHWAY   TRUE 13 11
#> 2         c2         BOYAULT_LIVER_CANCER_SUBCLASS_G123_DN   TRUE 51 41
#> 3         c2               BURTON_ADIPOGENESIS_PEAK_AT_2HR   TRUE 51 50
#> 4         c2        BYSTRYKH_HEMATOPOIESIS_STEM_CELL_IL3RA   TRUE  9  6
#> 5         c2             CAIRO_PML_TARGETS_BOUND_BY_MYC_UP   TRUE 23 23
#> 6         c2 CHARAFE_BREAST_CANCER_BASAL_VS_MESENCHYMAL_DN   TRUE 50 45
#>   pval.cameraPR padj.cameraPR padj.by.collection.cameraPR   pval.fgsea
#> 1  2.694636e-02  0.0890401468                0.0577422005 2.489282e-02
#> 2  2.693973e-05  0.0003412366                0.0001346986 7.403238e-06
#> 3  1.719765e-03  0.0108918465                0.0051592957 1.911954e-03
#> 4  5.663255e-01  0.6651867043                0.6067772992 4.480969e-01
#> 5  5.191257e-02  0.1195562274                0.0973360733 3.598428e-02
#> 6  1.637298e-03  0.0108918465                0.0051592957 5.372130e-04
#>     padj.fgsea padj.by.collection.fgsea    pval.ora   padj.ora
#> 1 4.966152e-02             4.497212e-02 0.598693324 0.78449470
#> 2 5.626461e-05             2.776214e-05 0.004582821 0.03482944
#> 3 6.919453e-03             4.779885e-03 0.007237781 0.04583928
#> 4 5.008142e-01             5.170349e-01 1.000000000 1.00000000
#> 5 6.511441e-02             5.997380e-02 0.470743114 0.68800917
#> 6 2.721879e-03             1.611639e-03 0.070859208 0.18285307
#>   padj.by.collection.ora pval.ora.down padj.ora.down
#> 1             0.78090434  0.4987312569    0.93918209
#> 2             0.02291410  0.0007124426    0.01804855
#> 3             0.03101906  0.0046853073    0.03560834
#> 4             1.00000000  1.0000000000    1.00000000
#> 5             0.74212771  1.0000000000    1.00000000
#> 6             0.18044711  0.0205324330    0.09752906
#>   padj.by.collection.ora.down pval.ora.up padj.ora.up padj.by.collection.ora.up
#> 1                 1.000000000  1.00000000   1.0000000                 1.0000000
#> 2                 0.007124426  1.00000000   1.0000000                 1.0000000
#> 3                 0.028111844  0.56430800   1.0000000                 1.0000000
#> 4                 1.000000000  1.00000000   1.0000000                 1.0000000
#> 5                 1.000000000  0.05174316   0.3574982                 0.2828932
#> 6                 0.087996141  1.00000000   1.0000000                 1.0000000
#>   n.sig n.neutral n.up n.down n.sig.up n.sig.down mean.logFC mean.logFC.trim
#> 1     1        10    3      8        0          1 -0.4953724      -0.5044566
#> 2     9        32   11     30        0          9 -0.7685127      -0.6500474
#> 3     9        41   14     36        1          8 -0.7654912      -0.7382118
#> 4     0         6    1      5        0          0 -0.2319652      -0.2319652
#> 5     2        21   14      9        2          0  0.3419176       0.2139964
#> 6     7        38   13     32        0          7 -0.4568979      -0.4711493
#>       mean.t mean.t.trim rank.cameraPR rank.fgsea rank.ora rank.ora.down
#> 1 -1.3726441  -1.3765614            23         38       58            40
#> 2 -1.5021451  -1.5212565             6         10       10             3
#> 3 -1.0964370  -1.1564061            12         21       12            10
#> 4 -0.5767635  -0.5767635            64         68       72            64
#> 5  0.6136099   0.4334291            33         42       52            64
#> 6 -1.1350462  -1.0681036            11         15       29            16
#>   rank.ora.up
#> 1          63
#> 2          63
#> 3          38
#> 4          76
#> 5          11
#> 6          63