From 37af5a3a3dd44f6ed4c414979c7fffbcb0bd4bb2 Mon Sep 17 00:00:00 2001 From: Marina Kiweler Date: Thu, 7 Feb 2019 13:25:17 +0100 Subject: [PATCH] new tmt table --- DESCRIPTION | 2 + R/load_term_matching_table_function.R | 34 +++++--- R/output_functions.R | 4 +- R/term_matching_functions.R | 4 +- README.Rmd | 4 +- README.md | 4 +- data/tmt_list.rda | Bin 2698 -> 2712 bytes man/create_term_match_table.Rd | 6 +- man/grapes-greater-than-grapes.Rd | 2 +- man/grapes-less-than-greater-than-grapes.Rd | 2 +- man/match_terms.Rd | 2 +- man/one_group_match_terms.Rd | 2 +- man/save_all_groups.Rd | 2 +- man/save_group_table.Rd | 2 +- man/tmt_one_instrument.Rd | 2 +- vignettes/.gitignore | 2 + vignettes/manipulate_term_match_table.Rmd | 84 ++++++++++++++++++++ vignettes/using_MARMoSET.Rmd | 4 +- 18 files changed, 132 insertions(+), 30 deletions(-) create mode 100644 vignettes/.gitignore create mode 100644 vignettes/manipulate_term_match_table.Rmd diff --git a/DESCRIPTION b/DESCRIPTION index 032b9cc..3686370 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -18,10 +18,12 @@ Imports: assertive.sets, assertive.strings, assertive.types, + dplyr, jsonlite, pathological, rlist, stringi, + tidyr, magrittr Depends: R (>= 2.10) diff --git a/R/load_term_matching_table_function.R b/R/load_term_matching_table_function.R index d17615f..45bd7d2 100644 --- a/R/load_term_matching_table_function.R +++ b/R/load_term_matching_table_function.R @@ -3,8 +3,8 @@ #' @param instrument_list list of instruments in the raw file, get it with "instrument_names()". #' @param origin_key Specifies which information is required. #' If empty, all information is used. -#' "jpr" for the requirements of the Journal of Proteome Research. -#' "mcp" for the requirements of the Molecular and Cellular Proteomics. +#' "jpr_guidelines_ms" for the requirements of the Journal of Proteome Research. +#' "miape" for The Minimal Information about a Proteomics Experiment (MIAPE) from the Proteomics Standards Initiative. #' #' #' @return A table needed to extract the meta data with match_terms(). @@ -12,7 +12,7 @@ #' @examples #' term_matching_table <- create_term_match_table( #' instrument_list = c("Thermo_EASY-nLC", "Q_Exactive_-_Orbitrap_MS"), -#' origin_key = "jpr") +#' origin_key = "jpr_guidelines_ms") #' #' @export @@ -33,21 +33,35 @@ create_term_match_table <- function(instrument_list = c("Thermo_EASY-nLC", "Q Ex #' @param origin_key Specifies which information is required. #' If empty, all information is used. #' "jpr_guidelines_ms" for the requirements of the Journal of Proteome Research. -#' "mcp_guidelines_ms" for the requirements of the Molecular and Cellular Proteomics. +#' "miape" for The Minimal Information about a Proteomics Experiment (MIAPE) from the Proteomics Standards Initiative. #' #' #' @return Table with tmt part for this instrument. -tmt_one_instrument <- function(instrument, origin_key = "") +tmt_one_instrument <- function(instrument, origin_key = "all") { instrument %<>% gsub(pattern = " ", replacement = "_" ) assertive.sets::assert_is_subset(instrument, names(MARMoSET::tmt_list)) - assertive.properties::assert_is_non_empty(grep(MARMoSET::tmt_list[[instrument]][["origin"]], pattern = origin_key)) - sub_index <- MARMoSET::tmt_list[[instrument]][["origin"]] %>% - grep(pattern = origin_key) + okey_is_ok <- function(x){ assertive.properties::has_rows(MARMoSET::tmt_list[[instrument]] %>% + tidyr::separate_rows(origin, sep=';') %>% + dplyr::filter(origin == origin_key)) || + (origin_key == "" || origin_key == "all")} - rbind( MARMoSET::tmt_list[[instrument]][sub_index,]) %>% - return() + assertive.base::assert_engine( okey_is_ok, origin_key, + msg = "origin_key is not a valid key!", + severity = "stop", + what = "any") + + sub_index <- MARMoSET::tmt_list[[instrument]] + + if(origin_key != "" && origin_key != "all") + { + sub_index %<>% + tidyr::separate_rows(origin, sep=';') %>% + dplyr::filter(origin == origin_key) + } + + return(sub_index) } diff --git a/R/output_functions.R b/R/output_functions.R index d66b8a2..04176bf 100644 --- a/R/output_functions.R +++ b/R/output_functions.R @@ -14,7 +14,7 @@ #' #' term_matching_table <- create_term_match_table( #' instrument_list = c("Thermo_EASY-nLC", "Q_Exactive_-_Orbitrap_MS"), -#' origin_key = "jpr") +#' origin_key = "jpr_guidelines_ms") #' #' vector_of_group_tables <- match_terms(flat_json, term_matching_table) #' @@ -74,7 +74,7 @@ utils::globalVariables('.') #' #' term_matching_table <- create_term_match_table( #' instrument_list = c("Thermo_EASY-nLC", "Q_Exactive_-_Orbitrap_MS"), -#' origin_key = "jpr") +#' origin_key = "jpr_guidelines_ms") #' #' vector_of_group_tables <- match_terms(flat_json, term_matching_table) #' diff --git a/R/term_matching_functions.R b/R/term_matching_functions.R index de98aca..ef6ca94 100644 --- a/R/term_matching_functions.R +++ b/R/term_matching_functions.R @@ -15,7 +15,7 @@ #' #' term_matching_table <- create_term_match_table( #' instrument_list = instrument_names(json, 1), -#' origin_key = "jpr") +#' origin_key = "jpr_guidelines_ms") #' #' vector_of_group_tables <- match_terms(flat_json, term_matching_table) #' @@ -52,7 +52,7 @@ match_terms <- function(flat_json, term_matching_table) #' #' term_matching_table <- create_term_match_table( #' instrument_list = instrument_names(json, 1), -#' origin_key = "jpr") +#' origin_key = "jpr_guidelines_ms") #' #' meta_data_table <- one_group_match_terms(flat_json, term_matching_table, 1) #' diff --git a/README.Rmd b/README.Rmd index 6c24e11..a740bc0 100644 --- a/README.Rmd +++ b/README.Rmd @@ -75,12 +75,12 @@ flat_json <- flatten_json(json = json) ``` Since raw files include a huge amount of meta data and only several of this information is required by journals there is the need to sort out. Therefore a table linking which information is essential and where to find it in the flattened JSON is useful. Such a here refered to as 'term matching table' can be created with `term_matching_table()` by submitting two arguments. The first, `instrument_list` takes a vector with the names of the instruments represented in the JSON file. -The second one, `origin_key` specifies which requirements should be met. If it stays empty, all journals are selected. While `'jpr'` stands for the requirements of the Journal of Proteome Research, `'mcp'` chooses the requirements of the Molecular and Cellular Proteomics. +The second one, `origin_key` specifies which requirements should be met. If it stays empty, all journals are selected. While `'jpr_guidelines_ms'` stands for the requirements of the Journal of Proteome Research, `'miape'` for the Minimal Information about a Proteomics Experiment (MIAPE) from the Proteomics Standards Initiative. ```{r} term_matching_table <- create_term_match_table( instrument_list = c('Thermo EASY-nLC', 'Q Exactive - Orbitrap_MS'), - origin_key = 'jpr') + origin_key = 'jpr_guidelines_ms') ``` The names of the instruments can be shown for each group with `instrument_names()` with the json and the group number as arguments. diff --git a/README.md b/README.md index 1c5602e..1db8c96 100644 --- a/README.md +++ b/README.md @@ -66,12 +66,12 @@ To allow an easier access to the JSON file it needs to be flattened, this works flat_json <- flatten_json(json = json) ``` -Since raw files include a huge amount of meta data and only several of this information is required by journals there is the need to sort out. Therefore a table linking which information is essential and where to find it in the flattened JSON is useful. Such a here refered to as 'term matching table' can be created with `term_matching_table()` by submitting two arguments. The first, `instrument_list` takes a vector with the names of the instruments represented in the JSON file. The second one, `origin_key` specifies which requirements should be met. If it stays empty, all journals are selected. While `'jpr'` stands for the requirements of the Journal of Proteome Research, `'mcp'` chooses the requirements of the Molecular and Cellular Proteomics. +Since raw files include a huge amount of meta data and only several of this information is required by journals there is the need to sort out. Therefore a table linking which information is essential and where to find it in the flattened JSON is useful. Such a here refered to as 'term matching table' can be created with `term_matching_table()` by submitting two arguments. The first, `instrument_list` takes a vector with the names of the instruments represented in the JSON file. The second one, `origin_key` specifies which requirements should be met. If it stays empty, all journals are selected. While `'jpr_guidelines_ms'` stands for the requirements of the Journal of Proteome Research, `'miape'` for the Minimal Information about a Proteomics Experiment (MIAPE) from the Proteomics Standards Initiative.. ``` r term_matching_table <- create_term_match_table( instrument_list = c('Thermo EASY-nLC', 'Q Exactive - Orbitrap_MS'), - origin_key = 'jpr') + origin_key = 'jpr_guidelines_ms') ``` The names of the instruments can be shown for each group with `instrument_names()` with the json and the group number as arguments. diff --git a/data/tmt_list.rda b/data/tmt_list.rda index fe43b2c89795f5cd4fcbc5426d3b4948cdbbbaaa..ebc677e452a943d9933a8b6db79402e19e8d852c 100644 GIT binary patch literal 2712 zcmV;J3TO2~T4*^jL0KkKS>A0zmH-psf9?PO|Nqwi|Nk%l|LVX0|L{Nn0ss;K5C9MW z00H0*KYc&}e8WP3P$)%8p;ZJzC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G z32ZnD4RxyaA8VwU&6cWOoiWxT;_8YZU;P7;{ zLe68T7t9|xTH6%oycWd{X;&-193k6BTUy;=K?ue)8UsOyL4!wI1XD}i&A4{szhc=! z`gXf&qiB{F2&W`&JgVd&i_R7rJZNrU|K$N*(1$oH&V(DWU2z2})S&yWuGsE>ucADo z!s!9fsO?2yuHXUO2LsT}DCVyV#5HU=kFKjoiok%uj6*akGnO`JglIJzG-I+q zF!Z5Bcv!*3!QTh=E8SSDm0gnQKM0*m-Cam{pz8liMb$FB8*!*UC4cdEBvXY64{tU~ E&`X~D0RR91 diff --git a/man/create_term_match_table.Rd b/man/create_term_match_table.Rd index eefbeab..45bd83d 100644 --- a/man/create_term_match_table.Rd +++ b/man/create_term_match_table.Rd @@ -12,8 +12,8 @@ create_term_match_table(instrument_list = c("Thermo_EASY-nLC", \item{origin_key}{Specifies which information is required. If empty, all information is used. -"jpr" for the requirements of the Journal of Proteome Research. -"mcp" for the requirements of the Molecular and Cellular Proteomics.} +"jpr_guidelines_ms" for the requirements of the Journal of Proteome Research. +"miape" for The Minimal Information about a Proteomics Experiment (MIAPE) from the Proteomics Standards Initiative.} } \value{ A table needed to extract the meta data with match_terms(). @@ -24,6 +24,6 @@ create term matching Table \examples{ term_matching_table <- create_term_match_table( instrument_list = c("Thermo_EASY-nLC", "Q_Exactive_-_Orbitrap_MS"), - origin_key = "jpr") + origin_key = "jpr_guidelines_ms") } diff --git a/man/grapes-greater-than-grapes.Rd b/man/grapes-greater-than-grapes.Rd index 3757683..687da3a 100644 --- a/man/grapes-greater-than-grapes.Rd +++ b/man/grapes-greater-than-grapes.Rd @@ -4,5 +4,5 @@ \alias{\%>\%} \title{magrittr forward-pipe operator} \description{ -See \code{\link[magrittr]{\%>\%}}. +magrittr forward-pipe operator } diff --git a/man/grapes-less-than-greater-than-grapes.Rd b/man/grapes-less-than-greater-than-grapes.Rd index 7863c51..b8a296f 100644 --- a/man/grapes-less-than-greater-than-grapes.Rd +++ b/man/grapes-less-than-greater-than-grapes.Rd @@ -4,5 +4,5 @@ \alias{\%<>\%} \title{magrittr compound assignment pipe operator} \description{ -See \code{\link[magrittr]{\%<>\%}}. +magrittr compound assignment pipe operator } diff --git a/man/match_terms.Rd b/man/match_terms.Rd index 1eff459..87237c3 100644 --- a/man/match_terms.Rd +++ b/man/match_terms.Rd @@ -27,7 +27,7 @@ flat_json <- flatten_json(json) term_matching_table <- create_term_match_table( instrument_list = instrument_names(json, 1), - origin_key = "jpr") + origin_key = "jpr_guidelines_ms") vector_of_group_tables <- match_terms(flat_json, term_matching_table) diff --git a/man/one_group_match_terms.Rd b/man/one_group_match_terms.Rd index 82725a0..7f24868 100644 --- a/man/one_group_match_terms.Rd +++ b/man/one_group_match_terms.Rd @@ -29,7 +29,7 @@ flat_json <- flatten_json(json) term_matching_table <- create_term_match_table( instrument_list = instrument_names(json, 1), - origin_key = "jpr") + origin_key = "jpr_guidelines_ms") meta_data_table <- one_group_match_terms(flat_json, term_matching_table, 1) diff --git a/man/save_all_groups.Rd b/man/save_all_groups.Rd index 3395e5f..06eebf9 100644 --- a/man/save_all_groups.Rd +++ b/man/save_all_groups.Rd @@ -24,7 +24,7 @@ flat_json <- flatten_json(json) term_matching_table <- create_term_match_table( instrument_list = c("Thermo_EASY-nLC", "Q_Exactive_-_Orbitrap_MS"), - origin_key = "jpr") + origin_key = "jpr_guidelines_ms") vector_of_group_tables <- match_terms(flat_json, term_matching_table) diff --git a/man/save_group_table.Rd b/man/save_group_table.Rd index 774f529..1f72a47 100644 --- a/man/save_group_table.Rd +++ b/man/save_group_table.Rd @@ -26,7 +26,7 @@ flat_json <- flatten_json(json) term_matching_table <- create_term_match_table( instrument_list = c("Thermo_EASY-nLC", "Q_Exactive_-_Orbitrap_MS"), - origin_key = "jpr") + origin_key = "jpr_guidelines_ms") vector_of_group_tables <- match_terms(flat_json, term_matching_table) diff --git a/man/tmt_one_instrument.Rd b/man/tmt_one_instrument.Rd index fb152f4..4c90f39 100644 --- a/man/tmt_one_instrument.Rd +++ b/man/tmt_one_instrument.Rd @@ -12,7 +12,7 @@ tmt_one_instrument(instrument, origin_key = "") \item{origin_key}{Specifies which information is required. If empty, all information is used. "jpr_guidelines_ms" for the requirements of the Journal of Proteome Research. -"mcp_guidelines_ms" for the requirements of the Molecular and Cellular Proteomics.} +"miape" for the Minimal Information about a Proteomics Experiment (MIAPE) from the Proteomics Standards Initiative.} } \value{ Table with tmt part for this instrument. diff --git a/vignettes/.gitignore b/vignettes/.gitignore new file mode 100644 index 0000000..097b241 --- /dev/null +++ b/vignettes/.gitignore @@ -0,0 +1,2 @@ +*.html +*.R diff --git a/vignettes/manipulate_term_match_table.Rmd b/vignettes/manipulate_term_match_table.Rmd new file mode 100644 index 0000000..0ca62ed --- /dev/null +++ b/vignettes/manipulate_term_match_table.Rmd @@ -0,0 +1,84 @@ +--- +title: "Term matching tables" +author: "Marina Kiweler" +date: "`r Sys.Date()`" +output: rmarkdown::html_vignette +vignette: > + %\VignetteIndexEntry{Vignette Title} + %\VignetteEngine{knitr::rmarkdown} + %\VignetteEncoding{UTF-8} +--- + +```{r setup, include = FALSE} +knitr::opts_chunk$set( + collapse = TRUE, + comment = "#>" +) +library(MARMoSET) +``` + +## Structure + +The term matching table contains links between the information needed to create the output table. +Some general term matching tables can be created by the function `create_term_matching_table()` by specifying the used instruments and the origin key. + +This function falls back on the included list of data frames `tmt_list` where each table is designed to fit one instrument. By calling the function with only one instrument name it will just extract the specific data frame. If called with more than one instrument (ordinarily 2) it will bind the tables together. + +```{r} +tmt_LC_pump <- create_term_match_table( + instrument_list = c("Thermo EASY-nLC")) + # no origin key +``` + +The table always consists of 6 columns whose order is important. The count of rows differ depending on the choosen requirements and the type of instrument. +```{r} +colnames(tmt_LC_pump) +``` + +The first collumn of the resulting table is always the `term`. It is a short and unique description of the row. While the second, `term_verbose` contains a more detailed and readable title. + +```{r} +head(tmt_LC_pump[1:2]) +``` + +The third collumn `origin` contains keys determining which requirements to satisfy. These keys were read in the function `create_term_matching_table()` and compared to the value of `origin_key`. + +```{r} +head(tmt_LC_pump[3]) +``` +In the fourth column `handle_type` specifys how to interpret the fifth column `handle`. +"list_path" indicates that `handle` is a path in the flattened json. +"literal" leads to just copy the value of the handle. +With "parameter" the row stays empty because the information is not represented in the json. + +```{r} +head(tmt_LC_pump[4:5]) +``` + +The last collumn shows an example of which value the row could have. + +```{r} +head(tmt_LC_pump[c(2,6)]) +``` + +## Create an own combination of the available requirements + +First extract a term matching table for the used instruments without specifying the origin key. + +```{r} +full_tmt <- create_term_match_table( + instrument_list = c("Thermo EASY-nLC", "Q Exactive - Orbitrap_MS")) + # no origin key +``` + +Now it is possible to subset or delete some rows with r tools. + + +New rows can be added too. + +It is necessary to fill in `term_verbose`, `handle_type` and `handle` in their specific column. +`term_verbose` should be a short desription for the collumn as it will show up as key in the final table. +If `handle` contains a string that just needs to be copied to the output table the collumn `handle_type` should contain `"literal"`. + +If the row is meant to show an entry of the json `handle_type` needs to be `"list_path"` and `handle` should contain the path to the information in the flattened json after the group number. For example: The entry `flat_json[["Group.1.Instruments.Thermo EASY-nLC.InstrumentFriendName"]]` can be accessed with the value of handle = `"Instruments.Thermo EASY-nLC.InstrumentFriendName`" + diff --git a/vignettes/using_MARMoSET.Rmd b/vignettes/using_MARMoSET.Rmd index 20c67f9..39b6692 100644 --- a/vignettes/using_MARMoSET.Rmd +++ b/vignettes/using_MARMoSET.Rmd @@ -79,12 +79,12 @@ flat_json <- flatten_json(json = json) ``` Since raw files include a huge amount of meta data and only several of this information is required by journals there is the need to sort out. Therefore a table linking which information is essential and where to find it in the flattened JSON is useful. Such a here refered to as 'term matching table' can be created with `term_matching_table()` by submitting two arguments. The first, `instrument_list` takes a vector with the names of the instruments represented in the JSON file. -The second one, `origin_key` specifies which requirements should be met. If it stays empty, all journals are selected. While `'jpr'` stands for the requirements of the Journal of Proteome Research, `'mcp'` chooses the requirements of the Molecular and Cellular Proteomics. +The second one, `origin_key` specifies which requirements should be met. If it stays empty, all journals are selected. While `'jpr_guidelines_ms'` stands for the requirements of the Journal of Proteome Research, `'miape'` for the Minimal Information about a Proteomics Experiment (MIAPE) from the Proteomics Standards Initiative. ```{r} term_matching_table <- create_term_match_table( instrument_list = c('Thermo EASY-nLC', 'Q Exactive - Orbitrap_MS'), - origin_key = 'jpr') + origin_key = 'jpr_guidelines_ms') ``` The names of the instruments can be shown for each group with `instrument_names()` with the json and the group number as arguments.