If element = NULL, comparison is plotted based on all elements. Otherwise, show scatter or GSEA plots for a single element compared with previously given differential expression results.

# S3 method for class 'referenceComparison'
plot(
  x,
  element = NULL,
  method = c("spearman", "pearson", "gsea", "rankProduct"),
  n = c(3, 3),
  showMetadata = TRUE,
  plotNonRankedPerturbations = FALSE,
  alpha = 0.3,
  genes = c("both", "top", "bottom"),
  ...,
  zscores = NULL,
  title = NULL
)

Arguments

x

referenceComparison object: obtained after running rankSimilarPerturbations() or predictTargetingDrugs()

element

Character: identifier in the first column of x

method

Character: method to plot results; choose between spearman, pearson, gsea or rankProduct (the last one is only available if element = NULL)

n

Numeric: number of top and bottom genes to label (if a vector of two numbers is given, the first and second numbers will be used as the number of top and bottom genes to label, respectively); only used if element = NULL

showMetadata

Boolean: show available metadata information instead of identifiers (if available)? Only used if element = NULL

plotNonRankedPerturbations

Boolean: plot non-ranked data in grey? Only used if element = NULL

alpha

Numeric: transparency; only used if element = NULL

genes

Character: when plotting gene set enrichment analysis (GSEA), plot most up-regulated genes (genes = "top"), most down-regulated genes (genes = "bottom") or both (genes = "both"); only used if method = "gsea" and geneset = NULL

...

Extra arguments currently not used

zscores

Data frame (GCTX z-scores) or character (respective filepath to load data from file)

title

Character: plot title (if NULL, the default title depends on the context; ignored when plotting multiple perturbations)

Value

Plot illustrating the reference comparison

Examples

# Example of a differential expression profile
data("diffExprStat")

if (FALSE) { # \dontrun{
# Download and load CMap perturbations to compare with
cellLine <- "HepG2"
cmapMetadataKD <- filterCMapMetadata(
  "cmapMetadata.txt", cellLine=cellLine,
  perturbationType="Consensus signature from shRNAs targeting the same gene")

cmapPerturbationsKD <- prepareCMapPerturbations(
  cmapMetadataKD, "cmapZscores.gctx", "cmapGeneInfo.txt", loadZscores=TRUE)
} # }

# Rank similar CMap perturbations
compareKD <- rankSimilarPerturbations(diffExprStat, cmapPerturbationsKD)
#> Subsetting data based on 8790 intersecting genes (65% of the 13451 input genes)...
#> Comparing against 26 comparisons (1 cell line) using 'spearman, pearson, gsea' (gene size of 150)...
#> Comparison performed in 0.62 secs

# Plot ranked list of CMap perturbations
plot(compareKD, method="spearman")
#> Warning: No shared levels found between `names(values)` of the manual scale and the
#> data's colour values.
#> Warning: No shared levels found between `names(values)` of the manual scale and the
#> data's colour values.

plot(compareKD, method="spearman", n=c(7, 3))
#> Warning: No shared levels found between `names(values)` of the manual scale and the
#> data's colour values.
#> Warning: No shared levels found between `names(values)` of the manual scale and the
#> data's colour values.

plot(compareKD, method="pearson")
#> Warning: No shared levels found between `names(values)` of the manual scale and the
#> data's colour values.
#> Warning: No shared levels found between `names(values)` of the manual scale and the
#> data's colour values.

plot(compareKD, method="gsea")
#> Warning: No shared levels found between `names(values)` of the manual scale and the
#> data's colour values.
#> Warning: No shared levels found between `names(values)` of the manual scale and the
#> data's colour values.


# Plot results for a single perturbation
pert <- compareKD[[1, 1]]
plot(compareKD, pert, method="spearman", zscores=cmapPerturbationsKD)

plot(compareKD, pert, method="pearson", zscores=cmapPerturbationsKD)

plot(compareKD, pert, method="gsea", zscores=cmapPerturbationsKD)


# Predict targeting drugs based on a given differential expression profile
gdsc <- loadExpressionDrugSensitivityAssociation("GDSC 7")
#> Loading data from expressionDrugSensitivityCorGDSC7.qs...
predicted <- predictTargetingDrugs(diffExprStat, gdsc)
#> Subsetting data based on 11396 intersecting genes (85% of the 13451 input genes)...
#> Comparing against 266 GDSC 7 compounds (983 cell lines) using 'spearman, pearson, gsea' (gene size of 150)...
#> Comparison performed in 2.5 secs

# Plot ranked list of targeting drugs
plot(predicted, method="spearman")
#> Warning: No shared levels found between `names(values)` of the manual scale and the
#> data's colour values.
#> Warning: No shared levels found between `names(values)` of the manual scale and the
#> data's colour values.
#> Warning: ggrepel: 229 unlabeled data points (too many overlaps). Consider increasing max.overlaps

plot(predicted, method="spearman", n=c(7, 3))
#> Warning: No shared levels found between `names(values)` of the manual scale and the
#> data's colour values.
#> Warning: No shared levels found between `names(values)` of the manual scale and the
#> data's colour values.
#> Warning: ggrepel: 229 unlabeled data points (too many overlaps). Consider increasing max.overlaps

plot(predicted, method="pearson")
#> Warning: No shared levels found between `names(values)` of the manual scale and the
#> data's colour values.
#> Warning: No shared levels found between `names(values)` of the manual scale and the
#> data's colour values.
#> Warning: ggrepel: 228 unlabeled data points (too many overlaps). Consider increasing max.overlaps

plot(predicted, method="gsea")
#> Warning: No shared levels found between `names(values)` of the manual scale and the
#> data's colour values.
#> Warning: No shared levels found between `names(values)` of the manual scale and the
#> data's colour values.
#> Warning: ggrepel: 251 unlabeled data points (too many overlaps). Consider increasing max.overlaps


# Plot results for a single targeting drug
drug <- predicted$compound[[4]]
plot(predicted, drug, method="spearman")
#> Loading data from /tmp/RtmpJcKRtX/file743a73f3f256/reference/expressionDrugSensitivityCorGDSC7.qs...

plot(predicted, drug, method="pearson")
#> Loading data from /tmp/RtmpJcKRtX/file743a73f3f256/reference/expressionDrugSensitivityCorGDSC7.qs...

plot(predicted, drug, method="gsea")
#> Loading data from /tmp/RtmpJcKRtX/file743a73f3f256/reference/expressionDrugSensitivityCorGDSC7.qs...