Skip to contents

plot_single generates a barplot of a protein/gene of interest.

Usage

plot_single(object, proteins, type = c("contrast", "centered"), plot = TRUE)

Arguments

object

SummarizedExperiment, Data object for which differentially enriched proteins are annotated (output from test_diff() and add_rejections()).

proteins

Character, The name(s) of the protein(s)/gene(s) to plot.

type

'contrast' or 'centered', The type of data scaling used for plotting. Either the fold change ('contrast') or the centered log2-intensity ('centered').

plot

Logical(1), If TRUE (default) the barplot is produced. Otherwise (if FALSE), the summaries which the barplot is based on are returned.

Value

A barplot (generated by ggplot).

Examples

# Load example
data(Silicosis_pg)
data <- Silicosis_pg
data_unique <- make_unique(data, "Gene.names", "Protein.IDs", delim = ";")

# Make SummarizedExperiment
ecols <- grep("LFQ.", colnames(data_unique))


## Load experiement design
data(Silicosis_ExpDesign)
exp_design <- Silicosis_ExpDesign
se <- make_se(data_unique, ecols, exp_design)

# Filter and normalize
filt <- filter_se(se, thr = 0, fraction = 0.4, filter_formula = ~ Reverse != "+" & Potential.contaminant!="+")
#> filter base on missing number is <= 0 in at least one condition.
#> filter base on missing number fraction < 0.4 in each row
#> filter base on giving formula 

norm <- normalize_vsn(filt)
#> vsn2: 8762 x 20 matrix (1 stratum). 
#> Please use 'meanSdPlot' to verify the fit.

# Impute missing values using different functions
imputed <- impute(norm, fun = "MinProb", q = 0.05)
#> Imputing along margin 2 (samples/columns).
#> [1] 0.3026531

# Test for differentially expressed proteins
diff <- test_diff(imputed, "control", "PBS")
#> Tested contrasts: W10_vs_PBS, W2_vs_PBS, W4_vs_PBS, W6_vs_PBS, W9_vs_PBS
#> Strimmer's qvalue(t)
dep <- add_rejections(diff, alpha = 0.05, lfc = 1)

# Plot single proteins
plot_single(dep, 'Oas2')
#> Error in str_extract(suffix, "_vs_(.)+"): could not find function "str_extract"
plot_single(dep, 'Oas2', 'centered')

plot_single(dep, c('Oas2', 'Oas3'))
#> Error in str_extract(suffix, "_vs_(.)+"): could not find function "str_extract"
plot_single(dep, c('Oas2', 'Oas3'), plot = FALSE)
#> Error in str_extract(suffix, "_vs_(.)+"): could not find function "str_extract"