Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ biocViews: ImmunoOncology, MassSpectrometry, Proteomics, Software, Normalization
LazyData: true
URL: http://msstats.org
BugReports: https://groups.google.com/forum/#!forum/msstats
RoxygenNote: 7.3.3
Encoding: UTF-8
NeedsCompilation: no
Packaged: 2017-10-20 02:13:12 UTC; meenachoi
LinkingTo:
Rcpp,
RcppArmadillo
Config/roxygen2/version: 8.0.0
23 changes: 14 additions & 9 deletions R/plot_quality_metrics.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,12 @@
#' when \code{isPlotly = TRUE}.
#'
#' @details
#' The x-axis order is determined by the factor levels of the \code{Run}
#' column. When \code{runOrder} is passed to the converter the \code{Run}
#' column is automatically set to an ordered factor; otherwise the runs appear
#' in alphabetical order.
#' The x-axis shows the integer order position of each run (1, 2, 3, ...)
#' rather than the run name, to avoid clutter when run names are long.
#' Positions are determined by the factor levels of the \code{Run} column.
#' When \code{runOrder} is passed to the converter the \code{Run} column is
#' automatically set to an ordered factor; otherwise the runs appear in
#' alphabetical order.
#'
#' Metric values are averaged across fragment ions within each
#' PeptideSequence + PrecursorCharge + Run combination before plotting, so
Expand Down Expand Up @@ -95,22 +97,25 @@ MSstatsQualityMetricsPlot <- function(input, metric = "AnomalyScores",
)
colnames(plot_df)[colnames(plot_df) == "x"] <- metric

# Preserve run factor ordering from the original data
plot_df$Run <- factor(plot_df$Run, levels = levels(input_df$Run))
# Preserve run factor ordering from the original data and map each
# Run to its integer position so the x-axis shows order numbers
# instead of run names (which can be long and clutter the axis).
run_levels <- levels(input_df$Run)
plot_df$RunOrder <- match(as.character(plot_df$Run), run_levels)

p <- ggplot(plot_df,
aes(x = .data[["Run"]],
aes(x = .data[["RunOrder"]],
y = .data[[metric]],
color = .data[["Precursor"]],
group = .data[["Precursor"]])) +
geom_line(linewidth = 0.6) +
geom_point(size = 1.5) +
scale_x_discrete(guide = guide_axis(angle = 45)) +
scale_x_continuous(breaks = seq(5, length(run_levels), by = 5)) +
theme_bw() +
theme(axis.text.x = element_text(size = 8),
legend.title = element_text(size = 9),
legend.text = element_text(size = 7)) +
labs(x = "Run (temporal order)",
labs(x = "Run order",
y = metric,
title = paste("Quality Metric:", metric),
subtitle = which.Protein,
Expand Down
3 changes: 1 addition & 2 deletions R/utils_documentation.R
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
#' A dummy function to store shared documentation items.
#'
#' @import data.table
#' @importFrom MSstatsConvert MSstatsImport MSstatsClean MSstatsPreprocess
#' MSstatsBalancedDesign MSstatsMakeAnnotation MSstatsLogsSettings
#' @importFrom MSstatsConvert MSstatsImport MSstatsClean MSstatsPreprocess MSstatsBalancedDesign MSstatsMakeAnnotation MSstatsLogsSettings
#'
#' @param removeFewMeasurements TRUE (default) will remove the features that have 1 or 2 measurements across runs.
#' @param useUniquePeptide TRUE (default) removes peptides that are assigned for more than one proteins.
Expand Down
10 changes: 6 additions & 4 deletions man/MSstatsQualityMetricsPlot.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/reexports.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading