Skip to contents

plot_beam_clin produces a matrix of feature level clinical plots for a set. Users can specify which omic/endpoint pairs they want to see as well as the number of features from the set. Default is all omic/endpoint pairs and the top feature (smallest feature-level p-value).

Usage

plot_beam_clin(
  beam.result,
  beam.specs = NULL,
  beam.set.pvals,
  beam.feat.pvals,
  set.id,
  gene.name = NULL,
  pair.type = NULL,
  number.pairs = 1,
  pair.order = "both",
  endpt.order = NULL,
  n.col = NULL,
  n.row = NULL,
  title.size = 10
)

Arguments

beam.result

A beam.stats object from compute_beam_stats

beam.specs

A data.frame. Default NULL, in which case beam.result$beam.specs is used. Otherwise can input other beam.specs data.frame that must contain name, mtx, mdl, plot columns.

beam.set.pvals

A list containing BEAMR set p-values from compute_set_pvalues.

beam.feat.pvals

A list containing feature-level p-values from compute_feature_pvalues.

set.id

A character specifying the name of a set. Must be in beam.result$beam.data$set.data

gene.name

A character specifying a Gene Name/Symbol for the set. Default is NULL

pair.type

A character vector. Default NULL, in which case clinical plots for all omic/endpoint pairs are produced. Otherwise specify pairs from beam.stats$beam.specs$name

number.pairs

A numeric. Default 1, in which case only feature with best simple test for each pair is plotted. If >1, show top n simple plots ordered by feature-level p-value

pair.order

One of c("both", "omic", "endpoint"). Default is "both." Specify how to choose feature-endpoint plots to include. If "both", find the best (based on q, p, effect size) feature-omic pair for each type of omic and each endpoint separately. If "omic", within each omic, find the best feature-endpoint pair and then plot this feature with all endpoints. If "endpoint", need to specify endpt.order as the name of chosen endpoint. Then, within each omic, find the feature with best association with the selected endpoint, and plot this feature for all endpoints.

endpt.order

Default NULL. If pair.order="endpoint", specify character with endpoint name (from beam.specs$name, after the period).

n.col

A numeric. Specify the number of columns for the plot layout; default NULL will use the number of omics types.

n.row

A numeric. Specify the number of rows for the plot layout; default NULL will automatically define the number of rows after number of columns specified.

title.size

A numeric. Specify the size of individual plot titles. Default is 10.

Value

A figure (ggarrange object)

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:21 2024
#> Finding stats for each data matrix:Tue Jul 30 13:51:21 2024
#>   Finding stats for data matrix Lesion: Tue Jul 30 13:51:21 2024
#>    Finding features with with Lesion.MRD29 stats: Tue Jul 30 13:51:21 2024
#>    Finding features with with Lesion.EFS stats: Tue Jul 30 13:51:21 2024
#>    Finding features with with Lesion.OS stats: Tue Jul 30 13:51:21 2024
#>   Finding stats for data matrix RNA: Tue Jul 30 13:51:21 2024
#>    Finding features with with RNA.MRD29 stats: Tue Jul 30 13:51:21 2024
#>    Finding features with with RNA.EFS stats: Tue Jul 30 13:51:21 2024
#>    Finding features with with RNA.OS stats: Tue Jul 30 13:51:21 2024
#> Found 120 rows of stats: Tue Jul 30 13:51:21 2024
#> Merging stats with feature-sets: Tue Jul 30 13:51:21 2024
#> Merged feature-set stat rows: 120
#> Ordering and indexing feature sets: Tue Jul 30 13:51:21 2024
#>   Cleaning up beam.stat matrices:Tue Jul 30 13:51:21 2024
#>    Working on matrix 1 of 6: Tue Jul 30 13:51:21 2024
#>    Working on matrix 2 of 6: Tue Jul 30 13:51:21 2024
#>    Working on matrix 3 of 6: Tue Jul 30 13:51:21 2024
#>    Working on matrix 4 of 6: Tue Jul 30 13:51:21 2024
#>    Working on matrix 5 of 6: Tue Jul 30 13:51:21 2024
#>    Working on matrix 6 of 6: Tue Jul 30 13:51:21 2024
#> Computing p-value for feature set 1 of 34: Tue Jul 30 13:51:21 2024
#> 13ENSG00000081760
#> Computing p-value for feature set 26 of 34: Tue Jul 30 13:51:21 2024
#> 9496ENSG00000229835
#> Finished computing p-values at: Tue Jul 30 13:51:21 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:21 2024
#>   This matrix has 20 features.
#> Computing feature p-values for stat matrix 2 of 6: Tue Jul 30 13:51:21 2024
#>   This matrix has 20 features.
#> Computing feature p-values for stat matrix 3 of 6: Tue Jul 30 13:51:21 2024
#>   This matrix has 20 features.
#> Computing feature p-values for stat matrix 4 of 6: Tue Jul 30 13:51:21 2024
#>   This matrix has 20 features.
#> Computing feature p-values for stat matrix 5 of 6: Tue Jul 30 13:51:21 2024
#>   This matrix has 20 features.
#> Computing feature p-values for stat matrix 6 of 6: Tue Jul 30 13:51:21 2024
#>   This matrix has 20 features.
plot.specs <- prep_beam_plot(beam.data=beam_stats$beam.data,
                             beam.specs=beam_stats$beam.specs)
test.plot <- plot_beam_clin(beam.result=beam_stats, beam.specs=plot.specs,
                            beam.set.pvals=test.pvals,
                            beam.feat.pvals=test.feat.pvals,
                            set.id="ENSG00000099810", gene.name="MTAP",
                            pair.type=NULL, number.pairs=1, n.col=4,
                            n.row=NULL, title.size=11,
                            pair.order="omic", endpt.order=NULL)
#> Warning: Removed 1 row containing missing values or values outside the scale range
#> (`geom_point()`).