Bulk add multiple libraries for lipid matching

add_lib_collection(rule_file, path = ".")

Arguments

rule_file

CSV file containing the library list and rules. Use the template provided in the examples below.

path

Folder path containing a list of CSV files for libraries. All csv files listed in rule_file must be present. See examples below.

Value

A tibble with all added libraries. The created libraries are also added to the full list of available libraries.

Examples

# File cotanining list of libraries and their matching rules rule_file <- system.file("extdata", "library_info.csv", package = "lipID") readr::read_csv(rule_file)
#> Parsed with column specification: #> cols( #> file = col_character(), #> and_cols = col_character(), #> or_cols = col_character(), #> dda = col_logical(), #> aif = col_logical(), #> class_only = col_logical(), #> mode = col_character(), #> adduct = col_character(), #> class_name = col_character() #> )
#> # A tibble: 1 x 9 #> file and_cols or_cols dda aif class_only mode adduct class_name #> <chr> <chr> <chr> <lgl> <lgl> <lgl> <chr> <chr> <chr> #> 1 PC_H.c… 2;12 8;9 TRUE TRUE FALSE Pos [M+H]+ Custom Phosphati…
# Folder containing csv files listed in rule_file lib_dir <- system.file("extdata", package = "lipID") mylibs <- add_lib_collection(rule_file, path = lib_dir)
#> Parsed with column specification: #> cols( #> file = col_character(), #> and_cols = col_character(), #> or_cols = col_character(), #> dda = col_logical(), #> aif = col_logical(), #> class_only = col_logical(), #> mode = col_character(), #> adduct = col_character(), #> class_name = col_character() #> )
#> Parsed with column specification: #> cols( #> PC = col_character(), #> `[M+H]+` = col_double(), #> `MH-PC` = col_double(), #> `MH-tail1&TrimethylAmine` = col_double(), #> `MH-tail2&TrimethylAmine` = col_double(), #> `MH-Tail1` = col_double(), #> `MH-Tail2` = col_double(), #> LPC_T1_H = col_double(), #> LPC_T2_H = col_double(), #> `RCOO+58_T1` = col_double(), #> `RCOO+58_T2` = col_double(), #> `PC Head` = col_double() #> )
mylibs
#> # A tibble: 219 x 13 #> `basename(file)` and_cols or_cols dda aif class_only mode adduct #> <chr> <list> <list> <lgl> <lgl> <lgl> <chr> <chr> #> 1 PC_H.csv <chr [2… <chr [… TRUE TRUE FALSE Pos [M+H]+ #> 2 <NA> <chr [1… <chr [… TRUE FALSE FALSE Neg [M-H]- #> 3 <NA> <chr [1… <chr [… TRUE FALSE FALSE Neg [M-H]- #> 4 <NA> <chr [3… <chr [… TRUE FALSE FALSE Neg [M-H]- #> 5 <NA> <chr [4… <chr [… TRUE FALSE FALSE Neg [M-H]- #> 6 <NA> <chr [2… <chr [… TRUE TRUE FALSE Pos [M+H]+ #> 7 <NA> <chr [1… <chr [… TRUE TRUE FALSE Neg [M-H]- #> 8 <NA> <chr [2… <chr [… TRUE TRUE FALSE Neg [M-H]- #> 9 <NA> <chr [1… <chr [… TRUE TRUE FALSE Neg [M-H]- #> 10 <NA> <chr [2… <chr [… TRUE TRUE FALSE Pos [M+NH… #> # … with 209 more rows, and 5 more variables: class_name <chr>, classkmd <dbl>, #> # ions <named list>, user_defined <lgl>, file <chr>
# Get only the added libraries mylibs %>% dplyr::filter(user_defined)
#> # A tibble: 1 x 13 #> `basename(file)` and_cols or_cols dda aif class_only mode adduct #> <chr> <list> <list> <lgl> <lgl> <lgl> <chr> <chr> #> 1 PC_H.csv <chr [2… <chr [… TRUE TRUE FALSE Pos [M+H]+ #> # … with 5 more variables: class_name <chr>, classkmd <dbl>, ions <named list>, #> # user_defined <lgl>, file <chr>
# Get built-in libraries as well as added ones for # speific polarity / acquisition mode. mylibs %>% dplyr::filter(mode == 'Pos', dda) # Pos DDA libs
#> # A tibble: 84 x 13 #> `basename(file)` and_cols or_cols dda aif class_only mode adduct #> <chr> <list> <list> <lgl> <lgl> <lgl> <chr> <chr> #> 1 PC_H.csv <chr [2… <chr [… TRUE TRUE FALSE Pos [M+H]+ #> 2 <NA> <chr [2… <chr [… TRUE TRUE FALSE Pos [M+H]+ #> 3 <NA> <chr [2… <chr [… TRUE TRUE FALSE Pos [M+NH… #> 4 <NA> <chr [2… <chr [… TRUE FALSE FALSE Pos [M+H]+ #> 5 <NA> <chr [4… <chr [… TRUE TRUE FALSE Pos [M+3N… #> 6 <NA> <chr [2… <chr [… TRUE TRUE FALSE Pos [M+NH… #> 7 <NA> <chr [1… <chr [… TRUE TRUE FALSE Pos [M+NH… #> 8 <NA> <chr [2… <chr [… TRUE TRUE FALSE Pos [M+NH… #> 9 <NA> <chr [1… <chr [… TRUE FALSE FALSE Pos [M+NH… #> 10 <NA> <chr [1… <chr [… TRUE FALSE TRUE Pos [M+NH… #> # … with 74 more rows, and 5 more variables: class_name <chr>, classkmd <dbl>, #> # ions <named list>, user_defined <lgl>, file <chr>
mylibs %>% dplyr::filter(mode == 'Neg', aif) # Neg AIF libs
#> # A tibble: 75 x 13 #> `basename(file)` and_cols or_cols dda aif class_only mode adduct #> <chr> <list> <list> <lgl> <lgl> <lgl> <chr> <chr> #> 1 <NA> <chr [1… <chr [… TRUE TRUE FALSE Neg [M-H]- #> 2 <NA> <chr [2… <chr [… TRUE TRUE FALSE Neg [M-H]- #> 3 <NA> <chr [1… <chr [… TRUE TRUE FALSE Neg [M-H]- #> 4 <NA> <chr [4… <chr [… TRUE TRUE FALSE Neg [M-2H… #> 5 <NA> <chr [4… <chr [… TRUE TRUE FALSE Neg [M-H]- #> 6 <NA> <chr [2… <chr [… TRUE TRUE TRUE Neg [M-H]- #> 7 <NA> <chr [2… <chr [… TRUE TRUE FALSE Neg [M-H]- #> 8 <NA> <chr [3… <chr [… TRUE TRUE FALSE Neg [M-H]- #> 9 <NA> <chr [1… <chr [… FALSE TRUE FALSE Neg [M+C2… #> 10 <NA> <chr [1… <chr [… TRUE TRUE FALSE Neg [M-H]- #> # … with 65 more rows, and 5 more variables: class_name <chr>, classkmd <dbl>, #> # ions <named list>, user_defined <lgl>, file <chr>
# Filter your own libraries by Polarity / Acquisition mode mylibs %>% dplyr::filter(user_defined, mode == 'Pos', dda) # Only user_defined / Pos / DDA
#> # A tibble: 1 x 13 #> `basename(file)` and_cols or_cols dda aif class_only mode adduct #> <chr> <list> <list> <lgl> <lgl> <lgl> <chr> <chr> #> 1 PC_H.csv <chr [2… <chr [… TRUE TRUE FALSE Pos [M+H]+ #> # … with 5 more variables: class_name <chr>, classkmd <dbl>, ions <named list>, #> # user_defined <lgl>, file <chr>