Here is the detailed version of the installation tutorial, the installation process encountered errors, you can find detailed solutions in this article.

If the following solutions do not help you, please leave a comment on the website. We will solve the problem as soon as possible and add the solution to this document for more users to read.

Problems caused by the system

Ubuntu

In the Ubuntu system, when installing the ape dependency package, there may be the following problems:

#  error "/usr/bin/ld: cannot find -llapack"
#  error "/usr/bin/ld: cannot find -lgfortran"

This is due to a lack of basic tools from the system. Install these tools using shell commands:

sudo apt install liblapack-dev libopenblas-dev gfortran

Problems caused by R version

The development environment of itol.toolkit package is R4.2.0. Since R version 4.0.0, some important language habit updates have been released, among which the updates of Rcpp, rlang and other underlying packages have a great impact on users below R version 4.0.0. itol.toolkit running in versions earlier than R4.0.0 may cause some errors caused by underlying dependency packages. Run itol.toolkit at R 4.0.0 or later possibly.

nchar error in quickstart

The following error occurs when running the quickstart tutorial:

unit <- create_unit(data = df_group,  
                    key = "Quickstart",  
                    type = "DATASET_COLORSTRIP",  
                    tree = tree)

#  Error in char (data[[potential_color]]) :
#  'nchar()' requires a character vector

The best way is to install itol.toolkit v1.1.2 and later, where we removed the nchar dependency in favor of stringr::str_length, which is more stable across R versions.

The temporary solution is to explicitly define the color parameter in the create_unit function.

unit <- create_unit(data = df_group,  
                    key = "Quickstart",  
                    type = "DATASET_COLORSTRIP",  
                    color = "Set1",
                    tree = tree)

Problems caused by dependency packages

Biostrings

R packages from the Bioconductor platform cannot be automatically installed by install.packages or devtools::install_github. This will result in an error similar to the following:

#  error "package ‘Biostrings’ is not available (for R version 3.6.3)"

The best way is to use pak package to install itol.toolkit package. See the main document for the method.

Another way is to install dependency packages using BiocManager:

# install.packages("BiocManager")
BiocManager::install("Biostrings")

fansi

This is a typical indirectly dependcy package.

#  Error: package or namespace load failed for 'itol.toolkit' in library.dynam(lib, package, package.lib):
#  DLL ‘fansi’ not found: maybe not installed for this architecture?
#  Error: loading failed
#  Stop
#  *** arch - x64
#  ERROR: loading failed for 'i386'
#  * removing 'C:/Users/86139/Documents/R/win-library/4.1/itol.toolkit'
#  Warning message:
#  In i.p(...) :
#    installation of package ‘C:/Users/86139/AppData/Local/Temp/Rtmpycftoi/file45b02cc43b42/itol.toolkit_1.1.2.tar.gz’ had non-zero exit status

The best solution is using pak to install:

install.packages("pak")

# from CRAN
pak::pak('itol.toolkit')

# from GitHub
# not work for this status https://github.com/r-lib/pak/issues/473
pak::pak('TongZhou2017/itol.toolkit') 

Others

The complete dependency package information is as follows. If you have network problems, download the dependency package manually and install it locally. See the next section for details.

package platform function in itol.toolkit
dplyr CRAN Data processing
stringr CRAN String processing; nchar repalce
data.table CRAN Data processing
methods CRAN Object base function
stats CRAN Data processing
tidyr CRAN Data frame processing
purrr CRAN Data screening
seqinr CRAN Tree file processing
ape CRAN Tree file processing
Biostrings Bioconductor fasta format sequence read
wesanderson CRAN Color scheme
ggsci CRAN Color scheme
RColorBrewer CRAN Color scheme
rstudioapi CRAN RStudio Plug-in base
shiny CRAN RStudio Plug-in base
miniUI CRAN RStudio Plug-in base
colourpicker CRAN RStudio Plug-in base

Problems caused by the network

If you encounter similar errors caused by network problems:

#  Warning in install.packages :
#  unable to access index for repository https://cran.rstudio.com/src/contrib:  
#  cannot open URL 'https://cran.rstudio.com/src/contrib/PACKAGES'  
#  Installing package into ‘C:/Users/25757/Documents/R/win-library/4.0’
#  (as ‘lib’ is unspecified)
#
#  Warning in install.packages :
#  unable to access index for repository https://cran.rstudio.com/src/contrib:  
#  cannot open URL 'https://cran.rstudio.com/src/contrib/PACKAGES'  
#
#  Warning in install.packages :
#  package ‘ape’ is not available (for R version 4.0.0)  
#
#  Warning in install.packages :
#  unable to access index for repository https://cran.rstudio.com/bin/windows/contrib/4.0:  
#  cannot open URL 'https://cran.rstudio.com/bin/windows/contrib/4.0/PACKAGES'

Please download the R packages manually from the package homepages in the previous section, and then install them locally using the following command:

install.packages(PathToPkgFile,repos=NULL,type="source")