View source: R/mts_plotClusterDistribution.R
| mts_plotClusterDistribution | R Documentation |
Produces a scatterplot with two selected genes on the x and y axis, the boundaries are determined by the cluster assignments (typically from Gaussian mixture modelling). Density plots of the clusters are also shown for each gene.
Axis scaling is chosen automatically: when a gene has a long high tail (as with many lncRNAs and other wide dynamic-range genes)
that axis is square-root, or pseudo-log, transformed for improved visualisation of low-expression clusters (not compressed).
This axis scaling is applied independently to each axis, for whichever gene needs it,
whether it is supplied as gene1 or gene2.
mts_plotClusterDistribution(mixModelClusters,
mixModelClusters2 = NULL,
TScluster1 = NULL,
TScluster2 = NULL,
gene1, gene2,
suppressBlankCanvas = NULL,
gene1_datatype = "",
gene2_datatype = "")
mixModelClusters |
A list object containing cluster assignments generated by |
mixModelClusters2 |
Optional. A second list object containing cluster assignments generated by
|
TScluster1 |
Optional. List object containing tissue-specific cluster assignments (and values)
for the results of |
TScluster2 |
Optional. List object containing tissue-specific cluster assignments (and values)
for the results of |
gene1 |
User specified gene 1. Must match a gene in the list object containing cluster assignments
(i.e. |
gene2 |
User specified gene 2. Must match a gene in the list object containing cluster assignments
(i.e. |
gene1_datatype |
Optional. Text provided to this argument is included next to gene1 in the plot, intended to allow display of data-related information for that gene; for example 'log2 gene expression (TPM)'. |
gene2_datatype |
Optional. Text provided to this argument is included next to gene2 in the plot, intended to allow display of data-related information for that gene; for example 'CRISPR gene effect score' |
suppressBlankCanvas |
Optional. Prevents calling plot.new, which makes a blank canvas.
Can be set to TRUE if writing a plot to file in order to avoid writing a
blank page in addition to the plot. Default value is |
A patchwork object combining a scatter plot with the two panels showing density,
which can be printed or saved with ggsave.
If suppressBlankCanvas is set, the plot is printed and returned invisibly.
mts_mixModelCluster,
mts_mixModelCluster_XPR,
mts_crisprPartition,
mts_genepairsChunkGeneration,
mts_formatMatrix,
mts_plotClusterDistribution,
data("mixModelClusters_depMapXPR")
data("depMapCRISPRscores_subset")
data("depMapTissue_subset")
# Plot with gene expression data for both genes
mts_plotClusterDistribution(
mixModelClusters = mixModelClusters_depMapXPR,
gene1 = "NMT2",
gene2="STX2"
)
##
## Plot gene expression with CRISPR gene effect scores
##
# partition CRISPR scores at -0.5
CRISPR_clusters = mts_crisprPartition(dataMatrix = depMapCRISPRscores_subset[4,])
mts_plotClusterDistribution(mixModelClusters = mixModelClusters_depMapXPR,
mixModelClusters2 = CRISPR_clusters,
gene1 = "NMT2", gene2 = "NMT1",
gene1_datatype="log2 gene expression",
gene2_datatype = "CRISPR gene effect score")
##
## Tissue-specific plot
##
mixturemodelClusters <- mts_mixModelCluster_XPR(dataMatrix = depMapXPR_subset[14,])
# partition CRISPR scores at -0.5
CRISPR_clusters = mts_crisprPartition(dataMatrix = depMapCRISPRscores_subset[9,])
# 1. subset cell lines of interest using mapping file
Lung_Cancer_cellLines <- depMapTissue_subset$cell_line[
depMapTissue_subset$tissue == "Lung Cancer"]
# 2. subset XPR mixture model result list
LungCancer_XPRmixturemodelClusters <- lapply(mixturemodelClusters, function(GMM) {
GMM[GMM$Sample %in% Lung_Cancer_cellLines, ]})
# 3. subset CRISPR clusters
LungCancer_CRISPR_Clusters <- lapply(CRISPR_clusters, function(GMM) {
GMM[GMM$Sample %in% Lung_Cancer_cellLines, ]})
mts_plotClusterDistribution(gene1 = "ACSL1", gene2 = "PSMB5",
mixModelClusters = mixturemodelClusters,
mixModelClusters2 = CRISPR_clusters,
TScluster1 = LungCancer_XPRmixturemodelClusters,
TScluster2 = LungCancer_CRISPR_Clusters)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.