I have been trying to use the multilevelannotation
function within the xMSannotator
package to process mass spectrometry data. This package can be accessed through using:
install.packages(c('BiocManager','data.table','digest','remotes'))
remotes::install_github('omegahat/XMLSchema')
remotes::install_github('cran/SSOAP')
BiocManager::install(c("SSOAP","KEGGREST","pcaMethods","Rdisop","GO.db","matrixStats","WGCNA"))
remotes::install_github("yufree/xMSannotator")
Part of the function uses hclust
from the flashClust
package. When I attempt to run the code:
multilevelannotation(peaks_formatted, max.mz.diff = 5, max.rt.diff = 5, cormethod = 'pearson', allsteps = TRUE, customIDs = NA,
+ queryadductlist = c('M+H'), mode = 'pos', outloc = FOLDER_LOCATION,
+ corthresh = 0.7, NOPS_check = TRUE, filter.by = c('M+H'), redundancy_check = TRUE, min_ions_perchem = 2)
I get an error for the hclust function:
Error in hclust(d, method, members) :
NA/NaN/Inf in foreign function call (arg 11)
But when I check the data that I am inputting into the function peaks_formatted
I do not have any NA, NaN, or Inf values. Everything is numeric and accounted for. I will attach a segment of the data below. If anyone could help me figure out what is causing the issue in the function, it would be greatly appreciated! The function does not perform properly even for this segment of data that I have formatted to match the description for the function.
dput(peaks_formatted[1:100,])
structure(c(283.176, 283.176, 283.176, 283.176, 327.202, 344.229,
283.176, 327.202, 344.229, 283.176, 327.202, 344.229, 388.255,
327.202, 344.229, 388.257, 388.257, 432.281, 432.283, 388.255,
432.283, 432.283, 432.281, 476.309, 476.309, 450.235, 450.235,
450.235, 450.235, 450.235, 450.235, 450.235, 450.235, 450.235,
450.235, 149.023, 149.023, 353.231, 353.231, 353.231, 442.339,
442.339, 442.338, 442.338, 442.339, 442.339, 442.339, 442.339,
442.339, 171.139, 442.339, 171.139, 442.339, 442.339, 442.339,
442.339, 442.339, 442.339, 442.339, 442.339, 427.267, 427.269,
427.269, 427.269, 427.269, 427.267, 427.267, 427.269, 427.269,
427.269, 427.269, 427.269, 427.269, 353.231, 353.231, 353.231,
353.231, 353.231, 353.231, 353.231, 427.269, 427.269, 427.269,
427.269, 427.269, 427.269, 427.269, 427.269, 427.267, 241.173,
241.173, 241.173, 241.173, 241.174, 241.174, 241.174, 241.173,
241.173, 397.257, 397.257, 2.35545, 2.372216666667, 2.388983333333,
2.405766666667, 2.405766666667, 2.405766666667, 2.422533333333,
2.422533333333, 2.422533333333, 2.4393, 2.4393, 2.4393, 2.4393,
2.456066666667, 2.456066666667, 2.456066666667, 2.472833333333,
2.472833333333, 2.4896, 2.506366666667, 2.506366666667, 2.52315,
2.539916666667, 2.539916666667, 2.556683333333, 5.491316666667,
5.508083333333, 5.52485, 5.541633333333, 5.5584, 5.575166666667,
5.591933333333, 5.6087, 5.625466666667, 5.64225, 10.538833333333,
10.5556, 11.444366666667, 11.461133333333, 11.477916666667, 11.846833333333,
11.8636, 11.880366666667, 11.897133333333, 11.9139, 11.930683333333,
11.94745, 11.964216666667, 11.980983333333, 11.99775, 11.99775,
12.014516666667, 12.014516666667, 12.031283333333, 12.048066666667,
12.064833333333, 12.0816, 12.098366666667, 12.115133333333, 12.1319,
12.148683333333, 12.16545, 12.182216666667, 12.198983333333,
12.232516666667, 12.249283333333, 12.38345, 12.400216666667,
12.416983333333, 12.43375, 12.450516666667, 12.467283333333,
12.484066666667, 12.7356, 12.752366666667, 12.769133333333, 12.7859,
12.802666666667, 12.81945, 12.836216666667, 13.406483333333,
13.42325, 13.440016666667, 13.4568, 13.473566666667, 13.490333333333,
13.5071, 13.523866666667, 13.540633333333, 13.64125, 13.658016666667,
13.6748, 13.691566666667, 13.708333333333, 13.7251, 13.741866666667,
13.758633333333, 13.7754, 13.976633333333, 13.9934, 5120888,
10720821, 14085733, 13480406, 6361454, 7191218, 9390811, 8751110,
10479364, 5037907, 8676705, 10293031, 9128215, 6447618, 7391697,
13946768, 15283445, 5290353, 9508986, 7675063, 12045154, 11051108,
7866525, 6487412, 7153226, 7011878, 8839146, 11027995, 12574535,
13211745, 12895814, 12315661, 10692511, 8633946, 6626917, 5058051,
5233803, 6564920, 7018005, 5860976, 6215841, 7456111, 8188721,
8969946, 9627595, 10079795, 10476910, 10711389, 10267206, 5804270,
10221339, 5564787, 10403471, 10277657, 9880583, 9522666, 8416999,
7738679, 6648989, 5718983, 6672892, 10879869, 16065517, 18122994,
11225500, 5449988, 6031072, 12661615, 19343544, 22175848, 20717468,
15720961, 7912484, 8188520, 9761931, 9375083, 8732126, 9734552,
10035089, 8196589, 10031554, 17558336, 21270952, 21541074, 21743090,
22403300, 20832072, 15101431, 7344160, 5164460, 5350548, 5727486,
5846260, 6029982, 6049908, 5870852, 5611262, 5179754, 5890369,
5819755), dim = c(100L, 3L), dimnames = list(NULL, c("mz", "time",
"intensity")))