Skip to content

Commit

Permalink
[FIX] - changes in the way quantCols is given to readQFeatures
Browse files Browse the repository at this point in the history
  • Loading branch information
leopoldguyot committed Jul 11, 2024
1 parent 151cf5f commit cb6714e
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 38 deletions.
57 changes: 28 additions & 29 deletions R/data.R
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
# This documentation is coming from the scp package.
# This package use the same tables as example data.

##' @title Example MaxQuant/SCoPE2 output
##'
##' @description
##'
##' A `data.frame` with 1088 observations and 139 variables, as
##' produced by reading a MaxQuant output file with
##' produced by reading a MaxQuant output file with
##' [read.delim()].
##'
##' - Sequence: a character vector
Expand Down Expand Up @@ -149,23 +148,23 @@
##' - participated: a logical vector
##' - peptide: a character vector
##'
##' @usage data("inputTable")
##'
##' @details
##'
##' The dataset is a subset of the SCoPE2 dataset (version 2, Specht
##' et al. 2019,
##' [BioRXiv](https://www.biorxiv.org/content/10.1101/665307v3)). The
##' input file `evidence_unfiltered.csv` was downloaded from a
##' @usage data("mqScpData")
##'
##' @details
##'
##' The dataset is a subset of the SCoPE2 dataset (version 2, Specht
##' et al. 2019,
##' [BioRXiv](https://www.biorxiv.org/content/10.1101/665307v3)). The
##' input file `evidence_unfiltered.csv` was downloaded from a
##' [Google Drive repository](https://drive.google.com/drive/folders/1VzBfmNxziRYqayx3SP-cOe2gu129Obgx).
##' The MaxQuant evidence file was loaded and the data was cleaned
##' (renaming columns, removing duplicate fields,...). MS runs that
##' were selected in the `scp1` dataset (see `?scp1`) were kept along
##' The MaxQuant evidence file was loaded and the data was cleaned
##' (renaming columns, removing duplicate fields,...). MS runs that
##' were selected in the `scp1` dataset (see `?scp1`) were kept along
##' with a blank run. The data is stored as a `data.frame`.
##'
##' @seealso [readSCP()] for an example on how `mqScpData` is
##'
##' @seealso [readSCP()] for an example on how `mqScpData` is
##' parsed into a [QFeatures] object.
##'
##'
##' @md
"inputTable"

Expand All @@ -181,23 +180,23 @@
##' - sortday: a character vector
##' - digest: a character vector
##'
##' @usage data("sampleTable")
##'
##' @details
##'
##' ##' The dataset is a subset of the SCoPE2 dataset (version 2, Specht
##' et al. 2019,
##' [BioRXiv](https://www.biorxiv.org/content/10.1101/665307v3)). The
##' input files `batch.csv` and `annotation.csv` were downloaded from a
##' @usage data("sampleAnnotation")
##'
##' @details
##'
##' ##' The dataset is a subset of the SCoPE2 dataset (version 2, Specht
##' et al. 2019,
##' [BioRXiv](https://www.biorxiv.org/content/10.1101/665307v3)). The
##' input files `batch.csv` and `annotation.csv` were downloaded from a
##' [Google Drive repository](https://drive.google.com/drive/folders/1VzBfmNxziRYqayx3SP-cOe2gu129Obgx).
##' The two files were loaded and the columns names were adapted for
##' consistency with `mqScpData` table (see `?mqScpData`). The two
##' The two files were loaded and the columns names were adapted for
##' consistency with `mqScpData` table (see `?mqScpData`). The two
##' tables were filtered to contain only sets present in ``mqScpData`.
##' The tables were then merged based on the run ID, hence merging the
##' sample annotation and the batch annotation. Finally, annotation
##' for the blank run was added manually. The data is stored as a
##' sample annotation and the batch annotation. Finally, annotation
##' for the blank run was added manually. The data is stored as a
##' `data.frame`.
##'
##'
##' @seealso [readSCP()] to see how this file is used.
##'
##' @md
Expand Down
5 changes: 3 additions & 2 deletions R/interface_module_box_readQFeatures.R
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,9 @@ box_readqfeatures_ui <- function(id) {
),
selectInput(
inputId = NS(id, "quant_cols"),
"Quantitative column :",
choices = NULL
"Quantitative column : (Only relevant without sample table)",
choices = NULL,
multiple = TRUE
),
checkboxInput(
inputId = NS(id, "removeEmptyCols"),
Expand Down
19 changes: 15 additions & 4 deletions R/server_module_box_readQFeatures.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ box_readqfeatures_server <- function(id, input_table, sample_table) {
"can be quite time consuming for large data sets",
sep = " "
))
print(typeof(unique(sample_table()[[input$quant_cols]])))
global_rv$qfeatures <- error_handler(
if(is.data.frame(sample_table())){
global_rv$qfeatures <- error_handler(
QFeatures::readQFeatures,
component_name = "QFeatures converting (readQFeatures)",
assayData = input_table(),
Expand All @@ -34,6 +34,17 @@ box_readqfeatures_server <- function(id, input_table, sample_table) {
removeEmptyCols = input$removeEmptyCols,
verbose = FALSE
)
}
else{
global_rv$qfeatures <- error_handler(
QFeatures::readQFeatures,
component_name = "QFeatures converting (readQFeatures)",
assayData = input_table(),
runCol = input$run_col,
quantCols = input$quant_cols,
removeEmptyCols = input$removeEmptyCols,
verbose = FALSE
)}
if (input$zero_as_NA && length(global_rv$qfeatures) > 0) {
global_rv$qfeatures <- error_handler(
QFeatures::zeroIsNA,
Expand Down Expand Up @@ -61,11 +72,11 @@ box_readqfeatures_server <- function(id, input_table, sample_table) {
input$reload_button
updateSelectInput(session,
"run_col",
choices = colnames(sample_table())
choices = colnames(input_table())
)
updateSelectInput(session,
"quant_cols",
choices = colnames(sample_table())
choices = colnames(input_table())
)
})

Expand Down
Binary file modified data/inputTable.rda
Binary file not shown.
Binary file modified data/sampleTable.rda
Binary file not shown.
2 changes: 1 addition & 1 deletion man/inputTable.Rd

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

4 changes: 2 additions & 2 deletions man/sampleTable.Rd

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

0 comments on commit cb6714e

Please sign in to comment.