Skip to content

Commit

Permalink
release 1.0.9
Browse files Browse the repository at this point in the history
  • Loading branch information
ftwkoopmans committed Jul 11, 2024
1 parent d1018ce commit 0ae8038
Show file tree
Hide file tree
Showing 12 changed files with 65 additions and 54 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Package: msdap
Title: Mass Spectrometry Downstream Analysis Pipeline
Description: Analyze label-free proteomics datasets from various sources (MaxQuant, Spectronaut, etc) using a pipeline that facilitates peptide filtering and many algorithms for normalization and statistical analysis. A comprehensive PDF report can be generated that includes many data visualizations and documentation thereof.
URL: https://github.com/ftwkoopmans/msdap
Version: 1.0.8
Version: 1.0.9
Authors@R:
person(given = "Frank",
family = "Koopmans",
Expand Down
2 changes: 2 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

export(analysis_quickstart)
export(append_log)
export(as_matrix_except_first_column)
export(cache_filtering_data)
export(check_dataset_hascache)
export(check_dataset_integrity)
Expand Down Expand Up @@ -49,6 +50,7 @@ export(initialize_multiprocessing)
export(invalidate_cache)
export(is_dia_dataset)
export(logger.default)
export(matrix_to_long)
export(merge_fractionated_samples)
export(merge_replicate_samples)
export(mgi_lookuptable)
Expand Down
4 changes: 1 addition & 3 deletions R/dea.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,11 @@
#'
#' **msqrob**: implementation of the MSqRob package, with minor tweak for (situationally) faster computation (PMID:26566788) <https://github.com/statOmics/msqrob>. This is a peptide-level DEA algorithm. This method will take provided covariates into account (if any). Implemented in function; \code{de_msqrobsum_msqrob}
#'
#' **msqrob_fc**: msqrob estimated protein pvalues, but with log2fc values computed by eBayes. This avoids the excessive shrinkage of protein log2fc values by MSqRob, but does use the MSqRob robust peptide regression model for protein p-value estimates (which outperforms eBayes/DEqMS in ROC analyses on most benchmark datasets, so this method is intended as a "best of both worlds")
#'
#' **msqrobsum**: implementation of the MSqRob package (which also features MSqRobSum), with minor tweak for (situationally) faster computation (PMID:32321741) <https://github.com/statOmics/msqrob>. This is a hybrid peptide&protein-level DEA algorithm that takes peptide-level data as input; it first performs peptide-to-protein rollup, then applies statistics to this protein-level data matrix. This method will take provided covariates into account (if any). Implemented in function; \code{de_msqrobsum_msqrob}
#'
#' @export
dea_algorithms = function() {
return(c("ebayes", "deqms", "msempire", "msqrobsum", "msqrob")) # , "msqrob_fc"
return(c("ebayes", "deqms", "msempire", "msqrobsum", "msqrob"))
}


Expand Down
4 changes: 2 additions & 2 deletions R/filter_peptides.R
Original file line number Diff line number Diff line change
Expand Up @@ -651,8 +651,8 @@ normalize_peptide_intensity_column = function(dataset, col_intensity, norm_algor
if(length(col_intensity) != 1 || !is.character(col_intensity) || ! col_intensity %in% colnames(dataset$peptides)) {
append_log(sprintf("invalid dataset$peptides column provided to normalize_peptide_intensity_column(). Provided value: %s", paste(col_intensity, collapse = ",")), type = "error")
}
if(!all(is.character(norm_algorithm)) || !any(norm_algorithm != "")) {
append_log(sprintf("invalid normalization algorithm provided to normalize_peptide_intensity_column(): must be (and array of) character type and contain at least one non-empty. Provided value: %s", paste(norm_algorithm, collapse = ",")), type = "error")
if(any(!is.character(norm_algorithm))) {
append_log(sprintf("invalid normalization algorithm provided to normalize_peptide_intensity_column(): must be (and array of) character type. Provided value: %s", paste(norm_algorithm, collapse = ",")), type = "error")
}

# remove NA values to ensure we remove empty rows and columns
Expand Down
8 changes: 6 additions & 2 deletions R/plot_normalization.R
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,8 @@ ggplot_coefficient_of_variation__leave_one_out = function(tib_input, samples, sa
### leave-one-out computation, per group
tib_loo_cov = tibble()
plotlist = list()
for(grp in unique(samples$group)) { #grp=unique(samples$group)[1]
ugrp = unique(samples$group)
for(grp in ugrp) { #grp=ugrp[1]
# samples for current group
sid = samples %>% filter(group == grp) %>% pull(sample_id)
# we use the basic filter+normalization data as input, as this has already been pre-selected for bare minimum of detect/quant (less so than filters below) AND normalized, making CoV estimations more reflective of actual data
Expand Down Expand Up @@ -370,7 +371,10 @@ ggplot_coefficient_of_variation__leave_one_out = function(tib_input, samples, sa
scale_color_manual(breaks=names(tib_plot_colors), values = tib_plot_colors, labels=names(tib_plot_colors), aesthetics = c("colour", "fill")) +
labs(title="Effect of removing a sample prior to CoV computation on within-group CoV\nlower value = better CoV after removing sample s", y="", x="median Coefficient of Variation (%)") +
theme_bw() +
theme(plot.title = element_text(size=10), legend.position = "bottom", legend.title = element_blank())
# alternatively, show legend when there are less than N groups. But beware that in large datasets, this causes a bug (plot+legend doesn't fit viewport)
# in version 1.0.9 we removed the legend because group names are also shown as rows in the plot (i.e. legend is redundant)
# code to reintroduce legend for small datasets only; legend.position = ifelse(length(ugrp) <= 8, "bottom", "none")
theme(plot.title = element_text(size=10), legend.position = "none", legend.title = element_blank())

# summary stats we can print as a table, hard to glance from the figures
tbl_loo_cov = tib_plot %>%
Expand Down
2 changes: 1 addition & 1 deletion R/report_as_rmarkdown.R
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ generate_pdf_report = function(dataset, output_dir, norm_algorithm = "vwmb", rol
# copy .Rmd file into temp directory, nested in chosen output dir
f_newlocation = paste0(output_dir__temp, "/", basename(f))
if(!file.copy(from = f, to = f_newlocation)) {
append_log(paste("failed to move report from", f, "into to the output directory:", f_newlocation), type = "error")
append_log(paste("failed to copy report template from", f, "into to the temp directory:", f_newlocation), type = "error")
}

### create the actual report
Expand Down
2 changes: 2 additions & 0 deletions R/util_generic.R
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ boxplot_add_text = function(bp, show_N = TRUE, show_values = T, ...) {
#' }
#'
#' @param x a wide-format data.frame or tibble where the first column are assumed to represent unique row identifiers and other columns assumed 'data' columns for the output matrix
#' @export
as_matrix_except_first_column = function(x) {
if (is_tibble(x)) {
x = as.data.frame(x, stringsAsFactors = F)
Expand All @@ -168,6 +169,7 @@ as_matrix_except_first_column = function(x) {
#' @param column_name target column name for the row names
#' @param row_name target column name for the column names
#' @importFrom tidyr gather
#' @export
matrix_to_long = function(mat, value_name = "value", column_name = "sample", row_name = "sequence") {
x = as_tibble(mat)
x$rownms = rownames(mat)
Expand Down
6 changes: 3 additions & 3 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ RUN R -e "devtools::install_version('remaCor', '0.0.18', upgrade = 'never', repo
### MS-DAP
# from local devtools::build() file
RUN mkdir /msdap
COPY temp/msdap_1.0.8.tar.gz /msdap/
RUN R -e "devtools::install_local('/msdap/msdap_1.0.8.tar.gz', upgrade = 'never')"
# alternatively, install from github; RUN R -e "devtools::install_github('ftwkoopmans/[email protected].8', upgrade = 'never')"
COPY temp/msdap_1.0.9.tar.gz /msdap/
RUN R -e "devtools::install_local('/msdap/msdap_1.0.9.tar.gz', upgrade = 'never')"
# alternatively, install from github; RUN R -e "devtools::install_github('ftwkoopmans/[email protected].9', upgrade = 'never')"


### finish setting up
Expand Down
2 changes: 1 addition & 1 deletion docker/msdap_launcher_unix.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# MS-DAP launch script
# https://github.com/ftwkoopmans/msdap

VERSION="1.0.8"
VERSION="1.0.9"


### OS
Expand Down
2 changes: 1 addition & 1 deletion docker/msdap_launcher_windows.ps1
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# MS-DAP launch script
# https://github.com/ftwkoopmans/msdap

$VERSION = "1.0.8"
$VERSION = "1.0.9"


Write-Host "$((Get-Date).ToString("HH:mm:ss")) - Starting MS-DAP launcher script for version: $VERSION"
Expand Down
Loading

0 comments on commit 0ae8038

Please sign in to comment.