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

calc_vol() errors with 'could not find function attomcount2tibble' #105

Closed
VaishChar opened this issue Mar 21, 2024 · 10 comments
Closed

calc_vol() errors with 'could not find function attomcount2tibble' #105

VaishChar opened this issue Mar 21, 2024 · 10 comments
Labels
bug Something isn't working

Comments

@VaishChar
Copy link

I tried uninstalling and reinstalling R. My R version is 4.3.3. and all the packages are up to date. I also used uploaded libraries ChemmineR, ChemmineOB, and KEGGREST.
At the last step of the example, I receive this error-
Error in atomcount2tibble(ChemmineR::atomcount(compound_sdf)) :
could not find function "atomcount2tibble"
(I can upload the R file if necessary)

If I only use the R code on the https://meredith-lab.github.io/volcalc/
I get these errors-
Open Babel Error in GetStringValue
InChIFormat is not loaded in R

curl::curl_fetch_memory(url, handle = handle) Failure when receiving data from the peer

Thank you for helping inadvance

@Aariq
Copy link
Collaborator

Aariq commented Mar 22, 2024

Thanks for using volcalc and reporting this!

  1. regarding the atomcount2tibble() error, I'm not sure what would cause this. Can you share the code you used to get this error?

  2. regarding the Open Babel Error—are you on Windows by any chance? The version of Open Babel bundled with ChemmineOB is not able to generate InChI (InChI not generated on windows version girke-lab/ChemmineOB#37 (comment)), but this shouldn't be an issue for volcalc as it does not use InChI. Unfortunately there isn't a way to silence these Open Babel errors about InChI generation and you'll just have to ignore them.

  3. I'm assuming the curl error happened when running get_mol_kegg(), is that correct? Do you get this error consistently? It could be that the KEGG API was down temporarily when you ran this, or that your internet connection was interrupted during download. If this persists, let me know and I can look into it.

@Aariq
Copy link
Collaborator

Aariq commented Mar 22, 2024

The curl error could also have come up because of downloading to a temporary directory. If you change the out_path in the example you might have better luck. E.g.

files <- get_mol_kegg(c("C16181", "C00042"), dir ="path/to/download/folder")

@Aariq Aariq changed the title ChemmineR error not allowing calc_vol() to function calc_vol() errors with could not find function attomcount2tibble Mar 22, 2024
@Aariq Aariq changed the title calc_vol() errors with could not find function attomcount2tibble calc_vol() errors with 'could not find function attomcount2tibble' Mar 22, 2024
@Aariq Aariq added the bug Something isn't working label Mar 22, 2024
@VaishChar
Copy link
Author

VaishChar commented Mar 22, 2024 via email

@Aariq
Copy link
Collaborator

Aariq commented Mar 22, 2024

I don't think your attachment made it through to the GitHub issue, but you could include a minimal reproducible example (AKA a reprex) and that would help to diagnose your problem.

Unfortunately, there is no way in R to silence the Open Babel messages, errors, and warnings produced by ChemmineOB, a dependency of volcalc (see notes/discussion in #85 and #56).

@VaishChar
Copy link
Author

Volcalc_03222024.pdf
I have uploaded a .pdf file that was created using R. While using the Reprex package, I found it quite complicated to utilize. In the third chunk of the code, I have hashtagged it since it gave errors. In the same chunk, where I mentioned the paths for the R code, I copy-pasted the code from Github and created functions. However, the last two lines for the functions "get_mol_kegg" and "vol_calc" didn't run and gave an "atom2tibble of ChemmineR" error.
I appreciate your help.

@Aariq
Copy link
Collaborator

Aariq commented Mar 22, 2024

volcalc is an R package that needs to be installed rather than sourcing .R files in this repository. Try this:

install.packages("volcalc", repos = c("https://cct-datascience.r-universe.dev", getOption("repos")))
library(volcalc)
out_path <- "./output"
files <- get_mol_kegg(compound_ids = "C16181", dir = out_path)
calc_vol(files$mol_path)

You can generate a reprex by copying these lines to the clipboard (without the install.packages() command) and then running reprex::reprex() and then pasting into GitHub like so:

library(volcalc)
out_path <- "./output"
files <- get_mol_kegg(compound_ids = "C16181", dir = out_path)
calc_vol(files$mol_path)
#> # A tibble: 1 × 5
#>   mol_path            formula  name                                 rvi category
#>   <chr>               <chr>    <chr>                              <dbl> <fct>   
#> 1 ./output/C16181.mol C6H7Cl5O beta-2,3,4,5,6-Pentachlorocyclohe…  6.98 high

Created on 2024-03-22 with reprex v2.1.0

@VaishChar
Copy link
Author

VaishChar commented Mar 22, 2024 via email

@Aariq
Copy link
Collaborator

Aariq commented Mar 22, 2024

Your reprex shows no errors and returns the correct results for that compound.

library(volcalc)
out_path <- output.path.1
files <- get_mol_kegg(compound_ids = "C16181", dir = out_path)
calc_vol(files$mol_path)
#> # A tibble: 1 × 5
#>   mol_path                                          formula name    rvi category
#>   <chr>                                             <chr>   <chr> <dbl> <fct>
#> 1 C:/Users/padakiv/AppData/Local/Temp/RtmpiGDUrj/r… C6H7Cl… beta…  6.98 high

I wouldn't expect any of the code copied from the .R files in this repository to work, so I am not surprised by those errors. The code in this repository is not meant to be run by users in this way, it is part of an R package. The volcalc package needs to be installed to work correctly, just like any other R package. There's some good information about installing and loading R packages here: https://moderndive.netlify.app/1-getting-started#packages

You might also find it helpful to take a look at the "Getting Started" page for volcalc here: https://meredith-lab.github.io/volcalc/articles/volcalc.html.

@VaishChar
Copy link
Author

VaishChar commented Mar 22, 2024 via email

@Aariq
Copy link
Collaborator

Aariq commented Mar 22, 2024

Great! Glad you got it working. Let us know if you have other questions or run into other issues.

@Aariq Aariq closed this as completed Mar 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants