add_lib_collection.Rd
Bulk add multiple libraries for lipid matching
add_lib_collection(rule_file, path = ".")
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 |
A tibble with all added libraries. The created libraries are also added to the full list of available libraries.
# File cotanining list of libraries and their matching rules rule_file <- system.file("extdata", "library_info.csv", package = "lipID") readr::read_csv(rule_file)#>#> #> #> #> #> #> #> #> #> #> #>#> # 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)#>#> #> #> #> #> #> #> #> #> #> #>#>#> #> #> #> #> #> #> #> #> #> #> #> #> #>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>#> # 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>#> # 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>