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] "camera" "fry"   
head(result(res, "camera"))
#>   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         padj padj.by.collection n.sig n.neutral n.up n.down
#> 1 0.0227176661 0.0822694116        0.048680713     1        10    3      8
#> 2 0.0000431032 0.0005459739        0.000215516     9        32   11     30
#> 3 0.0014736432 0.0106445384        0.005135523     9        41   14     36
#> 4 0.5128750806 0.6187064464        0.569861201     0         6    1      5
#> 5 0.0621180232 0.1331287916        0.116471293     2        21   14      9
#> 6 0.0015406569 0.0106445384        0.005135523     7        38   13     32
#>   n.sig.up n.sig.down mean.logFC mean.logFC.trim     mean.t mean.t.trim
#> 1        0          1 -0.4953724      -0.5044566 -1.3726441  -1.3765614
#> 2        0          9 -0.7685127      -0.6500474 -1.5021451  -1.5212565
#> 3        1          8 -0.7654912      -0.7382118 -1.0964370  -1.1564061
#> 4        0          0 -0.2319652      -0.2319652 -0.5767635  -0.5767635
#> 5        2          0  0.3419176       0.2139964  0.6136099   0.4334291
#> 6        0          7 -0.4568979      -0.4711493 -1.1350462  -1.0681036
#>   Direction rank
#> 1      Down   20
#> 2      Down    6
#> 3      Down   10
#> 4      Down   63
#> 5        Up   35
#> 6      Down   11
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.camera  padj.camera padj.by.collection.camera     pval.fry   padj.fry
#> 1 0.0227176661 0.0822694116               0.048680713 0.0013287077 0.02141405
#> 2 0.0000431032 0.0005459739               0.000215516 0.0009023934 0.02141405
#> 3 0.0014736432 0.0106445384               0.005135523 0.0510869578 0.11086895
#> 4 0.5128750806 0.6187064464               0.569861201 0.2692576321 0.35282035
#> 5 0.0621180232 0.1331287916               0.116471293 0.2265804573 0.33764931
#> 6 0.0015406569 0.0106445384               0.005135523 0.0290220163 0.07605770
#>   pval.mixed.fry padj.mixed.fry padj.by.collection.fry n.sig n.neutral n.up
#> 1   1.059937e-02   1.258676e-02             0.01014350     1        10    3
#> 2   5.202474e-07   4.626506e-06             0.01014350     9        32   11
#> 3   5.030725e-04   7.646702e-04             0.10616306     9        41   14
#> 4   9.573635e-01   9.573635e-01             0.35120561     0         6    1
#> 5   2.279844e-02   2.548061e-02             0.32368637     2        21   14
#> 6   2.194651e-04   3.706522e-04             0.07255504     7        38   13
#>   n.down n.sig.up n.sig.down mean.logFC mean.logFC.trim     mean.t mean.t.trim
#> 1      8        0          1 -0.4953724      -0.5044566 -1.3726441  -1.3765614
#> 2     30        0          9 -0.7685127      -0.6500474 -1.5021451  -1.5212565
#> 3     36        1          8 -0.7654912      -0.7382118 -1.0964370  -1.1564061
#> 4      5        0          0 -0.2319652      -0.2319652 -0.5767635  -0.5767635
#> 5      9        2          0  0.3419176       0.2139964  0.6136099   0.4334291
#> 6     32        0          7 -0.4568979      -0.4711493 -1.1350462  -1.0681036
#>   rank.camera rank.fry
#> 1          20        3
#> 2           6        2
#> 3          10       35
#> 4          63       58
#> 5          35       51
#> 6          11       29