Last updated: 2021-10-29

Checks: 7 0

Knit directory: mistyMBC/

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(42) 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 9d7cf8f. 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:    .DS_Store
    Ignored:    .Rhistory
    Ignored:    .Rproj.user/
    Ignored:    analysis/.DS_Store
    Ignored:    code/
    Ignored:    data/
    Ignored:    omnipathr-log/
    Ignored:    output/.DS_Store
    Ignored:    output/HTAPP-213-SMP-6752/.DS_Store
    Ignored:    output/HTAPP-213-SMP-6752/HTAPP-213-SMP-6752_slide_seq_processed-1/.DS_Store
    Ignored:    output/HTAPP-364-SMP-1321/

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/celltype_misty.Rmd) and HTML (docs/celltype_misty.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 6b773b6 Jovan Tanevski 2021-10-24 update normalization and view parameteres
html cb33a3e Jovan Tanevski 2021-09-23 Build site.
Rmd 41f5e45 Jovan Tanevski 2021-09-23 add juxta and zoi for slideseq
html 6a3c444 Jovan Tanevski 2021-09-15 Build site.
Rmd 2fc907d Jovan Tanevski 2021-09-15 add celltype based analysis

Setup

library(reticulate)
library(mistyR)
library(future)
library(dplyr)
library(purrr)
library(stringr)

use_python("/usr/local/bin/python3")
plan(multisession)

Create celltype oriented mistyR pipeline

Use SlideSeq data. Bypass modeling of intrinsic view and focus on cell type composition of a neighborhood. Take 100 nearest neighbors with constant weights.

(list.files("data", ".h5ad", recursive = TRUE, full.names = TRUE) %>%
  keep(~ str_detect(.x, "slide_seq"))) %>%
  walk(function(datapath) {
    data <- py$read_and_extract(datapath)
    ctype <- data[[1]] %>% rename_with(~make.names(., allow_ = FALSE))
    pos <- data[[2]]

    unique(str_extract(rownames(pos), "-\\d$")) %>% walk(function(replicate) {
      output.folder <- paste0(
        str_replace(
          str_remove(datapath, ".h5ad"),
          "data", "output"
        ), 
        replicate, 
        "/ctype"
      )

      output.folder.failed <- paste0(output.folder, "_failed")

      if (!(dir.exists(output.folder) | dir.exists(output.folder.failed))) {
        ind <- str_which(rownames(pos), paste0(replicate, "$"))

        misty.views.ctype <- create_initial_view(ctype[ind, ]) %>%
          add_juxtaview(pos[ind, ], neighbor.thr = 25) %>%
          add_paraview(pos[ind, ], l = 150, zoi = 25, family = "constant")

        tryCatch(
          run_misty(misty.views.ctype, results.folder = output.folder, bypass.intra = TRUE),
          error = function(e) file.rename(output.folder, output.folder.failed)
        )
      }
    })
  })

Computing triangulation

Generating juxtaview

Generating paraview using 150 nearest neighbors per unit

Training models
Warning in ...furrr_fn(...): Negative performance detected and replaced with 0
for target B
Warning in ...furrr_fn(...): Negative performance detected and replaced with 0
for target Endothelial
Warning in ...furrr_fn(...): Negative performance detected and replaced with 0
for target Fibroblast
Warning in ...furrr_fn(...): Negative performance detected and replaced with 0
for target Hepatocyte
Warning in ...furrr_fn(...): Negative performance detected and replaced with 0
for target MBC
Warning in ...furrr_fn(...): Negative performance detected and replaced with 0
for target Macrophage
Warning in ...furrr_fn(...): Negative performance detected and replaced with 0
for target Monocyte
Warning in ...furrr_fn(...): Negative performance detected and replaced with 0
for target NK
Warning in ...furrr_fn(...): Negative performance detected and replaced with 0
for target T

Computing triangulation

Generating juxtaview

Generating paraview using 150 nearest neighbors per unit

Training models
Warning in ...furrr_fn(...): Negative performance detected and replaced with 0
for target B
Warning in ...furrr_fn(...): Negative performance detected and replaced with 0
for target Endothelial
Warning in ...furrr_fn(...): Negative performance detected and replaced with 0
for target Fibroblast
Warning in ...furrr_fn(...): Negative performance detected and replaced with 0
for target Hepatocyte
Warning in ...furrr_fn(...): Negative performance detected and replaced with 0
for target MBC
Warning in ...furrr_fn(...): Negative performance detected and replaced with 0
for target Macrophage
Warning in ...furrr_fn(...): Negative performance detected and replaced with 0
for target Monocyte
Warning in ...furrr_fn(...): Negative performance detected and replaced with 0
for target NK
Warning in ...furrr_fn(...): Negative performance detected and replaced with 0
for target T

sessionInfo()
R version 4.1.1 (2021-08-10)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Big Sur 10.16

Matrix products: default
BLAS:   /Library/Frameworks/R.framework/Versions/4.1/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.1/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

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

other attached packages:
[1] stringr_1.4.0   purrr_0.3.4     dplyr_1.0.7     future_1.22.1  
[5] mistyR_1.1.14   reticulate_1.22 workflowr_1.6.2

loaded via a namespace (and not attached):
 [1] tidyselect_1.1.1  xfun_0.27         bslib_0.3.1       listenv_0.8.0    
 [5] distances_0.1.8   lattice_0.20-45   vctrs_0.3.8       generics_0.1.1   
 [9] htmltools_0.5.2   yaml_2.2.1        utf8_1.2.2        rlang_0.4.12     
[13] R.oo_1.24.0       jquerylib_0.1.4   later_1.3.0       pillar_1.6.4     
[17] glue_1.4.2        DBI_1.1.1         R.utils_2.11.0    lifecycle_1.0.1  
[21] R.methodsS3_1.8.1 codetools_0.2-18  evaluate_0.14     knitr_1.36       
[25] fastmap_1.1.0     httpuv_1.6.3      parallel_4.1.1    fansi_0.5.0      
[29] furrr_0.2.3       Rcpp_1.0.7        filelock_1.0.2    promises_1.2.0.1 
[33] jsonlite_1.7.2    deldir_1.0-6      parallelly_1.28.1 fs_1.5.0         
[37] png_0.1-7         digest_0.6.28     stringi_1.7.5     rlist_0.4.6.2    
[41] grid_4.1.1        rprojroot_2.0.2   tools_4.1.1       magrittr_2.0.1   
[45] sass_0.4.0        tibble_3.1.5      crayon_1.4.1      whisker_0.4      
[49] pkgconfig_2.0.3   ellipsis_0.3.2    Matrix_1.3-4      data.table_1.14.2
[53] assertthat_0.2.1  rmarkdown_2.11    R6_2.5.1          globals_0.14.0   
[57] git2r_0.28.0      compiler_4.1.1