ukaraoz / microtrait

Other
22 stars 4 forks source link

The installation of microtrait #3

Open lichaonan0905 opened 2 years ago

lichaonan0905 commented 2 years ago

I'am very interest in the microtrait R package because the reviewers required me to calculate microbial adaptation traits based on metagenome assembled genomes. Because this package integrated many bioinformatics tools, we can save much time in the calculation of microbial adaptation traits, especially for those genetic traits involved in Y-A-S life history strategies. By trying the example code, I got the following exciting results:

image

This is an excellent tool for inferring microbial Y-A-S life history strategies. I am very grateful to the authors for developing this tool. I would also like to thank the reviewers for letting me know about it. If the authors can fix some bugs in prep.hmmmodels() function, I believe that this tool would be widely used in microbial ecology.

  1. If the author can provide a release of this package, the installation would be more easy. May be some problems of my network connection, I can not install microtrait package using devtools::install_github("ukaraoz/microtrait"). My solution is to directly download the zip package of source codes, and then install it using devtools::install_local().

  2. The downloading the database file is too difficult for me, even spent three hours to solve it. The dbCAN database (https://bcb.unl.edu/dbCAN2/download/Databases/dbCAN-HMMdb-V8.txt) is too large, and the prep.hmmmodels() always raise a time out error (reach to 60 seconds). My solution is directly download this database file using "curl" command in my MacOS terminal, and then upload to "extdata/hmm/dbcan". Finally, I modified the source code of download.microtrait() function.

  3. There were also some bugs in download.microtrait() function. I must create a Github token before downloading. This step is too difficult for many users without development experiences.

Here I uploaded the modified codes and I also hope my suggestions can help more users.

prepare-microtrait-db.r.zip

sheaster commented 2 years ago

Hi lichaonan0905, I was wondering if you could explain a little more clearly what you did to get microtrait running? I had no errors installing the microtrait package and I believe I was able to download the database with a token. However, my extracttraits function hangs on the test file. It looks like the file you've uploaded in the zip is actually a modified "prep_hmmpackage.R" rather than "extract_traits.R"... Do you have any suggestions? Thanks, Shea

lichaonan0905 commented 2 years ago

@sheaster I had no errors in running microtrait package. The biggest challenge for me is to download database files. I think you should check your database files again. My running codes were as follows:

library(parallel)

library(tictoc)

library(microtrait)

genomes_dir <- "your genome dirpath"

genomes_files <- list.files(genomes_dir, full.names = T, recursive = T)

message("Running on: ", system("cat /proc/cpuinfo | grep \"model name\" | uniq | sed 's/.*: //'", intern = TRUE), "\n")

message("Number of cores:", detectCores(), "\n")

tictoc::tic.clearlog()

tictoc::tic(paste0("Running microtrait for ", length(genomes_files)))

result <- mclapply(1:length(genomes_files), function(i) { r = extracttraits(genomes_files[i], out_dir = "your output dirpath") saveRDS(r, file = file.path("your cache dirpath", paste0(fs::path_file(genomes_files[i]), ".microtrait.rds.1"))) r }, mc.cores = ncors)

tictoc::toc(log = "TRUE")

You can try again. If there are still errors, I can package my sever environment into a Docker image for you.

lauramason326 commented 1 year ago

Hi Not sure if this is related, but I am also having trouble installing microtrait. It seems to fail at the BiocManager::install("complexHeatmap") step, and I then cannot use devtools to install microtrait.

** byte-compile and prepare package for lazy loading
Warning: replacing previous import ‘Biostrings::collapse’ by ‘dplyr::collapse’ when loading ‘microtrait’
Warning: replacing previous import ‘Biostrings::union’ by ‘dplyr::union’ when loading ‘microtrait’
Warning: replacing previous import ‘Biostrings::intersect’ by ‘dplyr::intersect’ when loading ‘microtrait’
Warning: replacing previous import ‘Biostrings::setdiff’ by ‘dplyr::setdiff’ when loading ‘microtrait’
Warning: replacing previous import ‘Biostrings::setequal’ by ‘dplyr::setequal’ when loading ‘microtrait’
Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) : 
  there is no package called ‘gRodon’
Calls: <Anonymous> ... loadNamespace -> withRestarts -> withOneRestart -> doWithOneRestart
Execution halted
ERROR: lazy loading failed for package ‘microtrait’
* removing ‘/users/PAS1212/lauramason326/R/x86_64-pc-linux-gnu-library/4.0/microtrait’
Warning message:
In i.p(...) :
  installation of package ‘/tmp/RtmpP141IV/file278ce1ff83767/microtrait_1.0.0.tar.gz’ had non-zero exit status

Any suggestions? Thanks Laura

EDIT: it appears that the actual problem is that I do not have gRodon, and that this package is not available in my version of R. Has anyone found a workaround to this?