Plot feature proportions

Share:

Description

Plot feature proportions

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
plotFit(x, ...)

## S4 method for signature 'dmDSfit'
plotFit(x, gene_id, plot_type = "barplot", order = TRUE,
  plot_full = TRUE, plot_main = TRUE, out_dir = NULL)

## S4 method for signature 'dmDStest'
plotFit(x, gene_id, plot_type = "barplot",
  order = TRUE, plot_full = TRUE, plot_null = TRUE, plot_main = TRUE,
  out_dir = NULL)

## S4 method for signature 'dmSQTLfit'
plotFit(x, gene_id, snp_id, plot_type = "boxplot1",
  order = TRUE, plot_full = TRUE, plot_main = TRUE, out_dir = NULL)

## S4 method for signature 'dmSQTLtest'
plotFit(x, gene_id, snp_id, plot_type = "boxplot1",
  order = TRUE, plot_full = TRUE, plot_null = TRUE, plot_main = TRUE,
  out_dir = NULL)

Arguments

x

dmDSfit, dmDStest or dmSQTLfit, dmSQTLtest object.

...

Other parameters that can be defined by methods using this generic.

gene_id

Character indicating a gene ID to be plotted.

plot_type

Character defining the type of the plot produced. Possible values "barplot", "boxplot1", "boxplot2", "lineplot", "ribbonplot".

order

Logical. Whether to plot the features ordered by their expression.

plot_full

Logical. Whether to plot the proportions estimated by the full model.

plot_main

Logical. Whether to plot a title with the information about the Dirichlet-multinomial estimates.

out_dir

Character string that is used to save the plot in paste0(out_dir, plot_name, ".pdf") file. plot_name depends on type of a plot produced, for example, plot_name = "hist_features" for histogram with number of features per gene. If NULL, the plot is returned as ggplot object and can be further modified, for example, using theme().

plot_null

Logical. Whether to plot the proportions estimated by the null model.

snp_id

Character indicating a SNP ID to be plotted. snp_id must match gene_id.

Value

Plot, per gene, the observed and estimated with Dirichlet-multinomial model feature ratios. Estimated proportions are marked with diamond shapes.

Author(s)

Malgorzata Nowicka

See Also

data_dmDSdata, data_dmSQTLdata, plotData, plotDispersion, plotTest

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
###################################
### Differential splicing analysis
###################################
# If possible, use BPPARAM = BiocParallel::MulticoreParam() with more workers

d <- data_dmDSdata

### Filtering
# Check what is the minimal number of replicates per condition 
table(samples(d)$group)
d <- dmFilter(d, min_samps_gene_expr = 7, min_samps_feature_expr = 3, 
 min_samps_feature_prop = 0)

### Calculate dispersion
d <- dmDispersion(d, BPPARAM = BiocParallel::SerialParam())

### Fit full model proportions
d <- dmFit(d, BPPARAM = BiocParallel::SerialParam())

### Fit null model proportions and test for DS
d <- dmTest(d, BPPARAM = BiocParallel::SerialParam())

### Plot feature proportions for top DS gene
res <- results(d)
res <- res[order(res$pvalue, decreasing = FALSE), ]

gene_id <- res$gene_id[1]

plotFit(d, gene_id = gene_id)
plotFit(d, gene_id = gene_id, plot_type = "lineplot")
plotFit(d, gene_id = gene_id, plot_type = "ribbonplot")