Skip to content

Commit 9d51003

Browse files
committed
update utility functions and website
1 parent 8711fcc commit 9d51003

134 files changed

Lines changed: 2833 additions & 19376 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

DESCRIPTION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ Imports:
2929
limma,
3030
mice,
3131
multiUS,
32+
openxlsx,
3233
pcaMethods,
3334
pheatmap,
3435
pls,

NAMESPACE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ export(analyze.wilcox)
99
export(dataMissing)
1010
export(filterNA)
1111
export(filterOutIn)
12-
export(filterProtein)
1312
export(impute.knn)
1413
export(impute.knn_seq)
1514
export(impute.knn_trunc)
@@ -60,6 +59,7 @@ importFrom(limma,normalizeQuantiles)
6059
importFrom(mice,complete)
6160
importFrom(mice,mice)
6261
importFrom(multiUS,seqKNNimp)
62+
importFrom(openxlsx,write.xlsx)
6363
importFrom(pcaMethods,completeObs)
6464
importFrom(pcaMethods,pca)
6565
importFrom(psych,describeBy)

R/globals.R

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,15 @@ utils::globalVariables(c(
77
"value", # <dataMissing>
88
"PG.Quantity", # <preProcessFiltering>
99
"PG.NrOfStrippedSequencesIdentified", # <preProcessFiltering>
10-
"PG.ProteinNames", # <preProcessFiltering>
11-
"PG.ProteinAccessions", # <preProcessFiltering>
10+
"PG.ProteinName", # <preProcessFiltering>
11+
"PG.ProteinAccession", # <preProcessFiltering>
12+
"PG.ProteinNames", # <preprocessing>
13+
"PG.ProteinAccessions", # <preprocessing>
1214
"value", # <preprocessing>
1315
"PG.Genes", # <preprocessing>
14-
"PG.ProteinAccessions", # <preprocessing>
16+
"PG.ProteinAccession", # <preprocessing>
1517
"PG.ProteinDescriptions", # <preprocessing>
16-
"PG.ProteinNames", # <preprocessing>
18+
"PG.ProteinName", # <preprocessing>
1719
"R.Condition", # <preprocessing>
1820
"R.Replicate", # <preprocessing>
1921
"PG.Quantity", # <preprocessing>
@@ -32,34 +34,31 @@ utils::globalVariables(c(
3234
"name", # <visualize.heatmap>
3335
"value", # <visualize.heatmap>
3436
"Regulation", # <visualize.ma>
35-
"Variable", # <visualize.ma>
3637
"A", # <visualize.ma>
3738
"M", # <visualize.ma>
38-
"label", # <visualize.ma>
39+
"Label", # <visualize.ma>
3940
"R.Condition", # <visualize.rank>
4041
"R.Replicate", # <visualize.rank>
41-
"Name", # <visualize.rank>
4242
"Abundance", # <visualize.rank>
4343
"Rank", # <visualize.rank>
44-
"Proteins", # <visualize.rank>
44+
"Type", # <visualize.rank>
4545
"Label", # <visualize.rank>
4646
"Variable", # <visualize.test>
4747
"name", # <visualize.test>
4848
"value", # <visualize.test>
4949
"Comparison", # <visualize.test>
5050
"binwidth", # <visualize.test>
5151
"Significant", # <visualize.volcano>
52-
"Variable", # <visualize.volcano>
5352
"difference", # <visualize.volcano>
54-
"p.value", # <visualize.volcano>
55-
"label", # <visualize.volcano>
53+
"p-value", # <visualize.volcano>
54+
"Label", # <visualize.volcano>
5655
"Dim.1", # <visualize.loading>
5756
"Dim.2", # <visualize.loading>
5857
"Name", # <visualize.loading>
5958
"xcircle", # <visualize.loading>
6059
"ycircle", # <visualize.loading>
6160
"Score", # <visualize.vip>
62-
"Variable", # <visualize.vip>
61+
":=", # <visualize.vip>
6362
"Group", # <visualize.vip>
6463
"Abundance", # <visualize.vip>
6564
NULL

R/pullProteinPath.R

Lines changed: 18 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -26,71 +26,60 @@
2626
#' @param regexName A character vector specifying the proteins for regular expression
2727
#' pattern matching.
2828
#'
29-
#' @param by A character string specifying the information to which the \code{listName}
30-
#' and/or \code{regexName} are applied, with allowable options:
29+
#' @param by A character string (default = "PG.ProteinName" for Spectronaut, default =
30+
#' "AccessionNumber" for Scaffold) specifying the information to which \code{listName}
31+
#' and/or \code{regexName} are applied. Allowable options include:
3132
#' \itemize{
32-
#' \item For Spectronaut: "PG.Genes", "PG.ProteinAccessions", "PG.ProteinDescriptions",
33-
#' and "PG.ProteinNames".
33+
#' \item For Spectronaut: "PG.Genes", "PG.ProteinAccession", "PG.ProteinDescriptions", and
34+
#' "PG.ProteinName".
3435
#' \item For Scaffold: "ProteinDescriptions", "AccessionNumber", and "AlternateID".
3536
#' }
3637
#'
3738
#' @param dataSetList A list of data frames, the order dictates the order of presentation.
3839
#'
39-
#' @param proteinInformation The name of the .csv file containing protein information data
40-
#' (including the path to the file, if needed). The file should include the following
41-
#' columns:
42-
#' \itemize{
43-
#' \item For Spectronaut: "PG.Genes", "PG.ProteinAccessions", "PG.ProteinDescriptions",
44-
#' and "PG.ProteinNames".
45-
#' \item For Scaffold: "ProteinDescriptions", "AccessionNumber", and "AlternateID".
46-
#' }
47-
#' This file is automatically generated by the function
48-
#' \code{\link[msDiaLogue]{preprocessing}} or
49-
#' \code{\link[msDiaLogue]{preprocessing_scaffold}}.
50-
#'
5140
#' @return
5241
#' A 2d dataframe, with the protein data at each step present in the \code{dataSetList}.
5342
#'
5443
#' @export
5544

56-
pullProteinPath <- function(listName = NULL, regexName = NULL, dataSetList,
57-
by = "PG.ProteinNames",
58-
proteinInformation = "preprocess_protein_information.csv") {
45+
pullProteinPath <- function(listName = NULL, regexName = NULL, dataSetList, by = NULL) {
5946

60-
proteinInformation <- read.csv(proteinInformation)
47+
information <- read.csv("preprocess_protein_information.csv", check.names = FALSE)
48+
scaffoldCheck <- any(colnames(information) == "Visible?")
49+
IDcol <- ifelse(scaffoldCheck, "AccessionNumber", "PG.ProteinName")
6150

62-
allName <- proteinInformation[[by]]
51+
if (is.null(by)) {
52+
by <- IDcol
53+
}
6354

6455
## only list filter if listName is present
6556
if (length(listName) != 0) {
66-
listIndex <- which(allName %in% listName)
57+
listIndex <- which(information[[by]] %in% listName)
6758
} else {
6859
listIndex <- NULL
6960
}
7061

7162
## only regex filter if regexName is present
7263
if (length(regexName) != 0) {
73-
regexIndex <- grep(paste(regexName, collapse = "|"), allName, value = FALSE)
64+
regexIndex <- grep(paste(regexName, collapse = "|"), information[[by]], value = FALSE)
7465
} else {
7566
regexIndex <- NULL
7667
}
7768

7869
## combine protein names from list and regex filters
7970
unionIndex <- union(listIndex, regexIndex)
80-
81-
keyid <- ifelse(startsWith(by, "PG."), "PG.ProteinNames", "AccessionNumber")
82-
unionName <- proteinInformation[unionIndex, keyid]
71+
unionName <- information[unionIndex, IDcol]
8372

8473
proteinPath <- do.call(rbind, lapply(unionName, function(name) {
8574
cbind(dataSetList[[1]][c("R.Condition", "R.Replicate")],
8675
name,
8776
sapply(dataSetList, function(data) data[[name]] %||% NA))
8877
}))
8978

90-
colnames(proteinPath)[colnames(proteinPath) == "name"] <- keyid
79+
colnames(proteinPath)[colnames(proteinPath) == "name"] <- by
9180

92-
result <- merge(proteinInformation[unionIndex,], proteinPath,
93-
by = keyid, sort = TRUE)
81+
result <- merge(information[unionIndex,], proteinPath,
82+
by = by, sort = TRUE)
9483

9584
return(result)
9685
}

R/zzz.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#' @import ggrepel
44
#' @import tibble
55
#' @import tidyr
6+
#' @importFrom openxlsx write.xlsx
67
#' @importFrom Rdpack reprompt
78
#' @importFrom stats as.formula cor density integrate median model.matrix na.omit p.adjust
89
#' @importFrom stats pnorm prcomp sd setNames t.test wilcox.test var

_pkgdown.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ reference:
3232
contents:
3333
- filterNA
3434
- filterOutIn
35-
- filterProtein
3635
- title: Normalization
3736
contents:
3837
- normalize

0 commit comments

Comments
 (0)