Skip to contents

Filter the beam.stats object from compute_beam_stats with various filtering criteria. Default is to filter to top 50 sets with smallest q-value. At least one filtering criteria must be specified. Can also use intersection or union of multiple criteria.

Usage

subset_beam_result(
  beam.result,
  beam.set.pvals = NULL,
  beam.feat.pvals = NULL,
  mtx.rows = NULL,
  set.ids = NULL,
  endpts = NULL,
  omics = NULL,
  p.limit = NULL,
  q.limit = NULL,
  p.feat.limit = NULL,
  q.feat.limit = NULL,
  intersect = TRUE,
  recalc = FALSE
)

Arguments

beam.result

A beam.stats object from compute_beam_stats

beam.set.pvals

A list containing BEAMR set p-values from compute_set_pvalues; required if p.limit or q.limit are specified.

beam.feat.pvals

A list containing feature-level p-values from compute_feature_pvalues; required if p.feat.limit or q.feat.limit are specified.

mtx.rows

A list of vectors of feature names corresponding to row.id in set.data. List names correspond to mtx.id in set.data. If specified, filter to all sets containing at least one of these features.

set.ids

A character vector of set.ids. If specified, filter to these sets.

endpts

A character vector of endpoint names. If specified, filter to sets that correspond to these endpoints.

omics

A character vector of omics names. If specified, fitler to sets that correspond to these omics.

p.limit

A numeric value. If specified, determine mtx.rows that are below this threshold if p<1 or top p sets if p>1.

q.limit

A numeric value. If specified, determine mtx.rows that are below this threshold if q <1 or top q sets if q>1.

p.feat.limit

A numeric value. If specified, determine mtx.rows that are below this threshold if p.feat<1 or top p.feat sets if p.feat>1 (feature p-values).

q.feat.limit

A numeric value. If specified, determine mtx.rows that are below this threshold if q.feat<1 or top q.feat sets if q.feat>1.

intersect

A logical value. Default is TRUE. If TRUE, use intersection of all specified criteria. If FALSE use union of all specified criteria.

recalc

A logical value. Default is FALSE. If TRUE, recalculate p-values. If FALSE use original set p-values..

Value

A list with filtered beam.stats object, updated beam.set.pvals, and filtered beam.feat.pvals.

Examples

data(beam_stats)
test.pvals <- compute_set_pvalues(beam.stats=beam_stats)
#> Preparing bootstrap results for calculating feature set p-values: Tue Jul 30 13:51:25 2024
#> Finding stats for each data matrix:Tue Jul 30 13:51:25 2024
#>   Finding stats for data matrix Lesion: Tue Jul 30 13:51:25 2024
#>    Finding features with with Lesion.MRD29 stats: Tue Jul 30 13:51:25 2024
#>    Finding features with with Lesion.EFS stats: Tue Jul 30 13:51:25 2024
#>    Finding features with with Lesion.OS stats: Tue Jul 30 13:51:25 2024
#>   Finding stats for data matrix RNA: Tue Jul 30 13:51:25 2024
#>    Finding features with with RNA.MRD29 stats: Tue Jul 30 13:51:25 2024
#>    Finding features with with RNA.EFS stats: Tue Jul 30 13:51:25 2024
#>    Finding features with with RNA.OS stats: Tue Jul 30 13:51:25 2024
#> Found 120 rows of stats: Tue Jul 30 13:51:25 2024
#> Merging stats with feature-sets: Tue Jul 30 13:51:25 2024
#> Merged feature-set stat rows: 120
#> Ordering and indexing feature sets: Tue Jul 30 13:51:25 2024
#>   Cleaning up beam.stat matrices:Tue Jul 30 13:51:25 2024
#>    Working on matrix 1 of 6: Tue Jul 30 13:51:25 2024
#>    Working on matrix 2 of 6: Tue Jul 30 13:51:25 2024
#>    Working on matrix 3 of 6: Tue Jul 30 13:51:25 2024
#>    Working on matrix 4 of 6: Tue Jul 30 13:51:25 2024
#>    Working on matrix 5 of 6: Tue Jul 30 13:51:25 2024
#>    Working on matrix 6 of 6: Tue Jul 30 13:51:25 2024
#> Computing p-value for feature set 1 of 34: Tue Jul 30 13:51:25 2024
#> 13ENSG00000081760
#> Computing p-value for feature set 26 of 34: Tue Jul 30 13:51:25 2024
#> 9496ENSG00000229835
#> Finished computing p-values at: Tue Jul 30 13:51:25 2024
#> Minimum q-value is 0.106439437831269
#> Creating set p-value data frame.
#> Done creating data frame.
#> Creating list for output.
test.feat.pvals <- compute_feature_pvalues(beam.stats=beam_stats)
#> Computing feature p-values for stat matrix 1 of 6: Tue Jul 30 13:51:25 2024
#>   This matrix has 20 features.
#> Computing feature p-values for stat matrix 2 of 6: Tue Jul 30 13:51:25 2024
#>   This matrix has 20 features.
#> Computing feature p-values for stat matrix 3 of 6: Tue Jul 30 13:51:25 2024
#>   This matrix has 20 features.
#> Computing feature p-values for stat matrix 4 of 6: Tue Jul 30 13:51:25 2024
#>   This matrix has 20 features.
#> Computing feature p-values for stat matrix 5 of 6: Tue Jul 30 13:51:25 2024
#>   This matrix has 20 features.
#> Computing feature p-values for stat matrix 6 of 6: Tue Jul 30 13:51:25 2024
#>   This matrix has 20 features.
filt.beam.stats <- subset_beam_result(beam_stats, test.pvals, test.feat.pvals,
                                      endpts=c("EFS","OS"), q.limit=10, intersect=TRUE,
                                      recalc=FALSE)
#>   Working on mtx.anns: Tue Jul 30 13:51:25 2024
#>   Matching matrix 1 with annotations: Tue Jul 30 13:51:25 2024
#>   Matching matrix 2 with annotations: Tue Jul 30 13:51:25 2024
#> Joining with `by = join_by(set.id, mtx.id, row.id)`
#>   Working on mtx.anns: Tue Jul 30 13:51:25 2024
#>   Matching matrix 1 with annotations: Tue Jul 30 13:51:25 2024
#>   Matching matrix 2 with annotations: Tue Jul 30 13:51:25 2024
#> Computing feature p-values for stat matrix 1 of 4: Tue Jul 30 13:51:25 2024
#>   This matrix has 6 features.
#> Computing feature p-values for stat matrix 2 of 4: Tue Jul 30 13:51:25 2024
#>   This matrix has 7 features.
#> Computing feature p-values for stat matrix 3 of 4: Tue Jul 30 13:51:25 2024
#>   This matrix has 6 features.
#> Computing feature p-values for stat matrix 4 of 4: Tue Jul 30 13:51:25 2024
#>   This matrix has 7 features.
#> Computing feature p-values for stat matrix 1 of 4: Tue Jul 30 13:51:25 2024
#>   This matrix has 6 features.
#> Computing feature p-values for stat matrix 2 of 4: Tue Jul 30 13:51:25 2024
#>   This matrix has 7 features.
#> Computing feature p-values for stat matrix 3 of 4: Tue Jul 30 13:51:25 2024
#>   This matrix has 6 features.
#> Computing feature p-values for stat matrix 4 of 4: Tue Jul 30 13:51:25 2024
#>   This matrix has 7 features.