waterfall: waterfall plot Creates waterfall plot for a given drug.

View source: R/waterfall_plot.R

waterfallR Documentation

waterfall plot Creates waterfall plot for a given drug.

Description

waterfall plot Creates waterfall plot for a given drug.

Usage

waterfall(
  object,
  res.measure = NULL,
  drug = NULL,
  group.by = NULL,
  summary.stat = c(";", "mean", "median"),
  x = NULL,
  y = NULL,
  type = NULL,
  type.color = NULL,
  na.value = "#878787",
  yname = NULL,
  title = NULL,
  sort = TRUE
)

Arguments

object

The XevaSet object or a data.frame. See Details.

res.measure

PDX model drug response measure

drug

Name of the drug

group.by

Group drug response data

summary.stat

How to summarize multiple values. Options are ";", "mean" or "median". See Details.

x, y

If object is data.frame, x and y indicates column names of x and y axis

type

Type for each bar in waterfall (such as mutated or wild type). See Details.

type.color

A color vector for type

na.value

Color for NA values. Default "#878787"

yname

Name for the y-axis

title

Title of the plot

sort

Default TRUE will sort the data

Details

The function waterfall can plot from a XevaSet or from a data.frame . If a data.frame is specified, x and y parameters must also be specified.

Value

waterfall plot in ggplot2

Examples

data(brca)
##plot best.average.response for all models tested with binimetinib
waterfall(brca, drug="binimetinib", res.measure="best.average.response")

##plot same by taking mean of multiple models of each patient
waterfall(brca, drug="binimetinib", res.measure="best.average.response", 
          group.by = "patient.id", summary.stat = "mean")

## plot by specifing color by mutation type
## extract mutation information
mut <- summarizeData(brca,drug = "binimetinib", mDataType="mutation")
model.type <- Biobase::exprs(mut)["TP53", ]
## extract data.frame of response
df <- summarizeResponse(brca, response.measure = "best.average.response", return.type = "data.frame")
df <- df[df$drug == "binimetinib", ]
## add values to data.frame 
df$TP53 <- model.type[df$model.id]
## now plot the data 
waterfall(df, x="model.id", y="best.average.response", type="TP53")


bhklab/Xeva documentation built on Nov. 12, 2022, 5:38 a.m.