# Reading the 'alkanes.msp' file
msp_file <- system.file("extdata", "alkanes.msp", package = "mssearchr")
# Pre-processing
msp_objs_u <- PreprocessMassSpectra(ReadMsp(msp_file)) # unknown mass spectra
msp_objs_l <- PreprocessMassSpectra(massbank_alkanes) # library mass spectra
# Searching using the Identity algorithm
hitlists <- LibrarySearch(msp_objs_u, msp_objs_l,
algorithm = "identity_normal", n_hits = 10L,
hitlist_columns = c("formula", "smiles", "db_no"))
# Printing a hitlist for the first compound from the 'alkanes.msp' file
print(hitlists[[1]][1:5, ])
#> name mf idx formula smiles db_no
#> 1 UNDECANE 950.5551 11 C11H24 CCCCCCCCCCC MSBNK-{...}-JP006877
#> 2 UNDECANE 928.4884 72 C11H24 CCCCCCCCCCC MSBNK-{...}-JP005760
#> 3 DODECANE 905.7546 74 C12H26 CCCCCCCCCCCC MSBNK-{...}-JP006878
#> 4 TRIDECANE 891.7862 41 C13H28 CCCCCCCCCCCCC MSBNK-{...}-JP006879
#> 5 DODECANE 885.6247 42 C12H26 CCCCCCCCCCCC MSBNK-{...}-JP005756
Run the code above in your browser using DataLab