plot_prnTrend | R Documentation |
plot_prnTrend
plots the trends of protein expressions from
anal_prnTrend
.
plot_prnTrend(
col_select = NULL,
col_order = NULL,
n_clust = NULL,
scale_log2r = TRUE,
complete_cases = FALSE,
impute_na = FALSE,
df2 = NULL,
filename = NULL,
theme = NULL,
...
)
col_select |
Character string to a column key in |
col_order |
Character string to a column key in |
n_clust |
Numeric vector; the cluster ID(s) corresponding to
|
scale_log2r |
Logical; at the TRUE default, input files with
|
complete_cases |
Logical; if TRUE, only cases that are complete with no missing values will be used. The default is FALSE. |
impute_na |
Logical; at the TRUE default, input files with
|
df2 |
Character vector or string; the name(s) of secondary data file(s).
An informatic task, i.e. |
filename |
A representative file name to outputs. By default, it will be determined automatically by the name of the current call. |
theme |
A ggplot2 theme, i.e., theme_bw(), or a custom theme. At the NULL default, a system theme will be applied. |
... |
|
The function reads Protein_Trend_[...].txt
files under the
.../Protein/Trend
directory.
Protein_Trend_[...].txt
Key | Descrption |
id | a gene name or an acession number for protein data |
cluster | a cluster ID
assigned to an id |
group | a name of the sample group for a
id |
log2FC | the mean log2FC of an id under a
group at a given cluster |
Metadata
load_expts
for metadata preparation and a reduced working example in data normalization
Data normalization
normPSM
for extended examples in PSM data normalization
PSM2Pep
for extended examples in PSM to peptide summarization
mergePep
for extended examples in peptide data merging
standPep
for extended examples in peptide data normalization
Pep2Prn
for extended examples in peptide to protein summarization
standPrn
for extended examples in protein data normalization.
purgePSM
and purgePep
for extended examples in data purging
pepHist
and prnHist
for extended examples in histogram visualization.
extract_raws
and extract_psm_raws
for extracting MS file names
Variable arguments of 'filter_...'
contain_str
, contain_chars_in
, not_contain_str
,
not_contain_chars_in
, start_with_str
,
end_with_str
, start_with_chars_in
and
ends_with_chars_in
for data subsetting by character strings
Missing values
pepImp
and prnImp
for missing value imputation
Informatics
pepSig
and prnSig
for significance tests
pepVol
and prnVol
for volcano plot visualization
prnGSPA
for gene set enrichment analysis by protein significance pVals
gspaMap
for mapping GSPA to volcano plot visualization
prnGSPAHM
for heat map and network visualization of GSPA results
prnGSVA
for gene set variance analysis
prnGSEA
for data preparation for online GSEA.
pepMDS
and prnMDS
for MDS visualization
pepPCA
and prnPCA
for PCA visualization
pepLDA
and prnLDA
for LDA visualization
pepHM
and prnHM
for heat map visualization
pepCorr_logFC
, prnCorr_logFC
, pepCorr_logInt
and
prnCorr_logInt
for correlation plots
anal_prnTrend
and plot_prnTrend
for trend analysis and visualization
anal_pepNMF
, anal_prnNMF
, plot_pepNMFCon
,
plot_prnNMFCon
, plot_pepNMFCoef
, plot_prnNMFCoef
and
plot_metaNMF
for NMF analysis and visualization
Custom databases
Uni2Entrez
for lookups between UniProt accessions and Entrez IDs
Ref2Entrez
for lookups among RefSeq accessions, gene names and Entrez IDs
prepGO
for gene
ontology
prepMSig
for molecular
signatures
prepString
and anal_prnString
for STRING-DB
Column keys in PSM, peptide and protein outputs
system.file("extdata", "psm_keys.txt", package = "proteoQ")
system.file("extdata", "peptide_keys.txt", package = "proteoQ")
system.file("extdata", "protein_keys.txt", package = "proteoQ")
# ===================================
# Trend analysis
# ===================================
## !!!require the brief working example in `?load_expts`
## global option
scale_log2r <- TRUE
# ===================================
# Analysis
# ===================================
## base (proteins, with sample order supervision)
anal_prnTrend(
impute_na = FALSE,
col_order = Order,
n_clust = c(5:6),
)
## against selected samples
anal_prnTrend(
col_select = BI,
impute_na = FALSE,
col_order = Order,
n_clust = c(5:6),
filename = sel.txt,
)
## row filtration (proteins)
anal_prnTrend(
impute_na = FALSE,
col_order = Order,
n_clust = c(5:6),
filter_prots_by = exprs(prot_n_pep >= 2),
)
## manual m degree of fuzziness (proteins)
anal_prnTrend(
impute_na = FALSE,
col_order = Order,
n_clust = c(5:6),
filter_prots = exprs(prot_n_pep >= 2),
m = 1.5,
filename = my_m.txt,
)
## additional row filtration by pVals (proteins, impute_na = FALSE)
# if not yet, run prerequisitive significance tests at `impute_na = FALSE`
pepSig(
impute_na = FALSE,
W2_bat = ~ Term["(W2.BI.TMT2-W2.BI.TMT1)",
"(W2.JHU.TMT2-W2.JHU.TMT1)",
"(W2.PNNL.TMT2-W2.PNNL.TMT1)"],
W2_loc = ~ Term_2["W2.BI-W2.JHU",
"W2.BI-W2.PNNL",
"W2.JHU-W2.PNNL"],
W16_vs_W2 = ~ Term_3["W16-W2"],
)
prnSig(impute_na = FALSE)
# (`W16_vs_W2.pVal (W16-W2)` now a column key)
anal_prnTrend(
impute_na = FALSE,
col_order = Order,
n_clust = c(5:6),
filter_prots_by_npep = exprs(prot_n_pep >= 3),
filter_prots_by_pval = exprs(`W16_vs_W2.pVal (W16-W2)` <= 1e-6),
)
## additional row filtration by pVals (impute_na = TRUE)
# if not yet, run prerequisitive NA imputation and corresponding
# significance tests at `impute_na = TRUE`
pepImp(m = 2, maxit = 2)
prnImp(m = 5, maxit = 5)
pepSig(
impute_na = TRUE,
W2_bat = ~ Term["(W2.BI.TMT2-W2.BI.TMT1)",
"(W2.JHU.TMT2-W2.JHU.TMT1)",
"(W2.PNNL.TMT2-W2.PNNL.TMT1)"],
W2_loc = ~ Term_2["W2.BI-W2.JHU",
"W2.BI-W2.PNNL",
"W2.JHU-W2.PNNL"],
W16_vs_W2 = ~ Term_3["W16-W2"],
)
prnSig(impute_na = TRUE)
anal_prnTrend(
impute_na = TRUE,
col_order = Order,
n_clust = c(5:6),
filter_prots_by_npep = exprs(prot_n_pep >= 3),
filter_prots_by_pval = exprs(`W16_vs_W2.pVal (W16-W2)` <= 1e-6),
)
# ===================================
# Visualization
# ===================================
## base (proteins, no NA imputation)
plot_prnTrend(
col_order = Order,
)
# at specific cluster ID(s)
# (`cluster` is a column key in `Protein_Trend_[...].txt`)
plot_prnTrend(
impute_na = FALSE,
col_order = Order,
filter2_by_clusters = exprs(cluster == 5),
width = 8,
height = 10,
filename = cl5.png,
)
# manual selection of secondary input data file(s)
# may be used for optimizing individual plots
plot_prnTrend(
df2 = c("Protein_Trend_Z_nclust5.txt"),
col_order = Order,
filename = n5.png,
)
# manual secondary input(s) at specific rank(s)
plot_prnTrend(
df2 = c("Protein_Trend_Z_nclust5.txt"),
impute_na = FALSE,
col_order = Order,
filter2_by_clusters = exprs(cluster == 5),
width = 8,
height = 10,
filename = n5_cl5.png,
)
## NA imputation
# also save as pdf
plot_prnTrend(
impute_na = TRUE,
col_order = Order,
filename = my.pdf,
)
## against selected samples
plot_prnTrend(
col_order = Order,
col_select = BI,
filename = bi.png,
)
## custom theme
library(ggplot2)
my_trend_theme <- theme_bw() + theme(
axis.text.x = element_text(angle=60, vjust=0.5, size=24),
axis.ticks.x = element_blank(),
axis.text.y = element_text(angle=0, vjust=0.5, size=24),
axis.title.x = element_text(colour="black", size=24),
axis.title.y = element_text(colour="black", size=24),
plot.title = element_text(face="bold", colour="black",
size=20, hjust=.5, vjust=.5),
panel.grid.major.x = element_blank(),
panel.grid.minor.x = element_blank(),
panel.grid.major.y = element_blank(),
panel.grid.minor.y = element_blank(),
panel.background = element_rect(fill = '#0868ac', colour = 'red'),
strip.text.x = element_text(size = 24, colour = "black", angle = 0),
strip.text.y = element_text(size = 24, colour = "black", angle = 90),
plot.margin = unit(c(5.5, 55, 5.5, 5.5), "points"),
legend.key = element_rect(colour = NA, fill = 'transparent'),
legend.background = element_rect(colour = NA, fill = "transparent"),
legend.position = "none",
legend.title = element_text(colour="black", size=18),
legend.text = element_text(colour="black", size=18),
legend.text.align = 0,
legend.box = NULL
)
plot_prnTrend(
col_order = Order,
col_select = BI,
theme = my_trend_theme,
filename = my_theme.png,
)
## no grouping
# each sample under column `Select` forms its own group
anal_prnTrend(
col_group = Select,
col_order = Order,
n_clust = 6,
filter_prots = exprs(prot_n_pep >= 2),
filename = sample_ids_as_groups.txt,
)
plot_prnTrend(
df2 = "sample_ids_as_groups_Protein_Trend_Z_nclust6.txt",
filter2_by_clusters = exprs(cluster == 4),
width = 24,
height = 16,
)
## grouped by column `Term_2` in metadata
anal_prnTrend(
col_group = Term_2,
col_order = Order,
n_clust = 6,
filter_prots = exprs(prot_n_pep >= 2),
filename = term_2_grouping.txt,
)
plot_prnTrend(
df2 = "term_2_grouping_Protein_Trend_Z_nclust6.txt",
filter2_by_clusters = exprs(cluster == 3),
width = 6,
height = 6,
)
## Cytoscape visualization
# (Make sure that Cytoscape is open.)
# Human
cluego(
df2 = "Protein_Trend_Z_nclust5.txt",
species = c(human = "Homo Sapiens"),
n_clust = c(3, 5)
)
# Mouse
cluego(
df2 = "Protein_Trend_Z_nclust5.txt",
species = c(mouse = "Mus Musculus"),
n_clust = c(3:4)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.