Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Interacting with R & RStudio


If you aren't familiar with using R and RStudio, check out our quick tutorial.


Install Spectre from Github

TiptitleInstalling new, or updating?

Check Spectre version

To see if you have Spectre installed, you can open RStudio and look under the 'packages' tab. The version will be listed in the right hand column. Hit the Image Modified button to refresh the package list if you need. If you have the latest version installed, R won't install it again. If you have an older version, the R will install the latest version. If you wish, you can check the Spectre Home Page for the latest version. 

Image Modified

Tip
titleTip

If you are updating Spectre, we advise deleting the previous installation to ensure a clean update.


Code Block
languagepy
themeMidnight
remove.packages('Spectre')

.

Install Devtools

In R, install and load the 'devtools' package. The devtools package has a number of dependencies (packages that it needs to use) that it will automatically install when you install 'devtools' – this might take some time.

Code Block
languagepy
themeMidnight
## Install (if not already installed)
if(!require('devtools')) {install.packages('devtools')}


Tip
titleTip

After installing devtools, we recommend restarting RStudio, otherwise you may see an error like the following:

Code Block
languagepy
Downloading GitHub repo immunedynamics/spectre@HEAD
Error in utils::download.file(url, path, method = method, quiet = quiet,  : 
  download from 'https://api.github.com/repos/immunedynamics/spectre/tarball/HEAD' failed


.

Install Spectre

Subsequently, use the 'install_github' function to install and load the Spectre package. By default this will load the 'master' branch, which is the same as the latest stable release version (listed at https://immunedynamics.github.io/spectrecom/ImmuneDynamics/Spectre/releases). To install a specific release version, see https://cran.r-project.org/web/packages/githubinstall/vignettes/githubinstall.html.

Code Block
languagepy
themeMidnight
## Install Spectre
library('devtools')

options(timeout=6000) # this changes the 'timeout' limit for downloading the package
devtools::install_github("immunedynamics/spectre")

.

Tip
titleUpdating
If you are updating Spectre (rather than installing for the first time), we recommend re-starting RStudio at this point. 
 # this will download and install Spectre


Info

If you are trying to install the 'development' version of Spectre, use:

options(timeout=6000)

devtools::install_github("immunedynamics/spectre", ref = 'development')

.

Confirm or decline updates

During installation, you may see a message like the following. You can update all the packages if you wish, but if you are unsure, or using multiple packages in other contexts, it might be wise to wait until you have time to update everything and test your scripts afterwards.

Code Block
languagepy
themeConfluence
These packages have more recent versions available.
Which would you like to update?

1: All                               
2: CRAN packages only                
3: None                              
4: rlang    (0.4.1  -> 0.4.2 ) [CRAN]
5: digest   (0.6.22 -> 0.6.23) [CRAN]
6: roxygen2 (7.0.0  -> 7.0.1 ) [CRAN]

Enter one or more numbers, or an empty line to skip updates:


Code Block
languagepy
themeMidnight
# Type '1' and press enter to update all packages, or '3' and press enter for no updates
3

.

Install additional required packages

When you install Spectre, most of the dependencies will be installed automatically, excluding some packages from BioConductor. You an install these separately by running the following:

Code Block
languagepy
themeMidnight
Spectre::package.install()

When you install Spectre, most of the dependencies will be installed automatically, excluding some packages from BioConductor. You an install these separately by running the following:

Expand
titleIf required, you can install the Bioconductor packages manually (click to expand)

## Install BiocManager to download packages from Bioconductor
     if (!requireNamespace("BiocManager", quietly = TRUE)) install.packages("BiocManager")

## Download additional BioConductor packages
     if(!require('flowCore')) {BiocManager::install('flowCore')}
     if(!require('Biobase')) {BiocManager::install('Biobase')}
     if(!require('flowViz')) {BiocManager::install('flowViz')}
     if(!require('FlowSOM')) {BiocManager::install('FlowSOM')}

.

Load libraries (to check installation).

Once the packages have been installed, you can load the libraries by running the following. Please ensure that each library successfully loads. If any do not load, or are listed as unavailable, please see the troubleshooting section below.

The Spectre package is designed to helps various computational tools work nicely with each other, in a single environment, design for high-dimensional cytometry/single-cell analysis. To do this, many of Spectre's functions are 'wrappers' for other packages (e.g. Spectre has functions to run FlowSOM and UMAP, but these functions use the code from the FlowSOM and UMAP R packages respectively) – ensuring the input and output parameters work in a consistent fashion, and adding modifications to tailor these packages to cytometry analysis. Because of this, Spectre requires the installation of a number of other packages. By default, many of these will be installed automatically when you install Spectre. However, this can sometimes be a problem if a necessary package attempts to be installed, but for some reason it can't be. In these cases, the error messages informing you that the package was not installed are easily missed.


Possible queries during installation

R will inform you of which additional package are being installed.

Image Added

As each dependency (package) is being installed, you will see updates.

Image Added

If you see the following prompt, click 'Install'.

Image Added

Image Added

Image Added

Image Added

You may be asked for permission to compile the code for certain pages, type 'Yes' and run the code.

Image Added

Image Added

Code Block
languagepy
themeMidnight
Yes



Successful installation

If the installation was successful, you should see something similar to the following:

Code Block
languagepy
themeConfluence
✓  checking for file ‘/private/var/folders/zf/7wygqzns5vx7ycttdgcc4byc0000gp/T/RtmpDchxP7/remotes9a66a1a4064/ImmuneDynamics-Spectre-c1401e6/DESCRIPTION’ ...
─  preparing ‘Spectre’: (879ms)
✓  checking DESCRIPTION meta-information ...
─  checking for LF line-endings in source and make files and shell scripts
─  checking for empty or unneeded directories
─  building ‘Spectre_0.5.4.tar.gz’
   
* installing *source* package ‘Spectre’ ...
** using staged installation
** R
** data
*** moving datasets to lazyload DB
** inst
** byte-compile and prepare package for lazy loading
** help
Warning: /private/var/folders/zf/7wygqzns5vx7ycttdgcc4byc0000gp/T/RtmpQekn8e/R.INSTALL231e7ae0ba82/Spectre/man/demo.exp.Rd: docType ‘demo.exp’ is unrecognized
*** installing help indices
** building package indices
** testing if installed package can be loaded from temporary location
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (Spectre)

You can check on the status of Spectre and the other package dependencies by running 'package.check()'.

Code Block
languagepy
themeMidnight
## Check if all required packages have been installed
Spectre::package.check()

.

If installation of each package was successful, then you can proceed to load the other key packages.

Tip
titleOutput: if installation was successful

Nothing will be returned in R, or message relating to the loading of these packages will be returned.

.

If installation of any specific package was not successful, you will see something like the following. If this occurs, you will need to attempt to install the packages directly. If you need help, please feel free to submit an issue on the Spectre Github repository.

Warning
titleOutput: if installation was unsuccessful

Error in library('plyr') : there is no package called ‘plyr’

.You should see something like the following returned, but with the most recent version of Spectre.

Code Block
languagepy
Package: Spectre
 -- Version (on disk): 0.5.3
 -- Version (loaded):  0.5.3
 -- Install date:      2021-06-19
 -- Install source:    Github (immunedynamics/spectre@c1401e6)
 -- Install path:      /Library/Frameworks/R.framework/Versions/4.1/Resources/library/Spectre
 -- R version:         R version 4.1.0 (2021-05-18)
 -- OS:                macOS Catalina 10.15.7

Checking dependency packages...
 -- All packages successfully installed.
               
Check out 'https://immunedynamics.github.io/spectre/' for protocols

.

Load libraries (packages)

You can then load the required packages using the 'package.load()' function.

Package installations can fail due to a number of reasons, including R version incompatibilities (for example, Spectre v0.1 will not work in R v3.3.0), or package incompatibilities. If you are having problems installing Spectre, please submit an issue on the Spectre Github repository. Alternatively, you can install Spectre using one of our self-contained docker images
Code Block
languagepy
themeMidnight
## Load all required packages
Spectre::package.load()
Warning
titleTroubleshooting



Unsuccessful installation


If Spectre or any of the dependencies was not installed successfully, you may see some error messages like the following.

Image Added

Alternatively, if Spectre was successfully installed, but when running 'package.check()' some of the dependencies were not been installed correctly, you will see something like the following:

Code Block
languagepy
Checking dependency packages...
 -- Biobase is required but not installed. Please install from BioConductor.
               
Check out 'https://immunedynamics.github.io/spectre/getting-started/' for help with installation


Warning
titleInstallation troubleshooting

If you run into problems during installation, check out our installation troubleshooting page. Alternatively, you can report an issue on Github, ask for help on our discussion board, or email us.