道理你都懂,还是做不好单细胞。沉下心来,再看一遍道理。
积土成山,风雨兴焉;积水成渊,蛟龙生焉;积善成德,而神明自得,圣心备焉.故不积跬步,无以至千里;不积小流,无以成江海.骐骥一跃,不能十步;驽马十驾,功在不舍.锲而舍之,朽木不折;锲而不舍,金石可镂.-- 荀子《劝学》
当初怎么背下来的这篇古文。
立春:立是开始的意思,立春就是春季的开始。
> library(Seurat)
Seurat v4 will be going to CRAN in the near future;
for more details, please visit https://satijalab.org/seurat/v4_chSeurat - Combining Two 10X Runs
anges
Warning message:
程辑包‘Seurat’是用R版本4.0.3 来建造的
> library(Seurat)
> pbmc4k.data <- Read10X(data.dir = "pbmc4k_filtered_gene_bc_matrices/")
> pbmc4k <- CreateSeuratObject(counts = pbmc4k.data, project = "PBMC4K")
Warning: Feature names cannot have underscores ('_'), replacing with dashes ('-')
> pbmc4k
An object of class Seurat
33694 features across 4340 samples within 1 assay
Active assay: RNA (33694 features, 0 variable features)
> ## An object of class Seurat
> ## 33694 features across 4340 samples within 1 assay
> ## Active assay: RNA (33694 features, 0 variable features)
> pbmc8k.data <- Read10X(data.dir = "pbmc8k_filtered_gene_bc_matrices/")
> pbmc8k <- CreateSeuratObject(counts = pbmc8k.data, project = "PBMC8K")
Warning: Feature names cannot have underscores ('_'), replacing with dashes ('-')
> pbmc8k
An object of class Seurat
33694 features across 8381 samples within 1 assay
Active assay: RNA (33694 features, 0 variable features)
> pbmc.combined <- merge(pbmc4k, y = pbmc8k, add.cell.ids = c("4K", "8K"), project = "PBMC12K")
> pbmc.combined
An object of class Seurat
33694 features across 12721 samples within 1 assay
Active assay: RNA (33694 features, 0 variable features)
> ## An object of class Seurat
> ## 33694 features across 12721 samples within 1 assay
> ## Active assay: RNA (33694 features, 0 variable features)
> # notice the cell names now have an added identifier
> head(colnames(pbmc.combined))
[1] "4K_AAACCTGAGAAGGCCT-1" "4K_AAACCTGAGACAGACC-1" "4K_AAACCTGAGATAGTCA-1"
[4] "4K_AAACCTGAGCGCCTCA-1" "4K_AAACCTGAGGCATGGT-1" "4K_AAACCTGCAAGGTTCT-1"
> ## [1] "4K_AAACCTGAGAAGGCCT-1" "4K_AAACCTGAGACAGACC-1" "4K_AAACCTGAGATAGTCA-1"
> ## [4] "4K_AAACCTGAGCGCCTCA-1" "4K_AAACCTGAGGCATGGT-1" "4K_AAACCTGCAAGGTTCT-1"
> table(pbmc.combined$orig.ident)
PBMC4K PBMC8K
4340 8381
> ## [1] "4K_AAACCTGAGAAGGCCT-1" "4K_AAACCTGAGACAGACC-1" "4K_AAACCTGAGATAGTCA-1"
> ## [4] "4K_AAACCTGAGCGCCTCA-1" "4K_AAACCTGAGGCATGGT-1" "4K_AAACCTGCAAGGTTCT-1"
> tail(colnames(pbmc.combined))
[1] "8K_TTTGTCAGTTACCGAT-1" "8K_TTTGTCATCATGTCCC-1" "8K_TTTGTCATCCGATATG-1"
[4] "8K_TTTGTCATCGTCTGAA-1" "8K_TTTGTCATCTCGAGTA-1" "8K_TTTGTCATCTGCTTGC-1"
> library(SeuratData)
Error in library(SeuratData) : 不存在叫‘SeuratData’这个名字的程辑包
> ##
> ## PBMC4K PBMC8K
> ## 4340 8381
> # Merging More Than Two Seurat Objects
> # To merge more than two Seurat objects, simply pass a vector of multiple Seurat objects to the y parameter for merge; we’ll demonstrate this using the 4K and 8K PBMC datasets as well as our previously computed Seurat object from the 2,700 PBMC tutorial (loaded via the SeuratData package).
> install.packages('SeuratData')
Installing package into ‘C:/Users/Nano/Documents/R/win-library/4.0’
(as ‘lib’ is unspecified)
Warning in install.packages :
package ‘SeuratData’ is not available (for R version 4.0.2)
Registered S3 method overwritten by 'cli':
method from
print.boxx spatstat
> ##
> ## PBMC4K PBMC8K
> ## 4340 8381
> # Merging More Than Two Seurat Objects
> # To merge more than two Seurat objects, simply pass a vector of multiple Seurat objects to the y parameter for merge; we’ll demonstrate this using the 4K and 8K PBMC datasets as well as our previously computed Seurat object from the 2,700 PBMC tutorial (loaded via the SeuratData package).
> devtools::install_github('satijalab/seurat-data')
Downloading GitHub repo satijalab/seurat-data@HEAD
These packages have more recent versions available.
It is recommended to update all of them.
Which would you like to update?
1: All
2: CRAN packages only
3: None
4: rappdirs (0.3.1 -> 0.3.3) [CRAN]
5: crayon (1.3.4 -> 1.4.1) [CRAN]
6: cli (2.2.0 -> 2.3.1) [CRAN]
Enter one or more numbers, or an empty line to skip updates:3
√ checking for file 'C:\Users\Nano\AppData\Local\Temp\RtmpEZFOKw\remotes4674221430c0\satijalab-seurat-data-0f7a002/DESCRIPTION' ...
- preparing 'SeuratData':
√ checking DESCRIPTION meta-information ...
- checking for LF line-endings in source and make files and shell scripts
- checking for empty or unneeded directories
- building 'SeuratData_0.2.1.tar.gz'
Installing package into ‘C:/Users/Nano/Documents/R/win-library/4.0’
(as ‘lib’ is unspecified)
* installing *source* package 'SeuratData' ...
** using staged installation
** R
** exec
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
converting help for package 'SeuratData'
finding HTML links ... 好了
AppData html
AttachData html
AvailableData html
Enumerate html
InstallData html
InstalledData html
IsMatrixEmpty html
LoadData html
MakeSpace html
NameToPackage html
RemoveData html
SeuratData-package html
UpdateData html
UpdateManifest html
set-if-null html
** building package indices
** testing if installed package can be loaded from temporary location
*** arch - i386
Warning in if (is.na(desc)) { : 条件的长度大于一,因此只能用其第一元素
Warning in if (is.na(desc)) { : 条件的长度大于一,因此只能用其第一元素
Warning in if (is.na(desc)) { : 条件的长度大于一,因此只能用其第一元素
Warning in if (is.na(desc)) { : 条件的长度大于一,因此只能用其第一元素
Warning in if (is.na(desc)) { : 条件的长度大于一,因此只能用其第一元素
Warning in if (is.na(desc)) { : 条件的长度大于一,因此只能用其第一元素
Warning in if (is.na(desc)) { : 条件的长度大于一,因此只能用其第一元素
Warning in if (is.na(desc)) { : 条件的长度大于一,因此只能用其第一元素
Warning in if (is.na(desc)) { : 条件的长度大于一,因此只能用其第一元素
Warning in if (is.na(desc)) { : 条件的长度大于一,因此只能用其第一元素
Warning in if (is.na(desc)) { : 条件的长度大于一,因此只能用其第一元素
Warning in if (is.na(desc)) { : 条件的长度大于一,因此只能用其第一元素
*** arch - x64
Warning in if (is.na(desc)) { : 条件的长度大于一,因此只能用其第一元素
Warning in if (is.na(desc)) { : 条件的长度大于一,因此只能用其第一元素
Warning in if (is.na(desc)) { : 条件的长度大于一,因此只能用其第一元素
Warning in if (is.na(desc)) { : 条件的长度大于一,因此只能用其第一元素
Warning in if (is.na(desc)) { : 条件的长度大于一,因此只能用其第一元素
Warning in if (is.na(desc)) { : 条件的长度大于一,因此只能用其第一元素
Warning in if (is.na(desc)) { : 条件的长度大于一,因此只能用其第一元素
Warning in if (is.na(desc)) { : 条件的长度大于一,因此只能用其第一元素
Warning in if (is.na(desc)) { : 条件的长度大于一,因此只能用其第一元素
Warning in if (is.na(desc)) { : 条件的长度大于一,因此只能用其第一元素
Warning in if (is.na(desc)) { : 条件的长度大于一,因此只能用其第一元素
Warning in if (is.na(desc)) { : 条件的长度大于一,因此只能用其第一元素
** testing if installed package can be loaded from final location
*** arch - i386
Warning in if (is.na(desc)) { : 条件的长度大于一,因此只能用其第一元素
Warning in if (is.na(desc)) { : 条件的长度大于一,因此只能用其第一元素
Warning in if (is.na(desc)) { : 条件的长度大于一,因此只能用其第一元素
Warning in if (is.na(desc)) { : 条件的长度大于一,因此只能用其第一元素
Warning in if (is.na(desc)) { : 条件的长度大于一,因此只能用其第一元素
Warning in if (is.na(desc)) { : 条件的长度大于一,因此只能用其第一元素
Warning in if (is.na(desc)) { : 条件的长度大于一,因此只能用其第一元素
Warning in if (is.na(desc)) { : 条件的长度大于一,因此只能用其第一元素
Warning in if (is.na(desc)) { : 条件的长度大于一,因此只能用其第一元素
Warning in if (is.na(desc)) { : 条件的长度大于一,因此只能用其第一元素
Warning in if (is.na(desc)) { : 条件的长度大于一,因此只能用其第一元素
Warning in if (is.na(desc)) { : 条件的长度大于一,因此只能用其第一元素
*** arch - x64
Warning in if (is.na(desc)) { : 条件的长度大于一,因此只能用其第一元素
Warning in if (is.na(desc)) { : 条件的长度大于一,因此只能用其第一元素
Warning in if (is.na(desc)) { : 条件的长度大于一,因此只能用其第一元素
Warning in if (is.na(desc)) { : 条件的长度大于一,因此只能用其第一元素
Warning in if (is.na(desc)) { : 条件的长度大于一,因此只能用其第一元素
Warning in if (is.na(desc)) { : 条件的长度大于一,因此只能用其第一元素
Warning in if (is.na(desc)) { : 条件的长度大于一,因此只能用其第一元素
Warning in if (is.na(desc)) { : 条件的长度大于一,因此只能用其第一元素
Warning in if (is.na(desc)) { : 条件的长度大于一,因此只能用其第一元素
Warning in if (is.na(desc)) { : 条件的长度大于一,因此只能用其第一元素
Warning in if (is.na(desc)) { : 条件的长度大于一,因此只能用其第一元素
Warning in if (is.na(desc)) { : 条件的长度大于一,因此只能用其第一元素
** testing if installed package keeps a record of temporary installation path
* DONE (SeuratData)
> #devtools::install_github('satijalab/seurat-data')
> library(SeuratData)
There were 12 warnings (use warnings() to see them)
> InstallData("pbmc3k")
Installing package into ‘C:/Users/Nano/Documents/R/win-library/4.0’
(as ‘lib’ is unspecified)
trying URL 'http://seurat.nygenome.org/src/contrib/pbmc3k.SeuratData_3.1.4.tar.gz'
Content type 'application/octet-stream' length 93780025 bytes (89.4 MB)
downloaded 89.4 MB
* installing *source* package 'pbmc3k.SeuratData' ...
** using staged installation
** R
** data
*** moving datasets to lazyload DB
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
converting help for package 'pbmc3k.SeuratData'
finding HTML links ... 好了
pbmc3k html
pbmc3k.final html
** building package indices
** testing if installed package can be loaded from temporary location
*** arch - i386
*** arch - x64
** testing if installed package can be loaded from final location
*** arch - i386
*** arch - x64
** testing if installed package keeps a record of temporary installation path
* DONE (pbmc3k.SeuratData)
The downloaded source packages are in
‘C:\Users\Nano\AppData\Local\Temp\RtmpEZFOKw\downloaded_packages’
There were 48 warnings (use warnings() to see them)
> #InstallData("pbmc3k")
> pbmc3k <- LoadData("pbmc3k", type = "pbmc3k.final")
There were 36 warnings (use warnings() to see them)
> pbmc3k
An object of class Seurat
13714 features across 2638 samples within 1 assay
Active assay: RNA (13714 features, 2000 variable features)
2 dimensional reductions calculated: pca, umap
> ## An object of class Seurat
> ## 13714 features across 2638 samples within 1 assay
> ## Active assay: RNA (13714 features, 2000 variable features)
> ## 2 dimensional reductions calculated: pca, umap
> pbmc.big <- merge(pbmc3k, y = c(pbmc4k, pbmc8k), add.cell.ids = c("3K", "4K", "8K"), project = "PBMC15K")
> pbmc.big
An object of class Seurat
34230 features across 15359 samples within 1 assay
Active assay: RNA (34230 features, 0 variable features)
> ## An object of class Seurat
> ## 34230 features across 15359 samples within 1 assay
> ## Active assay: RNA (34230 features, 0 variable features)
> head(colnames(pbmc.big))
[1] "3K_AAACATACAACCAC" "3K_AAACATTGAGCTAC" "3K_AAACATTGATCAGC" "3K_AAACCGTGCTTCCG"
[5] "3K_AAACCGTGTATGCG" "3K_AAACGCACTGGTAC"
> ## [1] "3K_AAACATACAACCAC" "3K_AAACATTGAGCTAC" "3K_AAACATTGATCAGC"
> ## [4] "3K_AAACCGTGCTTCCG" "3K_AAACCGTGTATGCG" "3K_AAACGCACTGGTAC"
> tail(colnames(pbmc.big))
[1] "8K_TTTGTCAGTTACCGAT-1" "8K_TTTGTCATCATGTCCC-1" "8K_TTTGTCATCCGATATG-1"
[4] "8K_TTTGTCATCGTCTGAA-1" "8K_TTTGTCATCTCGAGTA-1" "8K_TTTGTCATCTGCTTGC-1"
> ## [1] "8K_TTTGTCAGTTACCGAT-1" "8K_TTTGTCATCATGTCCC-1" "8K_TTTGTCATCCGATATG-1"
> ## [4] "8K_TTTGTCATCGTCTGAA-1" "8K_TTTGTCATCTCGAGTA-1" "8K_TTTGTCATCTGCTTGC-1"
> unique(sapply(X = strsplit(colnames(pbmc.big), split = "_"), FUN = "[", 1))
[1] "3K" "4K" "8K"
> ## [1] "3K" "4K" "8K"
> table(pbmc.big$orig.ident)
pbmc3k PBMC4K PBMC8K
2638 4340 8381
> pbmc4k <- NormalizeData(pbmc4k)
Performing log-normalization
0% 10 20 30 40 50 60 70 80 90 100%
[----|----|----|----|----|----|----|----|----|----|
**************************************************|
> pbmc8k <- NormalizeData(pbmc8k)
Performing log-normalization
0% 10 20 30 40 50 60 70 80 90 100%
[----|----|----|----|----|----|----|----|----|----|
**************************************************|
> pbmc.normalized <- merge(pbmc4k, y = pbmc8k, add.cell.ids = c("4K", "8K"), project = "PBMC12K",
+ merge.data = TRUE)
> GetAssayData(pbmc.combined)[1:10, 1:15]
10 x 15 sparse Matrix of class "dgCMatrix"
[[ suppressing 15 column names ‘4K_AAACCTGAGAAGGCCT-1’, ‘4K_AAACCTGAGACAGACC-1’, ‘4K_AAACCTGAGATAGTCA-1’ ... ]]
RP11-34P13.3 . . . . . . . . . . . . . . .
FAM138A . . . . . . . . . . . . . . .
OR4F5 . . . . . . . . . . . . . . .
RP11-34P13.7 . . . . . . . . . . . . . . .
RP11-34P13.8 . . . . . . . . . . . . . . .
RP11-34P13.14 . . . . . . . . . . . . . . .
RP11-34P13.9 . . . . . . . . . . . . . . .
FO538757.3 . . . . . . . . . . . . . . .
FO538757.2 . . . . . . . . . 1 . . . . .
AP006222.2 . . . . . . . . . . . 1 . . .
> ## RP11-34P13.3 . . . . . . . . . . . . . . .
> ## FAM138A . . . . . . . . . . . . . . .
> ## OR4F5 . . . . . . . . . . . . . . .
> ## RP11-34P13.7 . . . . . . . . . . . . . . .
> ## RP11-34P13.8 . . . . . . . . . . . . . . .
> ## RP11-34P13.14 . . . . . . . . . . . . . . .
> ## RP11-34P13.9 . . . . . . . . . . . . . . .
> ## FO538757.3 . . . . . . . . . . . . . . .
> ## FO538757.2 . . . . . . . . . 1 . . . . .
> ## AP006222.2 . . . . . . . . . . . 1 . . .
> GetAssayData(pbmc.normalized)[1:10, 1:15]
10 x 15 sparse Matrix of class "dgCMatrix"
[[ suppressing 15 column names ‘4K_AAACCTGAGAAGGCCT-1’, ‘4K_AAACCTGAGACAGACC-1’, ‘4K_AAACCTGAGATAGTCA-1’ ... ]]
RP11-34P13.3 . . . . . . . . . . . . . . .
FAM138A . . . . . . . . . . . . . . .
OR4F5 . . . . . . . . . . . . . . .
RP11-34P13.7 . . . . . . . . . . . . . . .
RP11-34P13.8 . . . . . . . . . . . . . . .
RP11-34P13.14 . . . . . . . . . . . . . . .
RP11-34P13.9 . . . . . . . . . . . . . . .
FO538757.3 . . . . . . . . . . . . . . .
FO538757.2 . . . . . . . . . 0.7721503 . . . . .
AP006222.2 . . . . . . . . . . . 1.087928 . . .
> sessionInfo()
R version 4.0.2 (2020-06-22)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)
Matrix products: default
locale:
[1] LC_COLLATE=Chinese (Simplified)_China.936 LC_CTYPE=Chinese (Simplified)_China.936
[3] LC_MONETARY=Chinese (Simplified)_China.936 LC_NUMERIC=C
[5] LC_TIME=Chinese (Simplified)_China.936
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] pbmc3k.SeuratData_3.1.4 SeuratData_0.2.1 Seurat_3.2.3
loaded via a namespace (and not attached):
[1] Rtsne_0.15 colorspace_2.0-0 deldir_0.2-3
[4] ellipsis_0.3.1 ggridges_0.5.3 rprojroot_2.0.2
[7] fs_1.5.0 rstudioapi_0.13 spatstat.data_1.7-0
[10] leiden_0.3.6 listenv_0.8.0 remotes_2.2.0
[13] ggrepel_0.9.0 fansi_0.4.1 codetools_0.2-18
[16] splines_4.0.2 polyclip_1.10-0 pkgload_1.1.0
[19] jsonlite_1.7.2 ica_1.0-2 cluster_2.1.0
[22] png_0.1-7 uwot_0.1.10 shiny_1.5.0
[25] sctransform_0.3.2 compiler_4.0.2 httr_1.4.2
[28] assertthat_0.2.1 Matrix_1.2-18 fastmap_1.0.1
[31] lazyeval_0.2.2 cli_2.2.0 later_1.1.0.1
[34] htmltools_0.5.1.1 prettyunits_1.1.1 tools_4.0.2
[37] rsvd_1.0.3 igraph_1.2.6 gtable_0.3.0
[40] glue_1.4.2 RANN_2.6.1 reshape2_1.4.4
[43] dplyr_1.0.2 rappdirs_0.3.1 Rcpp_1.0.5
[46] spatstat_1.64-1 scattermore_0.7 vctrs_0.3.6
[49] nlme_3.1-151 lmtest_0.9-38 stringr_1.4.0
[52] globals_0.14.0 ps_1.5.0 testthat_3.0.1
[55] mime_0.9 miniUI_0.1.1.1 lifecycle_0.2.0
[58] irlba_2.3.3 devtools_2.3.2 goftest_1.2-2
[61] future_1.21.0 MASS_7.3-53 zoo_1.8-8
[64] scales_1.1.1 promises_1.1.1 spatstat.utils_1.20-2
[67] parallel_4.0.2 RColorBrewer_1.1-2 curl_4.3
[70] yaml_2.2.1 memoise_1.1.0 reticulate_1.18
[73] pbapply_1.4-3 gridExtra_2.3 ggplot2_3.3.3
[76] rpart_4.1-15 stringi_1.5.3 desc_1.2.0
[79] pkgbuild_1.2.0 rlang_0.4.9 pkgconfig_2.0.3
[82] matrixStats_0.57.0 lattice_0.20-41 ROCR_1.0-11
[85] purrr_0.3.4 tensor_1.5 patchwork_1.1.1
[88] htmlwidgets_1.5.3 cowplot_1.1.1 tidyselect_1.1.0
[91] processx_3.4.5 parallelly_1.23.0 RcppAnnoy_0.0.18
[94] plyr_1.8.6 magrittr_2.0.1 R6_2.5.0
[97] generics_0.1.0 pillar_1.4.7 withr_2.3.0
[100] mgcv_1.8-33 fitdistrplus_1.1-3 survival_3.2-7
[103] abind_1.4-5 tibble_3.0.4 future.apply_1.7.0
[106] crayon_1.3.4 KernSmooth_2.23-18 plotly_4.9.3
[109] usethis_2.0.0 grid_4.0.2 data.table_1.13.6
[112] callr_3.5.1 digest_0.6.27 xtable_1.8-4
[115] tidyr_1.1.2 httpuv_1.5.4 munsell_0.5.0
[118] viridisLite_0.3.0 sessioninfo_1.1.1