Last updated: 2020-08-10

Checks: 7 0

Knit directory: Embryoid_Body_Pilot_Workflowr/analysis/

This reproducible R Markdown analysis was created with workflowr (version 1.6.2). 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(20200804) 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 f50ebd3. 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:    .Rhistory
    Ignored:    .Rproj.user/
    Ignored:    output/.Rhistory

Untracked files:
    Untracked:  analysis/child/
    Untracked:  code/EB.getHumanMetadata.Rmd
    Untracked:  figure/
    Untracked:  output/mergedObjects/
    Untracked:  output/sampleQCrds/

Unstaged changes:
    Modified:   .Rprofile
    Modified:   .gitattributes
    Modified:   .gitignore
    Modified:   Embryoid_Body_Pilot_Workflowr.Rproj
    Modified:   README.md
    Modified:   _workflowr.yml
    Modified:   analysis/_site.yml
    Modified:   analysis/about.Rmd
    Modified:   analysis/index.Rmd
    Modified:   analysis/license.Rmd
    Modified:   code/README.md
    Modified:   data/README.md
    Modified:   output/README.md

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/IntegrateAnalysis.afterFilter.NOHARMONYjustmerge.Rmd) and HTML (docs/IntegrateAnalysis.afterFilter.NOHARMONYjustmerge.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
html 421a225 KLRhodes 2020-08-10 Build site.
Rmd bc8ec6f KLRhodes 2020-08-10 cleaning various versions of merging/intCurrent working directory

library(Seurat)
library(harmony)
library(ggplot2)
library(DataCombine)
library(here)
library(RColorBrewer)
options(future.globals.maxSize= 15000*1024^2) #allow global exceeding 4Gb

Read in the files, add metadata, and create an object list

filelist<-list.files(here::here('output/sampleQCrds/'), full.names = T)
objectlist<- list()
for (i in 1:length(filelist)){
  rds<- readRDS(filelist[i])
  objectlist[i]<- rds
  
}
Warning in `[<-`(`*tmp*`, i, value = rds): implicit list embedding of S4 objects
is deprecated

Warning in `[<-`(`*tmp*`, i, value = rds): implicit list embedding of S4 objects
is deprecated

Warning in `[<-`(`*tmp*`, i, value = rds): implicit list embedding of S4 objects
is deprecated

Warning in `[<-`(`*tmp*`, i, value = rds): implicit list embedding of S4 objects
is deprecated

Warning in `[<-`(`*tmp*`, i, value = rds): implicit list embedding of S4 objects
is deprecated

Warning in `[<-`(`*tmp*`, i, value = rds): implicit list embedding of S4 objects
is deprecated

Warning in `[<-`(`*tmp*`, i, value = rds): implicit list embedding of S4 objects
is deprecated

Warning in `[<-`(`*tmp*`, i, value = rds): implicit list embedding of S4 objects
is deprecated

Warning in `[<-`(`*tmp*`, i, value = rds): implicit list embedding of S4 objects
is deprecated

Warning in `[<-`(`*tmp*`, i, value = rds): implicit list embedding of S4 objects
is deprecated

Warning in `[<-`(`*tmp*`, i, value = rds): implicit list embedding of S4 objects
is deprecated

Warning in `[<-`(`*tmp*`, i, value = rds): implicit list embedding of S4 objects
is deprecated

Warning in `[<-`(`*tmp*`, i, value = rds): implicit list embedding of S4 objects
is deprecated

Warning in `[<-`(`*tmp*`, i, value = rds): implicit list embedding of S4 objects
is deprecated

Warning in `[<-`(`*tmp*`, i, value = rds): implicit list embedding of S4 objects
is deprecated

Warning in `[<-`(`*tmp*`, i, value = rds): implicit list embedding of S4 objects
is deprecated

create a merged seurat object

ids<-substr(basename(filelist),1,12)
merged<- merge(objectlist[[1]], c(objectlist[[2]], objectlist[[3]],objectlist[[4]],objectlist[[5]],objectlist[[6]],objectlist[[7]],objectlist[[8]],objectlist[[9]],objectlist[[10]],objectlist[[11]],objectlist[[12]],objectlist[[13]],objectlist[[14]],objectlist[[15]],objectlist[[16]]),add.cell.ids=ids, merge.data=T)
#run PCA on full dataset pre-alignment
all.genes= rownames(merged)
merged<-FindVariableFeatures(merged,selection.method="vst", nfeatures = 5000)
#have previously used all genes (nfeatures=25000) and clustering by individual rather than batch (based on proportion of cells per cluster) was still observed downstream. Now using 5000 because it is the upper bound of what has been recommended in the literature.
merged<- ScaleData(merged, features = all.genes)
Centering and scaling data matrix
merged<-RunPCA(merged, npcs = 100, verbose=F)
DimPlot(merged, reduction = "pca", group.by = "Batch")

Version Author Date
421a225 KLRhodes 2020-08-10
#need to fix the individual names because they are slightly different from batch1
replacements<- data.frame(from= c("SNG-NA18511.variant2", "SNG-NA18858.variant2", "SNG-NA19160.variant2"), to=c("SNG-NA18511", "SNG-NA18858", "SNG-NA19160"))
merged@meta.data<-FindReplace(merged@meta.data, "individual", replacements, from = "from", to= "to", exact=T, vector=F )
Only exact matches will be replaced.
DimPlot(merged, reduction="pca", group.by= c("individual"), combine=F)
[[1]]

Version Author Date
421a225 KLRhodes 2020-08-10

Now Running UMAP and identifying clusters, etc

merged<- RunUMAP(merged, reduction = "pca", dims = 1:100, verbose = F)
Warning: The default method for RunUMAP has changed from calling Python UMAP via reticulate to the R-native UWOT using the cosine metric
To use Python UMAP via reticulate, set umap.method to 'umap-learn' and metric to 'correlation'
This message will be shown once per session
merged<- FindNeighbors(merged, reduction="pca", dims = 1:100, verbose = F)

SAVING merged/aligned/reclustered object

path<- here::here("output/mergedObjects/")
saveRDS(merged, file=paste0(path,'merged.noIntegration.rds'))
#reassign idents
Idents(merged)<- 'SCT_snn_res.1'
VizDimLoadings(merged, dims = 1:2, reduction = "pca")

Version Author Date
421a225 KLRhodes 2020-08-10
VizDimLoadings(merged, dims = 3:4, reduction = "pca")

Version Author Date
421a225 KLRhodes 2020-08-10
VizDimLoadings(merged, dims = 5:6, reduction = "pca")

Version Author Date
421a225 KLRhodes 2020-08-10
xlim <- c(min(merged@reductions$pca@cell.embeddings[,'PC_1']),
          max(merged@reductions$pca@cell.embeddings[,'PC_1']))
ylim <- c(min(merged@reductions$pca@cell.embeddings[,'PC_2']),
          max(merged@reductions$pca@cell.embeddings[,'PC_2']))

individuals <- table(merged$individual)
individuals <- individuals[individuals>50]
individuals <- names(individuals)
for (i in individuals)
{
  print(DimPlot(merged, reduction = "pca", group.by = c("Batch"), pt.size = 0.01,
                cells = WhichCells(merged, expression = individual == i)) +
          xlim(xlim) + ylim(ylim) + ggtitle(i))
}

Version Author Date
421a225 KLRhodes 2020-08-10

Version Author Date
421a225 KLRhodes 2020-08-10

Version Author Date
421a225 KLRhodes 2020-08-10
DimPlot(merged, reduction = "umap")

Version Author Date
421a225 KLRhodes 2020-08-10
DimPlot(merged, reduction = "umap", group.by = "Batch")

Version Author Date
421a225 KLRhodes 2020-08-10
DimPlot(merged, reduction = "umap", group.by = "individual")

Version Author Date
421a225 KLRhodes 2020-08-10
xlim <- c(min(merged@reductions$umap@cell.embeddings[,'UMAP_1']),
          max(merged@reductions$umap@cell.embeddings[,'UMAP_1']))
ylim <- c(min(merged@reductions$umap@cell.embeddings[,'UMAP_2']),
          max(merged@reductions$umap@cell.embeddings[,'UMAP_2']))
for (i in individuals)
{
  print(DimPlot(merged, reduction = "umap", 
                cells = WhichCells(merged, expression = individual == i)) +
          xlim(xlim) + ylim(ylim) + ggtitle(i))
}

Version Author Date
421a225 KLRhodes 2020-08-10

Version Author Date
421a225 KLRhodes 2020-08-10

Version Author Date
421a225 KLRhodes 2020-08-10
#Endoderm markers (first 3 definitive endo, 4-6 liver markers, )
FeaturePlot(merged, features = c("SOX17","CLDN6","FOXA2", "TTR", "AFP", "FGB"), pt.size = 0.2, combine = F)
[[1]]

Version Author Date
421a225 KLRhodes 2020-08-10

[[2]]

Version Author Date
421a225 KLRhodes 2020-08-10

[[3]]

Version Author Date
421a225 KLRhodes 2020-08-10

[[4]]

Version Author Date
421a225 KLRhodes 2020-08-10

[[5]]

Version Author Date
421a225 KLRhodes 2020-08-10

[[6]]

Version Author Date
421a225 KLRhodes 2020-08-10
#Mesoderm Markers (first 3 early meso markers, 4-6 heart markers, 7-9 endothelial markers (which comes from mesoderm), then some other general muscle markers)
FeaturePlot(merged, features = c("HAND1", "BMP4", "TNNT2","KDR", "GNG11", "ECSCR", "COL3A1", "ACTC1"), pt.size = 0.2, combine=F)
[[1]]

Version Author Date
421a225 KLRhodes 2020-08-10

[[2]]

Version Author Date
421a225 KLRhodes 2020-08-10

[[3]]

Version Author Date
421a225 KLRhodes 2020-08-10

[[4]]

Version Author Date
421a225 KLRhodes 2020-08-10

[[5]]

Version Author Date
421a225 KLRhodes 2020-08-10

[[6]]

Version Author Date
421a225 KLRhodes 2020-08-10

[[7]]

Version Author Date
421a225 KLRhodes 2020-08-10

[[8]]

Version Author Date
421a225 KLRhodes 2020-08-10
#Ectoderm Markers (3-1 early ectoderm markers, 4-6schwann cell (myelinating, non myelinating, or precursor), 7-8 oligodendrocytes, 9-10 radial glia)
FeaturePlot(merged, features = c("PAX6", "GBX2",  "NES", "MPZ", "SOX10","GAP43", "OLIG1", "OLIG2", "VIM", "HES5"), pt.size = 0.2, ncol=3, combine=F)
[[1]]

Version Author Date
421a225 KLRhodes 2020-08-10

[[2]]

Version Author Date
421a225 KLRhodes 2020-08-10

[[3]]

Version Author Date
421a225 KLRhodes 2020-08-10

[[4]]

Version Author Date
421a225 KLRhodes 2020-08-10

[[5]]

Version Author Date
421a225 KLRhodes 2020-08-10

[[6]]

Version Author Date
421a225 KLRhodes 2020-08-10

[[7]]

Version Author Date
421a225 KLRhodes 2020-08-10

[[8]]

Version Author Date
421a225 KLRhodes 2020-08-10

[[9]]

Version Author Date
421a225 KLRhodes 2020-08-10

[[10]]

Version Author Date
421a225 KLRhodes 2020-08-10
#More ectoderm, specifically neurons
#immature neurons: NEUROD1
#Mature Neurons: MAP2, SYP
#dopaminergic: TH, FOXA2,
FeaturePlot(merged, features = c("MAP2", "SYP","NEUROD1", "TH" ), pt.size = 0.2, ncol=3)

Version Author Date
421a225 KLRhodes 2020-08-10
FeaturePlot(merged, features = "nFeature_RNA")

Version Author Date
421a225 KLRhodes 2020-08-10
FeaturePlot(merged, features = c("POU5F1", "SOX17",  "HAND1", "PAX6"), pt.size = 0.2, ncol=2, combine=T)

Version Author Date
421a225 KLRhodes 2020-08-10
FeaturePlot(merged, features = c("FGB", "ECSCR",  "NEUROD1", "SOX10"), pt.size = 0.2, ncol=2)

Version Author Date
421a225 KLRhodes 2020-08-10

sessionInfo()
R version 3.6.1 (2019-07-05)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Scientific Linux 7.4 (Nitrogen)

Matrix products: default
BLAS/LAPACK: /software/openblas-0.2.19-el7-x86_64/lib/libopenblas_haswellp-r0.2.19.so

locale:
[1] C

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

other attached packages:
[1] RColorBrewer_1.1-2 here_0.1-11        DataCombine_0.2.21 ggplot2_3.3.2     
[5] harmony_1.0        Rcpp_1.0.5         Seurat_3.2.0       workflowr_1.6.2   

loaded via a namespace (and not attached):
  [1] Rtsne_0.15            colorspace_1.4-1      deldir_0.1-28        
  [4] ellipsis_0.3.1        ggridges_0.5.2        rprojroot_1.3-2      
  [7] fs_1.4.2              spatstat.data_1.4-3   farver_2.0.3         
 [10] leiden_0.3.3          listenv_0.8.0         npsurv_0.4-0         
 [13] ggrepel_0.8.2         RSpectra_0.16-0       codetools_0.2-16     
 [16] splines_3.6.1         lsei_1.2-0            knitr_1.29           
 [19] polyclip_1.10-0       jsonlite_1.7.0        ica_1.0-2            
 [22] cluster_2.1.0         png_0.1-7             uwot_0.1.8           
 [25] shiny_1.5.0           sctransform_0.2.1     compiler_3.6.1       
 [28] httr_1.4.2            backports_1.1.8       Matrix_1.2-18        
 [31] fastmap_1.0.1         lazyeval_0.2.2        later_1.1.0.1        
 [34] htmltools_0.5.0       tools_3.6.1           rsvd_1.0.3           
 [37] igraph_1.2.5          gtable_0.3.0          glue_1.4.1           
 [40] RANN_2.6.1            reshape2_1.4.4        dplyr_1.0.0          
 [43] rappdirs_0.3.1        spatstat_1.64-1       vctrs_0.3.2          
 [46] gdata_2.18.0          ape_5.3               nlme_3.1-140         
 [49] lmtest_0.9-37         xfun_0.16             stringr_1.4.0        
 [52] globals_0.12.5        mime_0.9              miniUI_0.1.1.1       
 [55] lifecycle_0.2.0       irlba_2.3.3           gtools_3.8.2         
 [58] goftest_1.2-2         future_1.18.0         MASS_7.3-51.4        
 [61] zoo_1.8-8             scales_1.1.1          promises_1.1.1       
 [64] spatstat.utils_1.17-0 parallel_3.6.1        yaml_2.2.1           
 [67] reticulate_1.16       pbapply_1.4-2         gridExtra_2.3        
 [70] rpart_4.1-15          stringi_1.4.6         caTools_1.18.0       
 [73] rlang_0.4.7           pkgconfig_2.0.3       bitops_1.0-6         
 [76] evaluate_0.14         lattice_0.20-38       ROCR_1.0-7           
 [79] purrr_0.3.4           tensor_1.5            labeling_0.3         
 [82] patchwork_1.0.1       htmlwidgets_1.5.1     cowplot_1.0.0        
 [85] tidyselect_1.1.0      RcppAnnoy_0.0.16      plyr_1.8.6           
 [88] magrittr_1.5          R6_2.4.1              gplots_3.0.4         
 [91] generics_0.0.2        withr_2.2.0           pillar_1.4.6         
 [94] whisker_0.4           mgcv_1.8-28           fitdistrplus_1.0-14  
 [97] survival_3.2-3        abind_1.4-5           tibble_3.0.3         
[100] future.apply_1.6.0    crayon_1.3.4          KernSmooth_2.23-15   
[103] plotly_4.9.2.1        rmarkdown_2.3         grid_3.6.1           
[106] data.table_1.13.0     git2r_0.26.1          digest_0.6.25        
[109] xtable_1.8-4          tidyr_1.1.0           httpuv_1.5.4         
[112] munsell_0.5.0         viridisLite_0.3.0