Last updated: 2024-03-19

Checks: 7 0

Knit directory: muse/

This reproducible R Markdown analysis was created with workflowr (version 1.7.1). The Checks tab describes the reproducibility checks that were applied when the results were created. The Past versions tab lists the development history.


Great! Since the R Markdown file has been committed to the Git repository, you know the exact version of the code that produced these results.

Great job! The global environment was empty. Objects defined in the global environment can affect the analysis in your R Markdown file in unknown ways. For reproduciblity it’s best to always run the code in an empty environment.

The command set.seed(20200712) was run prior to running the code in the R Markdown file. Setting a seed ensures that any results that rely on randomness, e.g. subsampling or permutations, are reproducible.

Great job! Recording the operating system, R version, and package versions is critical for reproducibility.

Nice! There were no cached chunks for this analysis, so you can be confident that you successfully produced the results during this run.

Great job! Using relative paths to the files within your workflowr project makes it easier to run your code on other machines.

Great! You are using Git for version control. Tracking code development and connecting the code version to the results is critical for reproducibility.

The results in this page were generated with repository version ae0ea42. See the Past versions tab to see a history of the changes made to the R Markdown and HTML files.

Note that you need to be careful to ensure that all relevant files for the analysis have been committed to Git prior to generating the results (you can use wflow_publish or wflow_git_commit). workflowr only checks the R Markdown file, but you know if there are other scripts or data files that it depends on. Below is the status of the Git repository when the results were generated:


Ignored files:
    Ignored:    .Rproj.user/
    Ignored:    r_packages_4.3.0/
    Ignored:    r_packages_4.3.2/

Untracked files:
    Untracked:  analysis/breast_cancer.Rmd
    Untracked:  analysis/core
    Untracked:  code/multiz100way/
    Untracked:  data/pbmc3k/

Note that any generated files, e.g. HTML, png, CSS, etc., are not included in this status report because it is ok for generated content to have uncommitted changes.


These are the previous versions of the repository in which changes were made to the R Markdown (analysis/seurat.Rmd) and HTML (docs/seurat.html) files. If you’ve configured a remote Git repository (see ?wflow_git_remote), click on the hyperlinks in the table below to view the files as they were in that past version.

File Version Author Date Message
Rmd ae0ea42 Dave Tang 2024-03-19 Getting started with Seurat

This post follows the Peripheral Blood Mononuclear Cells (PBMCs) tutorial for 2,700 single cells. It was written while I was going through the tutorial and contains my notes. The dataset for this tutorial can be downloaded from the 10X Genomics dataset page but it is also hosted on Amazon (see below). The PBMCs, which are primary cells with relatively small amounts of RNA (around 1pg RNA/cell), come from a healthy donor. There were 2,700 cells detected and sequencing was performed on an Illumina NextSeq 500 with around 69,000 reads per cell. To get started install Seurat by using install.packages().

install.packages("Seurat")

If you get the warning:

‘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

re-install the SeuratObject package using a repository that has an updated copy. The same goes for the htmltools package.

install.packages("SeuratObject", repos = "https://cran.ism.ac.jp/")
install.packages("htmltools", repos = "https://cran.ism.ac.jp/")
packageVersion("SeuratObject")
packageVersion("htmltools")

Load Seurat.

library("Seurat")
Loading required package: SeuratObject
Loading required package: sp

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

    intersect
packageVersion("Seurat")
[1] '5.0.3'

Data

To follow the tutorial, you need the 10X data.

mkdir -p data/pbmc3k && cd data/pbmc3k
wget -c https://s3-us-west-2.amazonaws.com/10x.files/samples/cell/pbmc3k/pbmc3k_filtered_gene_bc_matrices.tar.gz
tar -xzf pbmc3k_filtered_gene_bc_matrices.tar.gz

The extracted files.

ls -1 data/pbmc3k/filtered_gene_bc_matrices/hg19
barcodes.tsv
genes.tsv
matrix.mtx

matrix.mtx is a MatrixMarket file. It has the following properties:

head data/pbmc3k/filtered_gene_bc_matrices/hg19/matrix.mtx
%%MatrixMarket matrix coordinate real general
%
32738 2700 2286884
32709 1 4
32707 1 1
32706 1 10
32704 1 1
32703 1 5
32702 1 6
32700 1 10

Seurat


sessionInfo()
R version 4.3.2 (2023-10-31)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 22.04.3 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3 
LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.20.so;  LAPACK version 3.10.0

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

time zone: Etc/UTC
tzcode source: system (glibc)

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] Seurat_5.0.3       SeuratObject_5.0.1 sp_2.1-3           workflowr_1.7.1   

loaded via a namespace (and not attached):
  [1] deldir_2.0-4           pbapply_1.7-2          gridExtra_2.3         
  [4] rlang_1.1.3            magrittr_2.0.3         git2r_0.33.0          
  [7] RcppAnnoy_0.0.22       spatstat.geom_3.2-9    matrixStats_1.2.0     
 [10] ggridges_0.5.6         compiler_4.3.2         getPass_0.2-4         
 [13] reshape2_1.4.4         png_0.1-8              callr_3.7.5           
 [16] vctrs_0.6.5            stringr_1.5.1          pkgconfig_2.0.3       
 [19] fastmap_1.1.1          ellipsis_0.3.2         utf8_1.2.4            
 [22] promises_1.2.1         rmarkdown_2.26         ps_1.7.6              
 [25] purrr_1.0.2            xfun_0.42              cachem_1.0.8          
 [28] jsonlite_1.8.8         goftest_1.2-3          later_1.3.2           
 [31] spatstat.utils_3.0-4   irlba_2.3.5.1          parallel_4.3.2        
 [34] cluster_2.1.4          R6_2.5.1               ica_1.0-3             
 [37] spatstat.data_3.0-4    bslib_0.6.1            stringi_1.8.3         
 [40] RColorBrewer_1.1-3     reticulate_1.35.0      parallelly_1.37.1     
 [43] scattermore_1.2        lmtest_0.9-40          jquerylib_0.1.4       
 [46] Rcpp_1.0.12            knitr_1.45             tensor_1.5            
 [49] future.apply_1.11.1    zoo_1.8-12             sctransform_0.4.1     
 [52] httpuv_1.6.14          Matrix_1.6-5           splines_4.3.2         
 [55] igraph_2.0.3           tidyselect_1.2.1       abind_1.4-5           
 [58] rstudioapi_0.15.0      yaml_2.3.8             spatstat.random_3.2-3 
 [61] spatstat.explore_3.2-6 codetools_0.2-19       miniUI_0.1.1.1        
 [64] processx_3.8.4         listenv_0.9.1          plyr_1.8.9            
 [67] lattice_0.21-9         tibble_3.2.1           shiny_1.8.0           
 [70] ROCR_1.0-11            evaluate_0.23          Rtsne_0.17            
 [73] future_1.33.1          fastDummies_1.7.3      survival_3.5-7        
 [76] polyclip_1.10-6        fitdistrplus_1.1-11    pillar_1.9.0          
 [79] whisker_0.4.1          KernSmooth_2.23-22     plotly_4.10.4         
 [82] generics_0.1.3         rprojroot_2.0.4        RcppHNSW_0.6.0        
 [85] ggplot2_3.5.0          munsell_0.5.0          scales_1.3.0          
 [88] globals_0.16.3         xtable_1.8-4           glue_1.7.0            
 [91] lazyeval_0.2.2         tools_4.3.2            data.table_1.15.2     
 [94] RSpectra_0.16-1        RANN_2.6.1             fs_1.6.3              
 [97] leiden_0.4.3.1         dotCall64_1.1-1        cowplot_1.1.3         
[100] grid_4.3.2             tidyr_1.3.1            colorspace_2.1-0      
[103] nlme_3.1-163           patchwork_1.2.0        cli_3.6.2             
[106] spatstat.sparse_3.0-3  spam_2.10-0            fansi_1.0.6           
[109] viridisLite_0.4.2      dplyr_1.1.4            uwot_0.1.16           
[112] gtable_0.3.4           sass_0.4.9             digest_0.6.35         
[115] progressr_0.14.0       ggrepel_0.9.5          htmlwidgets_1.6.4     
[118] htmltools_0.5.7        lifecycle_1.0.4        httr_1.4.7            
[121] mime_0.12              MASS_7.3-60