Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with metalonda() command: Error: $ operator is invalid for atomic vectors #16

Open
jlucore opened this issue May 7, 2023 · 1 comment

Comments

@jlucore
Copy link

jlucore commented May 7, 2023

Hello, I am having issues running the metalonda() command because I keep producing the error: $ operator is invalid for atomic vectors. This error seems strange because I have ensured all of my vectors are numeric. I am also confused as to what the "points" vector is and how to create it appropriately. For now, my points vector is a list 1:49 since my samples are from days 1:49. Thank you for your assistance. A reproducible answer is below:

otu <- structure(c(2547, 0, 600, 3, 17, 0, 372, 202, 0, 339, 10491,
0, 1417, 2083, 0, 325, 4521, 0, 12366, 6, 5891, 0, 0, 0, 643,
399, 0, 301, 343, 0, 1194, 9, 15835, 0, 56, 0, 20554, 0, 11336,
2, 0, 0, 538, 1104, 0, 2736, 3430, 0, 1347, 1249, 0, 977, 6455,
0, 80, 39, 0, 429, 341, 0, 156, 70, 0, 382, 186, 0, 1751, 925,
0, 0, 7634, 0, 561, 99, 0, 1067, 655, 0, 160, 654, 0, 0, 2009,
0, 139, 0, 5433, 0, 0, 0, 169, 85, 0, 406, 206, 0, 374, 236,
4, 459, 718, 51, 123, 81, 0, 623, 1992, 0, 0, 0, 344, 0, 40,
0, 304, 88, 0, 284, 1372, 0, 79, 96, 0, 130, 403, 0, 144, 61,
0, 357, 731, 40, 95, 504, 0, 2912, 9435, 0, 323, 15, 0, 485,
340, 0, 254, 100, 4, 863, 2210, 0, 32, 21, 0, 219, 443, 0, 1925,
103, 0, 327, 1420, 0, 457, 23, 0, 95, 370, 0, 68, 399, 0, 159,
932, 0, 82, 13, 0, 105, 225, 0, 244, 46, 0, 153, 786, 0, 3105,
1114, 0, 0, 1011, 0, 276, 364, 0, 604, 2936, 0, 417, 154, 0,
224, 710, 0, 55, 26, 0, 198, 254, 0, 92, 8, 0, 236, 37, 0, 243,
123, 0, 195, 161, 0, 115, 123, 0, 869, 577, 0, 1272, 730, 0,
520, 844, 0, 50, 368, 8, 5, 902, 0, 602, 52, 0, 828, 2176, 0,
338, 143, 3, 416, 1341, 31, 1032, 12727, 25637, 0, 5566, 0, 41,
11, 0, 309, 205, 0, 70, 4, 0, 359, 198, 0, 154, 60, 0, 51, 1221,
0, 3, 4, 0, 77, 85, 0, 65, 152, 0, 257, 917, 0, 136, 60, 0, 78,
746, 0), .Dim = c(6L, 49L), .Dimnames = list(c("taxa 1", "taxa 2",
"taxa 3", "taxa 4", "taxa 5", "taxa 6"), c("LID_100039", "LID_100080",
"LID_100105", "LID_100125", "LID_100194", "LID_100225", "LID_100229",
"LID_100551", "LID_101556", "LID_101558", "LID_101560", "LID_101562",
"LID_101564", "LID_101566", "LID_101569", "LID_101570", "LID_101571",
"LID_101573", "LID_101575", "LID_101577", "LID_101581", "LID_101584",
"LID_101587", "LID_101590", "LID_101591", "LID_101592", "LID_101593",
"LID_101594", "LID_101596", "LID_101597", "LID_101601", "LID_101602",
"LID_101604", "LID_101606", "LID_101608", "LID_101610", "LID_101612",
"LID_101613", "LID_101616", "LID_101617", "LID_101618", "LID_101619",
"LID_101620", "LID_101621", "LID_101622", "LID_101623", "LID_101624",
"LID_101630", "LID_101632")))

Group <- structure(c(2L, 1L, 1L, 1L, 2L, 1L, 1L, 2L, 2L, 1L, 1L, 2L, 1L,
1L, 2L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 2L, 1L, 1L, 2L, 1L, 2L, 2L,
2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L,
2L, 2L, 2L, 2L), .Label = c("Female", "Male"))

Individual <- structure(c(64L, 34L, 5L, 23L, 53L, 4L, 47L, 80L, 71L, 43L, 1L,
87L, 48L, 45L, 55L, 18L, 11L, 47L, 75L, 44L, 47L, 10L, 86L, 44L,
28L, 61L, 21L, 73L, 70L, 86L, 45L, 1L, 43L, 47L, 48L, 11L, 16L,
60L, 58L, 40L, 30L, 31L, 50L, 17L, 5L, 86L, 76L, 60L, 69L), .Label = c("F100",
"F101", "F102", "F103", "F104", "F105", "F106", "F107", "F108",
"F109", "F110", "F111", "F112", "F113", "F114", "F115", "F116",
"F117", "F118", "F119", "F120", "F121", "F122", "F123", "F124",
"F125", "F126", "F127", "F128", "F129", "F130", "F131", "F132",
"F32", "F74", "F84", "F85", "F86", "F87", "F88", "F89", "F90",
"F91", "F92", "F93", "F94", "F95", "F96", "F97", "F98", "F99",
"M49", "M50", "M51", "M52", "M53", "M54", "M55", "M56", "M57",
"M58", "M59", "M60", "M61", "M62", "M63", "M64", "M65", "M66",
"M67", "M68", "M69", "M70", "M71", "M72", "M73", "M74", "M75",
"M76", "M77", "M78", "M79", "M80", "M81", "M82", "M83", "M84",
"M85", "M86"))

Time <- structure(c(13L, 5L, 2L, 6L, 4L, 1L, 12L, 3L, 44L, 45L, 44L,
43L, 42L, 42L, 40L, 41L, 39L, 38L, 36L, 37L, 34L, 35L, 33L, 32L,
8L, 9L, 7L, 7L, 26L, 27L, 23L, 22L, 24L, 21L, 28L, 29L, 25L,
19L, 20L, 14L, 15L, 16L, 17L, 18L, 18L, 11L, 10L, 30L, 31L), .Label = c("2015-02-20",
"2015-04-01", "2015-04-03", "2015-05-13", "2015-05-14", "2015-05-18",
"2015-11-25", "2016-01-09", "2016-01-12", "2016-02-02", "2016-02-13",
"2016-02-22", "2016-04-06", "2016-04-15", "2016-04-18", "2016-05-19",
"2016-05-23", "2016-07-02", "2017-06-02", "2017-06-06", "2017-06-16",
"2017-06-23", "2017-06-29", "2017-08-03", "2017-08-12", "2017-08-15",
"2017-08-21", "2017-10-03", "2017-10-06", "2017-12-02", "2017-12-21",
"2018-02-16", "2018-03-02", "2018-05-01", "2018-05-02", "2018-05-24",
"2018-06-01", "2018-06-02", "2018-06-05", "2018-06-11", "2018-06-16",
"2018-07-03", "2018-07-14", "2018-08-01", "2018-08-02"))

points = as.numeric(seq(1, 49, length.out = 49))

output2.metalonda.f5 = metalonda(Count = otu[5,], Time = Time, Group = Group,
ID = Individual, n.perm = 100, fit.method = "nbinomial", points = points,
text = rownames(subset_otu)[5], parall = FALSE, pvalue.threshold = 0.05,
adjust.method = "BH", time.unit = "days", ylabel = "Normalized Count",
col = c("black", "green"), prefix = "Test2_F5")

@Swindle98
Copy link

Swindle98 commented Mar 5, 2024

Hi I'm also getting this issue but when calling the metalondaAll function.

Traceback:

Feature  =  
Start MetaLonDA 
Visualizing Feature =  
Start Curve Fitting 
Fitting: NB SS 
[1] "ERROR in gss = Error in qr.default(s): NA/NaN/Inf in foreign function call (arg 1)\n"
Visualizing Splines of Feature =  
Error in model$dd.null : $ operator is invalid for atomic vectors
3.
visualizeFeatureSpline(aggregate.df, model, fit.method, text,
group.levels, unit = time.unit, ylabel = ylabel, col = col,
prefix = prefix) at Metalonda.R#114
2.
metalonda(Count = data.count.filt[i, ], Time = Time, Group = Group,
ID = ID, fit.method = fit.method, n.perm = n.perm, points = points,
text = rownames(data.count.filt)[i], parall = parall, pvalue.threshold,
adjust.method, time.unit, ylabel = ylabel, col = col, prefix = prefix) at Metalonda.R#320
1.
metalondaAll(Count = count, Group = group, Time = time, ID = ID,
n.perm = 1000, fit.method = "nbinomial", pvalue.threshold = 0.05,
adjust.method = "BH", time.unit = "days", norm.method = "none",
prefix = "Output", ylabel = "Normalized Count", col = c("blue", ...

Looks like its having an error with the gss package?

Edit:
Looks like it was an issue with my data input. I only had one time point for one of the groups.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants