Environment Load and Check

  • this code section is packaged as an include for reuse across all examples
  • it uses the HTML details tag directly to wrap code blocks and output as drop-down sections
Show Environment
library(patchwork)
library(dplyr)

Attaching package: 'dplyr'
The following objects are masked from 'package:stats':

    filter, lag
The following objects are masked from 'package:base':

    intersect, setdiff, setequal, union
library(Seurat)
Loading required package: SeuratObject
Loading required package: sp
'SeuratObject' was built under R 4.3.0 but the current version is
4.3.2; it is recomended that you reinstall 'SeuratObject' as the ABI
for R may have changed

Attaching package: 'SeuratObject'
The following object is masked from 'package:base':

    intersect
  • Is there a typo in the message above? Application Programming Interface, API != ABI

  • Rolling back to R 4.3.0 was not possible with the current version of Seurat

    • the indication was that Seurat requires a version of base Matrix that is not present in R 4.3.0
# which Seurat?
packageVersion("Seurat")
[1] '5.0.0'
# which R?
version[['version.string']]
[1] "R version 4.3.2 (2023-10-31)"
# presto was installed 
# For a (much!) faster implementation of the 
# Wilcoxon Rank Sum Test
packageVersion('presto')
[1] '1.0.0'
# check python is available via reticulate
import sys
print(sys.version.split(" ")[0])
3.12.0
# shell check
python3 -V
Python 3.12.0
# shell check
quarto -v
1.4.489

Functions

Show Functions
# Useful for code development.
# Save the object at a point and reload it into the R console 
# i.e. for developing alternative reports 
# without having to run the pipeline right from the start
# which can be slow
#
# NB: Files produced by saveRDS (or serialized to a file connection) 
# are not suitable as an interchange format between machines
# 
# For that use hdf5 or transfer data and code to reproduce the result 

saveRDS_overwrite <- function(file_path) {
  if (file.exists(file_path)) {
    file.remove(file_path)
  } 
  saveRDS(pbmc, file = file_path)
}