# prepare cached results for vignette
-inchikey_cache2 = rds_database(
+inchikey_cache2 <- rds_database(
source = file.path(
- system.file('cached',package='MetMashR'),
- 'pubchem_inchikey_mtox_cache2.rds'),
- .writable = FALSE
+ system.file("cached", package = "MetMashR"),
+ "pubchem_inchikey_mtox_cache2.rds"
+ )
)
-inchikey_cache3 = rds_database(
+inchikey_cache3 <- rds_database(
source = file.path(
- system.file('cached',package='MetMashR'),
- 'pubchem_inchikey_mtox_cache3.rds'),
- .writable=FALSE
+ system.file("cached", package = "MetMashR"),
+ "pubchem_inchikey_mtox_cache3.rds"
+ )
)
-N = normalise_strings(
- search_column = 'name',
- output_column = 'normalised_name',
+N <- normalise_strings(
+ search_column = "name",
+ output_column = "normalised_name",
dictionary = c(
# custom dictionary
list(
# replace "NP" with "Compound NP"
- list(pattern = '^NP-',replace = 'Compound NP-'),
+ list(pattern = "^NP-", replace = "Compound NP-"),
# replace ? with NA, since this is ambiguous
- list(pattern = '?',replace = NA,fixed=TRUE),
- # remove terms in trailing brackets e.g." (ATP)"
- list(pattern = '\\ \\([^\\)]*\\)$',replace = ''),
+ list(pattern = "?", replace = NA, fixed = TRUE),
+ # remove terms in trailing brackets e.g." (ATP)"
+ list(pattern = "\\ \\([^\\)]*\\)$", replace = ""),
# replace known abbreviations
- list(pattern = '(+/-)9-HpODE',
- replace = '9-hydroperoxy-10E,12Z-octadecadienoic acid',
- fixed = TRUE),
- list(pattern = '(+/-)19(20)-DiHDPA',
- replace = '19,20-dihydroxy-4Z,7Z,10Z,13Z,16Z-docosapentaenoic acid',
- fixed = TRUE)
+ list(
+ pattern = "(+/-)9-HpODE",
+ replace = "9-hydroperoxy-10E,12Z-octadecadienoic acid",
+ fixed = TRUE
+ ),
+ list(
+ pattern = "(+/-)19(20)-DiHDPA",
+ replace = "19,20-dihydroxy-4Z,7Z,10Z,13Z,16Z-docosapentaenoic acid",
+ fixed = TRUE
+ )
),
# replace greek characters
.greek_dictionary,
# remove racemic properties
.racemic_dictionary
- )) +
+ )
+) +
pubchem_property_lookup(
- query_column = 'normalised_name',
- search_by = 'name',
- suffix = '_norm',
- property = 'InChIKey',
- records = 'best',
- cache = inchikey_cache2) +
+ query_column = "normalised_name",
+ search_by = "name",
+ suffix = "_norm",
+ property = "InChIKey",
+ records = "best",
+ cache = inchikey_cache2
+ ) +
opsin_lookup(
- query_column = 'normalised_name',
- suffix = '_opsin',
- output = 'stdinchikey',
+ query_column = "normalised_name",
+ suffix = "_opsin",
+ output = "stdinchikey",
cache = inchikey_cache3
) +
- combine_columns(
- column_names = c('stdinchikey_opsin','InChIKey_norm','InChIKey'),
- output_name = 'inchikey',
- source_name = 'inchikey_source',
+ prioritise_columns(
+ column_names = c("stdinchikey_opsin", "InChIKey_norm", "InChIKey"),
+ output_name = "inchikey",
+ source_name = "inchikey_source",
clean = TRUE
)
-N = model_apply(N,predicted(id_workflow))
+