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

Error in ancombc #15

Closed
lakerwsl opened this issue Jan 5, 2021 · 3 comments
Closed

Error in ancombc #15

lakerwsl opened this issue Jan 5, 2021 · 3 comments
Labels
good first issue Good for newcomers

Comments

@lakerwsl
Copy link

lakerwsl commented Jan 5, 2021

Hi,

This package is very interesting. I tried it and found that it reported the error: "Error in eval(predvars, data, env) :
numeric 'envir' arg not of length one" when the data is sparse. I am wondering if you have any suggestions on it.

Shulei

@FrederickHuangLin
Copy link
Owner

Hi @lakerwsl,

Thanks for posting your question! In order for me to better dig into the problem, may you please share with your codes and a mock dataset (with all confidential information marked)?

Thank you,
Huang

@jakob-wirbel
Copy link

Hey hey 👋
i ran into the same problem and i think i found the reason for the error 😄

If you have a single metadata variable (basically, only the group label) AND you would remove samples with the minimum library size cutoff, this part of the code will return the metadata as a vector, not as a data.frame:

# Discard samples with library size < lib_cut
lib_size = colSums(feature_table, na.rm = TRUE)
if(any(lib_size < lib_cut)){
   subj_del = which(lib_size < lib_cut)
   feature_table = feature_table[, - subj_del]
   meta_data = meta_data[- subj_del, ]
}

I think it could be fixed very quickly by changing the line to:

meta_data = meta_data[- subj_del, , drop=FALSE]

Cheers

@FrederickHuangLin
Copy link
Owner

Hi @jakob-wirbel,

Thank you very much for catching this! The package will be updated shortly to fix this BUG!

Best,
Huang

@FrederickHuangLin FrederickHuangLin added the good first issue Good for newcomers label Feb 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants