8 Processing of whole-embryo Tet TKO embryos

(AAV/Cre-delivered to Tet triple floxed zygotes)

setwd(here::here())
library("Matrix")
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("metacell")
library("tgstat")
scdb_init("scrna_db", force_reinit = T)
## initializing scdb to scrna_db
mat <- scdb_mat("tko_germline")
# for compatibility with later scripts, change column name 'cell_genotype' to 'cell_type'
md <- mat@cell_metadata

if ("cell_genotype" %in% colnames(md)) {
    md <- rename(md, cell_type = cell_genotype)
}

mat@cell_metadata <- md
scdb_add_mat(id = "tko_germline", mat = mat)

8.0.0.1 Remove extraembryonic ectoderm and parietal endoderm cells

8.0.0.2 Merge cells with the wildtype atlas

source("scripts/pipeline/remove_exe_ectoderm_and_parietal_endo_cls.R")
source("scripts/pipeline/merge_umi_mat_with_wt10_umi_mat.R")

mat <- remove_exe_ectoderm_and_parietal_endoderm(mat_query = mat)
mat_new <- merge_umi_mat_with_wt10(scmat = mat)
scdb_add_mat(id = "tko_germline_wt10", mat = mat_new)

8.0.0.3 Generate single-cell balanced kNN-graph

This step needs the file
data/tet_tko.bad_genes.txt

# 4. generate cgraph
source("scripts/pipeline/gen_cgraph.R")
## initializing scdb to scrna_db/
gen_cgraph(mat_nm = "tko_germline_wt10", force_recompute_cgraph = F)
## [1] TRUE

8.0.0.4 Transfer cell type annotation to TKO cells

source("scripts/pipeline/transfer_cell_type_annotation.R")
transfer_color_chimera_tetraploid("tko_germline_wt10")

8.0.0.5 Time single embryos

source("scripts/pipeline/transfer_time_annotation.R")
## Loading required package: slam
## Loading required package: sparsesvd
source("scripts/pipeline/tko_germline_timing.R")
tko_germline_timing("tko_germline_wt10")