Skip to contents

plot_Tsne generates a t-Sne plot using the global variable features

Usage

plot_Tsne(
  object,
  indicate = c("condition", "replicate"),
  label = FALSE,
  n = nrow(object),
  point_size = 4,
  label_size = 3,
  plot = TRUE,
  if_square = FALSE,
  features = "features",
  perplexity = 2,
  theseed = NULL,
  ...
)

Arguments

object

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

indicate

Character, Sets the color, shape and facet_wrap of the plot based on columns from the experimental design (colData).

label

Logical, Whether or not to add sample labels.

n

Integer(1), Sets the number of top variable proteins to consider.

point_size

Integer(1), Sets the size of the points.

label_size

Integer(1), Sets the size of the labels.

plot

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

if_square

Logical(1), if TRUE plot in a

features

Character(1), the feature name in plot title, could be "proteins","genes", default is "features"

perplexity

Perplexity parameter (should not be bigger than 3 * perplexity < nrow(X) - 1. See Rtsne().

theseed

integer(1),Set random seed.

...

Other parameters to Rtsne().

Value

A scatter plot (generated by ggplot).

Examples

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

# Differential test
ecols <- grep("LFQ.", colnames(data_unique))
se <- make_se_parse(data_unique, ecols,mode = "delim")
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.
imputed <- impute(norm, fun = "MinProb", q = 0.05)
#> Imputing along margin 2 (samples/columns).
#> [1] 0.3026531

# t-SNE plot
plot_Tsne(imputed)
#> The random seed of umap is 3679
#> Warning: Use of `Tsne_df[[indicate[1]]]` is discouraged.
#>  Use `.data[[indicate[1]]]` instead.
#> Warning: Use of `Tsne_df[[indicate[2]]]` is discouraged.
#>  Use `.data[[indicate[2]]]` instead.