Xiang, L., Yin, Y., Zheng, Y., Ma, Y., Li, Y., Zhao, Z., Guo, J., Ai, Z., Niu, Y., Duan, K., et al. (2020). A developmental landscape of 3D-cultured human pre-gastrulation embryos. Nature 577, 537–542.

  • BioProject Accession: PRJNA562548
  • GEO Accession: GSE136447



Load required packages.

library(tidyverse)
library(magrittr)
library(Matrix)
library(Seurat)
library(extrafont)
library(patchwork)
# library(tidylog)
Sys.time()
## [1] "2020-08-01 15:23:42 CDT"

Data preparation

Functions loading

source(
    file = file.path(
        SCRIPT_DIR,
        "utilities.R"
    )
)

Data loading

Load SRA run info.

cell_metadata <- read_delim(
    file = "../SraRunTable.txt",
    delim = ","
)
## Parsed with column specification:
## cols(
##   .default = col_character(),
##   AvgSpotLen = col_double(),
##   Bases = col_double(),
##   Bytes = col_double(),
##   ReleaseDate = col_datetime(format = "")
## )
## See spec(...) for full column specifications.
cell_metadata$Cell_type %>%
    table()
## .
##      CTBs       EPI      EVTs Hypoblast       ICM   PSA-EPI      STBs 
##       159       126        40        25        52        44       109
cell_metadata %>% head()

Prepare metadata for single cells.

embedding <- read_csv(
    file = "embedding_ncomponents31_seed20200317.csv"
) %>%
    select(cell:y_tsne) %>%
    left_join(
        cell_metadata[, c("Run", "Age", "Cell_type", "Sample Name")],
        by = c("cell" = "Run")
    ) %>%
    rename(
        developmental_stage = Age,
        lineage = Cell_type,
        sample_name = `Sample Name`
    ) %>%
    mutate(
        louvain = factor(louvain),
        #
        developmental_stage = str_replace(
            string = developmental_stage,
            pattern = "embryo invitro day ",
            replacement = "E"
        ),
        developmental_stage = factor(
            developmental_stage,
            levels = stringr::str_sort(
                x = unique(developmental_stage),
                numeric = TRUE
            )
        ),
        lineage = factor(
            lineage,
            levels = c(
                "ICM",
                "EPI",
                "PSA-EPI",
                "Hypoblast",
                "CTBs",
                "STBs",
                "EVTs"
            )
        )
    )
## Parsed with column specification:
## cols(
##   cell = col_character(),
##   batch = col_character(),
##   louvain = col_double(),
##   x_tsne = col_double(),
##   y_tsne = col_double(),
##   x_umap = col_double(),
##   y_umap = col_double(),
##   x_fitsne = col_double(),
##   y_fitsne = col_double(),
##   x_phate = col_double(),
##   y_phate = col_double(),
##   `x_min_dist=0.1` = col_double(),
##   `y_min_dist=0.1` = col_double(),
##   x_multicoretsne = col_double(),
##   y_multicoretsne = col_double()
## )
embedding %>% head()
reticulate::py_discover_config()
## python:         /Users/jialei/.pyenv/shims/python
## libpython:      /Users/jialei/.pyenv/versions/3.8.2/lib/libpython3.8.dylib
## pythonhome:     /Users/jialei/.pyenv/versions/3.8.2:/Users/jialei/.pyenv/versions/3.8.2
## version:        3.8.2 (default, May 23 2020, 03:35:41)  [Clang 11.0.3 (clang-1103.0.32.62)]
## numpy:          /Users/jialei/.pyenv/versions/3.8.2/lib/python3.8/site-packages/numpy
## numpy_version:  1.19.0
## 
## NOTE: Python version was forced by RETICULATE_PYTHON
np <- reticulate::import("numpy", convert = TRUE)
scipy.sparse <- reticulate::import(module = "scipy.sparse", convert = TRUE)

matrix_readcount_use <- scipy.sparse$load_npz("../matrix_readcount.npz")
matrix_readcount_use_features <- np$load("../matrix_readcount_features.npy")
matrix_readcount_use_barcodes <- np$load("../matrix_readcount_barcodes.npy")
colnames(matrix_readcount_use) <- matrix_readcount_use_barcodes
# rownames(matrix_readcount_use) <- matrix_readcount_use_features
rownames(matrix_readcount_use) <- paste(
    gene_symbo_info$X1,
    gene_symbo_info$X2,
    sep = "_"
)
matrix_readcount_use <- matrix_readcount_use[, embedding$cell]

# calculate CPM
matrix_cpm_use <- calc_cpm(matrix_readcount_use)

stopifnot(
    dim(matrix_readcount_use) == dim(matrix_cpm_use)
)
print(dim(matrix_readcount_use))
## [1] 33538   555
walk(list(embedding, matrix_readcount_use, matrix_cpm_use), function(x) {
    print(object.size(x), units = "auto", standard = "SI")
})
## 139.8 kB
## 71.6 MB
## 71.6 MB

Characterization of clustering

Clusters

embedding %>%
    mutate(
        num_umis = colSums(matrix_readcount_use[, cell]),
        num_genes = colSums(matrix_readcount_use[, cell] > 0)
    ) %>%
    group_by(louvain) %>%
    summarise(
        num_cell = n(),
        median_umis = median(num_umis),
        median_genes = median(num_genes)
    ) %>%
    gt::gt() %>%
    gt::tab_options(table.font.size = "median")
## `summarise()` ungrouping output (override with `.groups` argument)

louvain num_cell median_umis median_genes
0 114 8237856 9930.5
1 87 11307773 9017.0
2 86 9414532 10279.5
3 72 12111266 10120.0
4 72 11915513 11100.0
5 46 9897404 11808.5
6 41 10522366 11805.0
7 37 9180087 9615.0

p_embedding_cluster <- plot_embedding(
    embedding = embedding[, c("x_tsne", "y_tsne")],
    color_values = embedding$louvain %>% as.factor(),
    label = "Cluster",
    # label_position = c(label_x, label_y),
    show_color_value_labels = TRUE,
    show_color_legend = FALSE,
    geom_point_size = 1,
    sort_values = FALSE
)
p_embedding_cluster +
    scale_color_manual(
        values = gg_color_hue(n = length(unique(embedding$louvain)))
    )
## Scale for 'colour' is already present. Adding another scale for 'colour',
## which will replace the existing scale.

Distribution of UMIs

# Embedding
plot_embedding_value(
    embedding = embedding[, c("x_tsne", "y_tsne")],
    color_values = matrix_readcount_use[, embedding$cell] %>%
        colSums(),
    colorbar_position = c(0.86, 0.28),
    label = "UMI distribution",
    label_position = NULL,
    # label_position = c(label_x, label_y),
    geom_point_size = 1,
    sort_values = FALSE,
    FUN = function(x) log10(x)
)

Distribution of samples

Development stage

prepare_cluster_composition(
    embedding = embedding,
    x = louvain, group = developmental_stage
) %>%
    select(-num_cells) %>%
    pivot_wider(
        names_from = developmental_stage,
        values_from = percentage
    ) %>%
    replace(is.na(.), 0) %>%
    as_tibble() %>%
    gt::gt() %>%
    gt::fmt_percent(starts_with("E")) %>%
    gt::tab_options(table.font.size = "median")
## `summarise()` ungrouping output (override with `.groups` argument)
## `summarise()` regrouping output by 'louvain' (override with `.groups` argument)

louvain E6 E7 E8 E9 E10 E12 E13.5 E14
0 22.81% 14.04% 7.89% 7.89% 11.40% 17.54% 2.63% 15.79%
1 4.60% 49.43% 14.94% 10.34% 4.60% 10.34% 1.15% 4.60%
2 0.00% 0.00% 0.00% 3.49% 16.28% 33.72% 8.14% 38.37%
3 0.00% 0.00% 20.83% 18.06% 37.50% 12.50% 1.39% 9.72%
4 0.00% 2.78% 30.56% 47.22% 19.44% 0.00% 0.00% 0.00%
5 0.00% 0.00% 0.00% 0.00% 10.87% 43.48% 6.52% 39.13%
6 0.00% 0.00% 0.00% 0.00% 0.00% 2.44% 0.00% 97.56%
7 89.19% 10.81% 0.00% 0.00% 0.00% 0.00% 0.00% 0.00%

p_barplot_cluster_composition_developmental_stage <- prepare_cluster_composition(
    embedding = embedding,
    x = louvain, group = developmental_stage
) %>%
    arrange(louvain) %>%
    plot_barplot(x = louvain, y = percentage, z = developmental_stage) +
    scale_fill_manual(
        values = ggthemes::tableau_color_pal("Tableau 20")(
            length(unique(embedding$developmental_stage))
        )
    )
## `summarise()` ungrouping output (override with `.groups` argument)
## `summarise()` regrouping output by 'louvain' (override with `.groups` argument)

Lineage

embedding %<>%
    mutate(
        lineage_full = as.character(lineage),
        lineage_full = case_when(
            lineage_full == c("CTBs") ~ "Cytotrophoblasts",
            lineage_full == c("STBs") ~ "Syncytiotrophoblasts",
            lineage_full == c("EVTs") ~ "Extravillous cytotrophoblasts",
            lineage_full == c("PSA-EPI") ~ "Primitive streak anlage - epiblast",
            lineage_full == c("EPI") ~ "Epiblast",
            lineage_full == c("ICM") ~ "Inner cell mass",
            TRUE ~ .data$lineage_full
        ),
        #
        lineage2 = as.character(lineage),
        lineage2 = case_when(
            lineage2 == c("CTBs") ~ "TE",
            lineage2 == c("STBs") ~ "TE",
            lineage2 == c("EVTs") ~ "TE",
            lineage2 == c("PSA-EPI") ~ "EPI",
            lineage2 == c("Hypoblast") ~ "HYP",
            TRUE ~ .data$lineage2
        ),
        #
        lineage_full = factor(
            lineage_full,
            levels = c(
                "Inner cell mass",
                "Epiblast",
                "Primitive streak anlage - epiblast",
                "Hypoblast",
                "Cytotrophoblasts",
                "Syncytiotrophoblasts",
                "Extravillous cytotrophoblasts"
            )
        ),
        #
        lineage2 = factor(
            lineage2,
            levels = c("ICM", "EPI", "HYP", "TE")
        )
    )
embedding %>%
    dplyr::count(lineage, lineage_full, name = "num_cells") %>%
    arrange(lineage) %>%
    gt::gt() %>%
    gt::tab_options(table.font.size = "median")

lineage lineage_full num_cells
ICM Inner cell mass 52
EPI Epiblast 126
PSA-EPI Primitive streak anlage - epiblast 44
Hypoblast Hypoblast 25
CTBs Cytotrophoblasts 159
STBs Syncytiotrophoblasts 109
EVTs Extravillous cytotrophoblasts 40

prepare_cluster_composition(
    embedding = embedding,
    x = louvain, group = lineage
) %>%
    select(-num_cells) %>%
    pivot_wider(
        names_from = lineage,
        values_from = percentage
    ) %>%
    replace(is.na(.), 0) %>%
    as_tibble() %>%
    gt::gt() %>%
    gt::fmt_percent(c(2:8)) %>%
    gt::tab_options(table.font.size = "median")
## `summarise()` ungrouping output (override with `.groups` argument)
## `summarise()` regrouping output by 'louvain' (override with `.groups` argument)

louvain EPI ICM PSA-EPI Hypoblast CTBs EVTs STBs
0 100.00% 0.00% 0.00% 0.00% 0.00% 0.00% 0.00%
1 3.45% 17.24% 2.30% 28.74% 48.28% 0.00% 0.00%
2 1.16% 0.00% 1.16% 0.00% 51.16% 46.51% 0.00%
3 0.00% 0.00% 4.17% 0.00% 5.56% 0.00% 90.28%
4 1.39% 1.39% 0.00% 0.00% 95.83% 0.00% 1.39%
5 2.17% 0.00% 4.35% 0.00% 0.00% 0.00% 93.48%
6 12.20% 0.00% 87.80% 0.00% 0.00% 0.00% 0.00%
7 2.70% 97.30% 0.00% 0.00% 0.00% 0.00% 0.00%

p_barplot_cluster_composition_lineage <- prepare_cluster_composition(
    embedding = embedding,
    x = louvain, group = lineage
) %>%
    arrange(louvain) %>%
    plot_barplot(x = louvain, y = percentage, z = lineage) +
    scale_fill_manual(
        values = ggthemes::tableau_color_pal("Tableau 10")(
            length(unique(embedding$lineage))
        )
    )
## `summarise()` ungrouping output (override with `.groups` argument)
## `summarise()` regrouping output by 'louvain' (override with `.groups` argument)
# combine plots
p_barplot_cluster_composition_developmental_stage +
    p_barplot_cluster_composition_lineage +
    plot_annotation(theme = theme(plot.margin = margin())) +
    plot_layout(guides = "collect")

Lineage; merged

prepare_cluster_composition(
    embedding = embedding,
    x = louvain, group = lineage2
) %>%
    select(-num_cells) %>%
    pivot_wider(
        names_from = lineage2,
        values_from = percentage
    ) %>%
    replace(is.na(.), 0) %>%
    as_tibble() %>%
    gt::gt() %>%
    gt::fmt_percent(c(2:5)) %>%
    gt::tab_options(table.font.size = "median")
## `summarise()` ungrouping output (override with `.groups` argument)
## `summarise()` regrouping output by 'louvain' (override with `.groups` argument)

louvain EPI ICM HYP TE
0 100.00% 0.00% 0.00% 0.00%
1 5.75% 17.24% 28.74% 48.28%
2 2.33% 0.00% 0.00% 97.67%
3 4.17% 0.00% 0.00% 95.83%
4 1.39% 1.39% 0.00% 97.22%
5 6.52% 0.00% 0.00% 93.48%
6 100.00% 0.00% 0.00% 0.00%
7 2.70% 97.30% 0.00% 0.00%

prepare_cluster_composition(
    embedding = embedding,
    x = louvain, group = lineage2
) %>%
    arrange(louvain) %>%
    plot_barplot(x = louvain, y = percentage, z = lineage2) +
    scale_fill_manual(
        values = as.character(yarrr::piratepal(palette = "google"))
    )
## `summarise()` ungrouping output (override with `.groups` argument)
## `summarise()` regrouping output by 'louvain' (override with `.groups` argument)

Delineating lineage by transcriptome

Expression

t-SNE embedding

FEATURES_SELECTED <- c(
    "NANOG",
    "POU5F1",
    "PDGFRA",
    "GATA6",
    "GATA3",
    "GATA2"
)

FEATURES_SELECTED <- rownames(matrix_readcount_use)[
    gene_symbo_info$X2 %in% FEATURES_SELECTED
]
map(FEATURES_SELECTED, function(x) {
    plot_embedding_value(
        embedding = embedding[, c("x_tsne", "y_tsne")],
        color_values = matrix_cpm_use[x, embedding$cell],
        colorbar_position = c(0.86, 0.28),
        label = str_c("t-SNE; ", x),
        label_position = NULL,
        # label_position = c(label_x, label_y),
        geom_point_size = 1,
        sort_values = TRUE,
        FUN = NULL
    )
}) %>%
    purrr::reduce(`+`) +
    plot_annotation(theme = theme(plot.margin = margin()))

Heatmap

FEATURES_SELECTED <- c(
    "GAPDH",
    "PPIA",
    # "OCT4",
    "POU5F1",
    "NANOG",
    "SOX2",
    "PRDM14",
    "DPPA3",
    "GDF3",
    "CDH1",
    "CDH2",
    "GATA6",
    "PDGFRA",
    "GATA4",
    "SOX17",
    "DUSP4",
    "TFAP2C",
    # "CK7",
    "KRT7",
    "GATA2",
    "CDX2",
    "TEAD4",
    "EOMES",
    "TCEAL4",
    "CSH1",
    "HLA-G",
    "MMP2",
    "TBXT"
)

FEATURES_SELECTED <- rownames(matrix_readcount_use)[
    gene_symbo_info$X2 %in% FEATURES_SELECTED
]
length(FEATURES_SELECTED)
## [1] 26
matrix_heatmap <- calc_cpm(m = matrix_readcount_use)[FEATURES_SELECTED, ]
matrix_heatmap <- matrix_heatmap[rowSums(matrix_heatmap) != 0, ]
matrix_heatmap <- log10(matrix_heatmap + 1)
matrix_heatmap <- t(scale(t(matrix_heatmap)))
# rownames(matrix_heatmap) <- str_remove(
#     string = rownames(matrix_heatmap),
#     pattern = "^E.+_"
# )

(heatmap_limits <- quantile(matrix_heatmap, c(0.05, 0.95)))
##        5%       95% 
## -1.243100  1.825677
matrix_heatmap[matrix_heatmap < heatmap_limits[1]] <- heatmap_limits[1]
matrix_heatmap[matrix_heatmap > heatmap_limits[2]] <- heatmap_limits[2]
ha_columns <- ComplexHeatmap::HeatmapAnnotation(
    lineage = ComplexHeatmap::anno_simple(
        embedding[match(
            x = colnames(matrix_heatmap),
            table = embedding$cell
        ), "lineage"],
        # pch = anno_labels_cluster,
        col = setNames(
            object = ggthemes::tableau_color_pal("Tableau 10")(
                length(unique(embedding$lineage))
            ),
            nm = sort(unique(embedding$lineage))
        ),
        which = "column",
        pt_size = unit(2, "mm"),
        pt_gp = grid::gpar(
            fontfamily = "Arial",
            fontsize = 5
        ),
        simple_anno_size = unit(3, "mm")
    ),
    #
    lineage_merged = ComplexHeatmap::anno_simple(
        embedding[match(
            x = colnames(matrix_heatmap),
            table = embedding$cell
        ), "lineage2"],
        # pch = anno_labels_cluster,
        col = setNames(
            object = as.character(yarrr::piratepal(palette = "google")),
            nm = sort(unique(embedding$lineage2))
        ),
        which = "column",
        pt_size = unit(2, "mm"),
        pt_gp = grid::gpar(
            fontfamily = "Arial",
            fontsize = 5
        ),
        simple_anno_size = unit(3, "mm")
    ),
    #
    developmental_stage = ComplexHeatmap::anno_simple(
        embedding[match(
            x = colnames(matrix_heatmap),
            table = embedding$cell
        ), "developmental_stage"],
        # pch = anno_labels_lineage,
        col = setNames(
            object = ggthemes::tableau_color_pal("Tableau 20")(
                length(unique(embedding$developmental_stage))
            ),
            nm = levels(embedding$developmental_stage)
        ),
        which = "column",
        # pt_size = unit(2, "mm"),
        pt_gp = grid::gpar(
            fontfamily = "Arial",
            fontsize = 5
        ),
        simple_anno_size = unit(3, "mm")
    ),
    show_annotation_name = TRUE,
    annotation_label = c(
        "Lineage",
        "Lineage, merged",
        "Developmental stage"
    ),
    annotation_name_gp = grid::gpar(fontfamily = "Arial", fontsize = 6),
    annotation_name_side = "left"
)
rownames(matrix_heatmap) <- str_remove(
    string = rownames(matrix_heatmap),
    pattern = "^E.+_"
)
ht <- ComplexHeatmap::Heatmap(
    matrix = matrix_heatmap,
    col = wesanderson::wes_palette("Zissou1", 50, type = "continuous"),
    # col =  viridis::plasma(n = 10),
    #
    cluster_rows = TRUE,
    cluster_columns = TRUE,
    #
    show_row_names = TRUE,
    show_column_names = FALSE,
    row_names_gp = grid::gpar(fontfamily = "Arial", fontsize = 6),
    #
    show_row_dend = TRUE,
    show_column_dend = TRUE,
    column_dend_side = c("bottom"),
    #
    show_heatmap_legend = TRUE,
    top_annotation = ha_columns,
    #
    heatmap_legend_param = list(
        title = "Z score",
        title_gp = grid::gpar(
            fontfamily = "Arial",
            fontsize = 6
        ),
        legend_direction = "vertical",
        labels_gp = grid::gpar(
            fontfamily = "Arial",
            fontsize = 6
        ),
        legend_height = unit(25, "mm"),
        legend_width = unit(10, "mm")
    )
)
lgd_lineage <- ComplexHeatmap::Legend(
    title = "Lineage",
    labels = sort(unique(embedding$lineage)),
    legend_gp = grid::gpar(fill = ggthemes::tableau_color_pal("Tableau 10")(
        length(unique(embedding$lineage))
    )),
    labels_gp = grid::gpar(
        fontfamily = "Arial",
        fontsize = 6
    ),
    title_gp = grid::gpar(
        fontfamily = "Arial",
        fontsize = 6
    )
)

lgd_lineage_merged <- ComplexHeatmap::Legend(
    title = "Lineage, merged",
    labels = sort(unique(embedding$lineage2)),
    legend_gp = grid::gpar(
        fill = as.character(yarrr::piratepal(palette = "google"))
    ),
    labels_gp = grid::gpar(
        fontfamily = "Arial",
        fontsize = 6
    ),
    title_gp = grid::gpar(
        fontfamily = "Arial",
        fontsize = 6
    )
)

lgd_developmental_stage <- ComplexHeatmap::Legend(
    title = "Developmental stage",
    labels = levels(embedding$developmental_stage),
    legend_gp = grid::gpar(fill = ggthemes::tableau_color_pal("Tableau 20")(
        length(levels(embedding$developmental_stage))
    )),
    labels_gp = grid::gpar(
        fontfamily = "Arial",
        fontsize = 6
    ),
    title_gp = grid::gpar(
        fontfamily = "Arial",
        fontsize = 6
    )
)
pd <- ComplexHeatmap::packLegend(
    lgd_lineage,
    lgd_lineage_merged,
    gap = unit(8, "mm"),
    direction = "horizontal"
)
ComplexHeatmap::draw(
    ht,
    heatmap_legend_list = list(pd, lgd_developmental_stage)
)

Lineages and developmental stages

customized_theme <- function(x) {
    theme(
        legend.text = element_text(family = "Arial", size = 6),
        legend.key.size = unit(3, "mm"),
        legend.margin = margin(t = 0, r = 0, b = 0, l = 0, unit = "mm"),
        legend.background = element_blank()
    )
}
p_embedding_cluster_lineage <- plot_embedding(
    embedding = embedding[, c("x_tsne", "y_tsne")],
    color_values = embedding$lineage %>% factor(),
    label = "t-SNE; Lineage",
    # label_position = c(label_x, label_y),
    show_color_value_labels = TRUE,
    show_color_legend = TRUE,
    geom_point_size = 1,
    sort_values = FALSE
) +
    scale_color_manual(
        values = ggthemes::tableau_color_pal("Tableau 10")(
            length(unique(embedding$lineage))
        )
    ) +
    labs(color = NULL) +
    guides(colour = guide_legend(override.aes = list(size = 3))) +
    customized_theme()

p_embedding_cluster_lineage2 <- plot_embedding(
    embedding = embedding[, c("x_tsne", "y_tsne")],
    color_values = embedding$lineage2 %>% factor(),
    label = "t-SNE; Lineage, merged",
    # label_position = c(label_x, label_y),
    show_color_value_labels = TRUE,
    show_color_legend = TRUE,
    geom_point_size = 1,
    sort_values = FALSE
) +
    scale_color_manual(
        values = as.character(yarrr::piratepal(palette = "google"))
    ) +
    labs(color = NULL) +
    guides(colour = guide_legend(override.aes = list(size = 3))) +
    customized_theme()

p_embedding_cluster_developmental_stage <- plot_embedding(
    embedding = embedding[, c("x_tsne", "y_tsne")],
    color_values = embedding$developmental_stage %>% factor(),
    label = "t-SNE; Developmental stage",
    # label_position = c(label_x, label_y),
    show_color_value_labels = FALSE,
    show_color_legend = TRUE,
    geom_point_size = 1,
    sort_values = FALSE
) +
    scale_color_manual(
        values = ggthemes::tableau_color_pal("Tableau 20")(
            length(unique(embedding$developmental_stage))
        )
    ) +
    labs(color = NULL) +
    guides(colour = guide_legend(override.aes = list(size = 3))) +
    customized_theme()

p_embedding_cluster2 <- plot_embedding(
    embedding = embedding[, c("x_tsne", "y_tsne")],
    color_values = embedding$louvain %>% factor(),
    label = "t-SNE; Cluster",
    # label_position = c(label_x, label_y),
    show_color_value_labels = TRUE,
    show_color_legend = TRUE,
    geom_point_size = 1,
    sort_values = FALSE
) +
    scale_color_manual(
        values = gg_color_hue(n = length(unique(embedding$louvain)))
    ) +
    labs(color = NULL) +
    guides(colour = guide_legend(override.aes = list(size = 3))) +
    customized_theme()
list(
    p_embedding_cluster2,
    p_embedding_cluster_lineage,
    p_embedding_cluster_lineage2,
    p_embedding_cluster_developmental_stage
) %>%
    purrr::reduce(`+`) +
    plot_annotation(theme = theme(plot.margin = margin())) +
    plot_layout(guides = "collect")

AME–EPI separation

# match sample ids
# https://www.ncbi.nlm.nih.gov/geo/browse/?view=samples&series=136447
sample_info <- read_csv(
    file = "sample.csv"
)
## Parsed with column specification:
## cols(
##   Accession = col_character(),
##   Title = col_character(),
##   `Sample Type` = col_character(),
##   Taxonomy = col_character(),
##   Channels = col_double(),
##   Platform = col_character(),
##   Series = col_character(),
##   `Supplementary Types` = col_character(),
##   `Supplementary Links` = col_character(),
##   `SRA Accession` = col_character(),
##   Contact = col_character(),
##   `Release Date` = col_character()
## )
sample_info %>% head()
embedding %<>%
    left_join(
        sample_info[, c("Accession", "Title")],
        by = c("sample_name" = "Accession")
    ) %>%
    rename(sample_id = Title)

embedding %>% head()
SUPPLEMENTARY_INFORMATION_DIR <- "../../../../docs/A_developmental_landscape_of_3D-cultured_human_pre-gastrulation_embryos"
# Table S8.1 Basic information of 555 single cells. The Embryo ID column listed the embryos to which the cells belong. The number after D is day post-fertilization; the remaining part is the serial number of embryos on the same days. The group column listed the major lineages of the cells as defined in Fig 2b.
file_name <- "41586_2019_1875_MOESM10_ESM.xlsx"
table_s8_sheet1 <- readxl::read_excel(
    path = file.path(SUPPLEMENTARY_INFORMATION_DIR, file_name),
    sheet = "S8.1",
    col_names = FALSE
)
## New names:
## * `` -> ...1
## * `` -> ...2
## * `` -> ...3
## * `` -> ...4
table_s8_sheet1 %>% head()
# clean messy spreadsheet
table_s8_sheet1 %<>%
    slice(-c(1:3)) %>%
    `colnames<-`(c("sample_id", "day", "embryo_id", "group"))
table_s8_sheet1

Add embryo ids.

embedding %<>%
    mutate(
        sample_id = str_remove(
            string = sample_id,
            pattern = "Embryo_"
        )
    ) %>%
    left_join(table_s8_sheet1[, c("sample_id", "embryo_id")])
## Joining, by = "sample_id"
# Table S8.3 Group information of single cells in extended data figure 4o.
file_name <- "41586_2019_1875_MOESM10_ESM.xlsx"
table_s8_sheet3 <- readxl::read_excel(
    path = file.path(SUPPLEMENTARY_INFORMATION_DIR, file_name),
    sheet = "S8.3",
    col_names = FALSE
)
## New names:
## * `` -> ...1
## * `` -> ...2
## * `` -> ...3
table_s8_sheet3 %>% head()
# clean messy spreadsheet
table_s8_sheet3 %<>%
    slice(-c(1:3)) %>%
    `colnames<-`(c("sample_id", "day", "group"))
table_s8_sheet3
# "D12A3B14" %in% embedding$sample_id
# "D14_3S10" %in% embedding$sample_id
# "D14A1S12" %in% embedding$sample_id

embedding2 <- embedding %>%
    left_join(
        table_s8_sheet3[, c("sample_id", "group")],
        by = "sample_id"
    )

color_value_factors <- embedding2$group
color_value_factors[is.na(embedding2$group)] <- "N/A"
# Extended data figure 4o
plot_embedding(
    embedding = embedding2[, c("x_tsne", "y_tsne")],
    color_values = color_value_factors,
    label = "t-SNE; Cell type",
    # label_position = c(label_x, label_y),
    show_color_value_labels = TRUE,
    show_color_legend = TRUE,
    geom_point_size = 1,
    sort_values = FALSE
) +
    scale_color_manual(
        values = c(
            RColorBrewer::brewer.pal(
                n = length(unique(color_value_factors)) - 1,
                name = "Dark2"
            ),
            "grey70"
        )
    ) +
    labs(color = NULL) +
    theme(
        legend.text = element_text(family = "Arial", size = 6),
        legend.key.size = unit(3, "mm"),
        legend.margin = margin(t = 0, r = 0, b = 0, l = 0, unit = "mm"),
        legend.background = element_blank()
    ) +
    guides(
        colour = guide_legend(override.aes = list(size = 3))
    )
## Scale for 'colour' is already present. Adding another scale for 'colour',
## which will replace the existing scale.

HESX1-T+ / HESX1+T- EPI

# Table S8.4 Cells used in extended data figure 5i.
embedding2 <- embedding %>%
    mutate(
        group = case_when(
            sample_id %in% c(
                "D14A1S6",
                "D14A1S28",
                "D14A1S30",
                "D14A1S7",
                "D14A1S31",
                "D14A1S13",
                "D14A1S58",
                "D14A1S47",
                "D14A1S64",
                "D14A3S20",
                "D14A1S21",
                "D14A1B27"
            ) ~ "HESX1-T+ EPI",
            sample_id %in% c(
                "D14A1S46",
                "D14A1S51",
                "D14A1B2",
                "D14A1S12",
                "D14A1S14",
                "D14A1S29",
                "D14A1S33",
                "D14A1S56",
                "D14_3S10",
                "D14_3S15"
            )
            ~ "HESX1+T- EPI"
        ),
        group = ifelse(is.na(group), "N/A", group)
    )
embedding2 %>%
    dplyr::count(group) %>%
    gt::gt() %>%
    gt::cols_label(n = "num_cell") %>%
    gt::tab_options(table.font.size = "median")
group num_cell
HESX1-T+ EPI 12
HESX1+T- EPI 10
N/A 533

t-SNE embedding

# Extended data figure 4o
p_embedding_HESX1_p1 <- plot_embedding(
    embedding = embedding2[, c("x_tsne", "y_tsne")],
    color_values = embedding2$group %>% factor(),
    label = "t-SNE; Extended Data Fig. 4o",
    # label_position = c(label_x, label_y),
    show_color_value_labels = FALSE,
    show_color_legend = TRUE,
    geom_point_size = 1,
    sort_values = FALSE
) +
    scale_color_manual(
        values = c(
            ggsci::pal_npg("nrc", alpha = 1)(
                embedding2$group %>% unique() %>% length() - 1
            ),
            "grey70"
        )
    ) +
    labs(color = NULL) +
    theme(
        legend.text = element_text(family = "Arial", size = 6),
        legend.key.size = unit(3, "mm"),
        legend.margin = margin(t = 0, r = 0, b = 0, l = 0, unit = "mm"),
        legend.background = element_blank(),
        #
        legend.justification = c(0, 1),
        legend.position = c(0.075, 0.975)
    ) +
    guides(
        colour = guide_legend(override.aes = list(size = 3))
    )
## Scale for 'colour' is already present. Adding another scale for 'colour',
## which will replace the existing scale.
(rownames(matrix_readcount_use)[gene_symbo_info$X2 %in% "HESX1"])
## [1] "ENSG00000163666_HESX1"
p_embedding_HESX1_p2 <- plot_embedding_value(
    embedding = embedding[, c("x_tsne", "y_tsne")],
    color_values = matrix_cpm_use["ENSG00000163666_HESX1", embedding$cell],
    colorbar_position = c(0.86, 0.28),
    label = str_c("t-SNE; ", "ENSG00000163666_HESX1"),
    label_position = NULL,
    # label_position = c(label_x, label_y),
    geom_point_size = 1,
    sort_values = TRUE,
    FUN = NULL
)

color_values <- matrix_cpm_use["ENSG00000163666_HESX1", embedding$cell]
color_values[!embedding$lineage %in% c("EPI")] <- NA
p_embedding_HESX1_p3 <- plot_embedding_value(
    embedding = embedding[, c("x_tsne", "y_tsne")],
    color_values = color_values,
    colorbar_position = c(0.86, 0.28),
    label = str_c("t-SNE; ", "ENSG00000163666_HESX1", "; EPI"),
    label_position = NULL,
    # label_position = c(label_x, label_y),
    geom_point_size = 1,
    sort_values = TRUE,
    FUN = NULL
)

color_values <- matrix_cpm_use["ENSG00000163666_HESX1", embedding$cell]
color_values[!embedding$lineage %in% c("PSA-EPI")] <- NA
p_embedding_HESX1_p4 <- plot_embedding_value(
    embedding = embedding[, c("x_tsne", "y_tsne")],
    color_values = color_values,
    colorbar_position = c(0.86, 0.28),
    label = str_c("t-SNE; ", "ENSG00000163666_HESX1", "; PSA-EPI"),
    label_position = NULL,
    # label_position = c(label_x, label_y),
    geom_point_size = 1,
    sort_values = TRUE,
    FUN = NULL
)
p_embedding_HESX1_p1 +
    p_embedding_HESX1_p2 +
    p_embedding_HESX1_p3 +
    p_embedding_HESX1_p4 +
    plot_annotation(theme = theme(plot.margin = margin())) +
    plot_layout(guides = "keep")

Barplot

FEATURES_SELECTED <- c(
    "ENSG00000163666_HESX1",
    "ENSG00000164458_TBXT"
)

map(FEATURES_SELECTED, function(x) {
    embedding %>%
        mutate(feature_value = matrix_cpm_use[x, cell]) %>%
        group_by(developmental_stage, lineage) %>%
        summarise(mean_expr = mean(feature_value + 1)) %>%
        plot_barplot_feature(
            x = developmental_stage,
            y = mean_expr,
            z = "lineage",
            title = x
        )
}) %>%
    purrr::reduce(`+`) +
    plot_layout(ncol = 1) +
    plot_annotation(
        tag_levels = c("A"),
        theme = theme(plot.margin = margin())
    ) &
    theme(
        plot.tag.position = c(0, 1),
        plot.tag = element_text(
            family = "Arial",
            size = 7,
            hjust = 0,
            vjust = 0
        )
    )
## `summarise()` regrouping output by 'developmental_stage' (override with `.groups` argument)
## `summarise()` regrouping output by 'developmental_stage' (override with `.groups` argument)

Trophoblast lineage development

# Table S8.5 Group information of 352 TrBs in extended data figure 8j_o.
file_name <- "41586_2019_1875_MOESM10_ESM.xlsx"
table_s8_sheet5 <- readxl::read_excel(
    path = file.path(SUPPLEMENTARY_INFORMATION_DIR, file_name),
    sheet = "S8.5",
    col_names = FALSE
)
## New names:
## * `` -> ...1
## * `` -> ...2
## * `` -> ...3
table_s8_sheet5 %>% head()
# clean messy spreadsheet, again * 3
table_s8_sheet5 %<>%
    slice(-c(1:3)) %>%
    `colnames<-`(c("sample_id", "day", "group"))
table_s8_sheet5
embedding2 <- embedding %>%
    left_join(
        table_s8_sheet5[, c("sample_id", "group")],
        by = "sample_id"
    )

color_value_factors <- embedding2 %>%
    mutate(
        group = ifelse(is.na(group), "N/A", group),
        group = factor(
            group,
            levels = c(
                "Pre-CTB",
                "Post-CTB",
                "Early-EVT",
                "EVT",
                "Early-STB",
                "STB",
                "N/A"
            )
        )
    ) %>%
    pull(group)
plot_embedding(
    embedding = embedding2[, c("x_tsne", "y_tsne")],
    color_values = color_value_factors,
    label = "t-SNE; Extended Data Fig. 8j",
    # label_position = c(label_x, label_y),
    show_color_value_labels = TRUE,
    show_color_legend = TRUE,
    geom_point_size = 1,
    sort_values = FALSE
) +
    scale_color_manual(
        values = c(
            ggsci::pal_npg("nrc", alpha = 1)(
                embedding2$group %>% unique() %>% length() - 1
            ),
            "grey70"
        )
    ) +
    labs(color = NULL) +
    theme(
        legend.text = element_text(family = "Arial", size = 6),
        legend.key.size = unit(3, "mm"),
        legend.margin = margin(t = 0, r = 0, b = 0, l = 0, unit = "mm"),
        legend.background = element_blank() # ,
        #
        # legend.justification = c(0, 1),
        # legend.position = c(0.075, 0.975)
    ) +
    guides(
        colour = guide_legend(override.aes = list(size = 3))
    ) +
    p_embedding_cluster_lineage +
    plot_annotation(theme = theme(plot.margin = margin())) +
    plot_layout(guides = "keep")
## Scale for 'colour' is already present. Adding another scale for 'colour',
## which will replace the existing scale.

Epiblast development and transition

EPI transcriptome dynamics

Four main clusters: ICM, pre-implantation EPI (pre-EPI), post-EPI and PSA-EPI.

# Table S8.6 Group information of EPIs.
# Group information of 222 cells in fig4 (also used in extended data fig 9k-n and 10a-c)
file_name <- "41586_2019_1875_MOESM10_ESM.xlsx"
table_s8_sheet6 <- readxl::read_excel(
    path = file.path(SUPPLEMENTARY_INFORMATION_DIR, file_name),
    sheet = "S8.6",
    col_names = FALSE
)
## New names:
## * `` -> ...1
## * `` -> ...2
## * `` -> ...3
## * `` -> ...4
## * `` -> ...5
## * ...
table_s8_sheet6 %>% head()
# clean messy spreadsheet
table_s8_sheet6 %<>%
    select(1:3) %>%
    slice(-c(1:3)) %>%
    `colnames<-`(c("sample_id", "day", "group"))
table_s8_sheet6
embedding2 <- embedding %>%
    left_join(
        table_s8_sheet6[, c("sample_id", "group")],
        by = "sample_id"
    )

color_value_factors <- embedding2$group
color_value_factors[is.na(embedding2$group)] <- "N/A"
color_value_factors <- color_value_factors %>%
    factor(., levels = c("ICM", "PSA_EPI", "PreEPI", "PostEPI", "N/A"))
# %>%
# forcats::fct_relevel("N/A", after = Inf)
plot_embedding(
    embedding = embedding2[, c("x_tsne", "y_tsne")],
    color_values = color_value_factors,
    label = "t-SNE; Fig. 4a",
    # label_position = c(label_x, label_y),
    show_color_value_labels = TRUE,
    show_color_legend = TRUE,
    geom_point_size = 1,
    sort_values = FALSE
) +
    scale_color_manual(
        values = c(
            ggsci::pal_npg("nrc", alpha = 1)(
                embedding2$group %>% unique() %>% length() - 1
            ),
            "grey70"
        )
    ) +
    labs(color = NULL) +
    theme(
        legend.text = element_text(family = "Arial", size = 6),
        legend.key.size = unit(3, "mm"),
        legend.margin = margin(t = 0, r = 0, b = 0, l = 0, unit = "mm"),
        legend.background = element_blank() # ,
        #
        # legend.justification = c(0, 1),
        # legend.position = c(0.075, 0.975)
    ) +
    guides(
        colour = guide_legend(override.aes = list(size = 3))
    ) +
    p_embedding_cluster_lineage +
    plot_annotation(theme = theme(plot.margin = margin())) +
    plot_layout(guides = "keep")
## Scale for 'colour' is already present. Adding another scale for 'colour',
## which will replace the existing scale.

EPI pluripotent state transition

# Table S8.6 Group information of EPIs.
# Group information of 136 cells in extended data fig9 e-j
file_name <- "41586_2019_1875_MOESM10_ESM.xlsx"
table_s8_sheet6 <- readxl::read_excel(
    path = file.path(SUPPLEMENTARY_INFORMATION_DIR, file_name),
    sheet = "S8.6",
    col_names = FALSE
)
## New names:
## * `` -> ...1
## * `` -> ...2
## * `` -> ...3
## * `` -> ...4
## * `` -> ...5
## * ...
table_s8_sheet6 %>% head()
# clean messy spreadsheet
table_s8_sheet6 %<>%
    select(10:12) %>%
    slice(-c(1:4)) %>%
    `colnames<-`(c("sample_id", "day", "group"))
embedding2 <- embedding %>%
    left_join(
        table_s8_sheet6[, c("sample_id", "group")],
        by = "sample_id"
    )

color_value_factors <- embedding2$group
color_value_factors[is.na(embedding2$group)] <- "N/A"
color_value_factors <- color_value_factors %>%
    factor(., levels = c("ICM", "PreEPI", "PostEPI", "PSA_EPI", "N/A"))
# %>%
# forcats::fct_relevel("N/A", after = Inf)
plot_embedding(
    embedding = embedding2[, c("x_tsne", "y_tsne")],
    color_values = color_value_factors,
    label = "t-SNE; Extended Data Fig. 9e",
    # label_position = c(label_x, label_y),
    show_color_value_labels = TRUE,
    show_color_legend = TRUE,
    geom_point_size = 1,
    sort_values = FALSE
) +
    scale_color_manual(
        values = c(
            ggsci::pal_npg("nrc", alpha = 1)(
                embedding2$group %>% unique() %>% length() - 1
            ),
            "grey70"
        )
    ) +
    labs(color = NULL) +
    theme(
        legend.text = element_text(family = "Arial", size = 6),
        legend.key.size = unit(3, "mm"),
        legend.margin = margin(t = 0, r = 0, b = 0, l = 0, unit = "mm"),
        legend.background = element_blank() # ,
        #
        # legend.justification = c(0, 1),
        # legend.position = c(0.075, 0.975)
    ) +
    guides(
        colour = guide_legend(override.aes = list(size = 3))
    ) +
    p_embedding_cluster_lineage +
    plot_annotation(theme = theme(plot.margin = margin())) +
    plot_layout(guides = "keep")
## Scale for 'colour' is already present. Adding another scale for 'colour',
## which will replace the existing scale.

R session info

devtools::session_info()$platform
##  setting  value                       
##  version  R version 4.0.2 (2020-06-22)
##  os       macOS Catalina 10.15.6      
##  system   x86_64, darwin19.5.0        
##  ui       unknown                     
##  language (EN)                        
##  collate  en_US.UTF-8                 
##  ctype    en_US.UTF-8                 
##  tz       America/Chicago             
##  date     2020-08-01
devtools::session_info()$pack %>%
    as_tibble() %>%
    select(
        package,
        loadedversion,
        date,
        `source`
    ) %>%
    print(n = nrow(.))
## # A tibble: 158 x 4
##     package        loadedversion date       source                              
##     <chr>          <chr>         <chr>      <chr>                               
##   1 abind          1.4-5         2016-07-21 CRAN (R 4.0.0)                      
##   2 ape            5.4           2020-06-03 CRAN (R 4.0.2)                      
##   3 assertthat     0.2.1         2019-03-21 CRAN (R 4.0.0)                      
##   4 backports      1.1.8         2020-06-17 CRAN (R 4.0.1)                      
##   5 BayesFactor    0.9.12-4.2    2018-05-19 CRAN (R 4.0.2)                      
##   6 blob           1.2.1         2020-01-20 CRAN (R 4.0.0)                      
##   7 broom          0.7.0.9001    2020-07-28 Github (tidymodels/broom@762e3ad)   
##   8 callr          3.4.3.9000    2020-07-31 Github (r-lib/callr@b96da8f)        
##   9 cellranger     1.1.0         2016-07-27 CRAN (R 4.0.0)                      
##  10 checkmate      2.0.0         2020-02-06 CRAN (R 4.0.0)                      
##  11 circlize       0.4.10        2020-06-15 CRAN (R 4.0.1)                      
##  12 cli            2.0.2         2020-02-28 CRAN (R 4.0.0)                      
##  13 clue           0.3-57        2019-02-25 CRAN (R 4.0.0)                      
##  14 cluster        2.1.0         2019-06-19 CRAN (R 4.0.2)                      
##  15 coda           0.19-3        2019-07-05 CRAN (R 4.0.0)                      
##  16 codetools      0.2-16        2018-12-24 CRAN (R 4.0.2)                      
##  17 colorspace     1.4-1         2019-03-18 CRAN (R 4.0.0)                      
##  18 ComplexHeatmap 2.4.3         2020-07-25 Bioconductor                        
##  19 cowplot        1.0.0         2019-07-11 CRAN (R 4.0.0)                      
##  20 crayon         1.3.4         2017-09-16 CRAN (R 4.0.0)                      
##  21 data.table     1.13.0        2020-07-24 CRAN (R 4.0.2)                      
##  22 DBI            1.1.0         2019-12-15 CRAN (R 4.0.0)                      
##  23 dbplyr         1.4.4.9000    2020-07-28 Github (tidyverse/dbplyr@a6ed629)   
##  24 deldir         0.1-28        2020-07-15 CRAN (R 4.0.2)                      
##  25 desc           1.2.0         2018-05-01 CRAN (R 4.0.0)                      
##  26 devtools       2.3.1.9000    2020-07-31 Github (r-lib/devtools@df619ce)     
##  27 digest         0.6.25        2020-02-23 CRAN (R 4.0.0)                      
##  28 dplyr          1.0.1.9000    2020-07-31 Github (tidyverse/dplyr@98fd0f6)    
##  29 ellipsis       0.3.1.9000    2020-07-18 Github (r-lib/ellipsis@57a5071)     
##  30 evaluate       0.14          2019-05-28 CRAN (R 4.0.0)                      
##  31 extrafont      0.17          2014-12-08 CRAN (R 4.0.2)                      
##  32 extrafontdb    1.0           2012-06-11 CRAN (R 4.0.0)                      
##  33 fansi          0.4.1         2020-01-08 CRAN (R 4.0.0)                      
##  34 farver         2.0.3         2020-01-16 CRAN (R 4.0.0)                      
##  35 fastmap        1.0.1         2019-10-08 CRAN (R 4.0.0)                      
##  36 fitdistrplus   1.1-1         2020-05-19 CRAN (R 4.0.0)                      
##  37 forcats        0.5.0.9000    2020-05-28 Github (tidyverse/forcats@ab81d1b)  
##  38 fs             1.5.0         2020-08-01 Github (r-lib/fs@1399626)           
##  39 future         1.18.0        2020-07-09 CRAN (R 4.0.2)                      
##  40 future.apply   1.6.0         2020-07-01 CRAN (R 4.0.2)                      
##  41 generics       0.0.2         2018-11-29 CRAN (R 4.0.0)                      
##  42 GetoptLong     1.0.2         2020-07-06 CRAN (R 4.0.2)                      
##  43 ggplot2        3.3.2.9000    2020-07-31 Github (tidyverse/ggplot2@5999889)  
##  44 ggrepel        0.9.0         2020-07-24 Github (slowkow/ggrepel@4d0ef50)    
##  45 ggridges       0.5.2         2020-01-12 CRAN (R 4.0.0)                      
##  46 ggsci          2.9           2020-06-04 Github (nanxstats/ggsci@589fe17)    
##  47 ggthemes       4.2.0         2019-05-13 CRAN (R 4.0.0)                      
##  48 GlobalOptions  0.1.2         2020-06-10 CRAN (R 4.0.0)                      
##  49 globals        0.12.5        2019-12-07 CRAN (R 4.0.0)                      
##  50 glue           1.4.1.9000    2020-07-07 Github (tidyverse/glue@205f18b)     
##  51 goftest        1.2-2         2019-12-02 CRAN (R 4.0.2)                      
##  52 gridExtra      2.3           2017-09-09 CRAN (R 4.0.0)                      
##  53 gt             0.2.1         2020-08-01 Github (rstudio/gt@6058358)         
##  54 gtable         0.3.0         2019-03-25 CRAN (R 4.0.0)                      
##  55 gtools         3.8.2         2020-03-31 CRAN (R 4.0.0)                      
##  56 haven          2.3.1         2020-06-01 CRAN (R 4.0.0)                      
##  57 hms            0.5.3         2020-01-08 CRAN (R 4.0.0)                      
##  58 htmltools      0.5.0         2020-06-16 CRAN (R 4.0.1)                      
##  59 htmlwidgets    1.5.1         2019-10-08 CRAN (R 4.0.0)                      
##  60 httpuv         1.5.4         2020-06-06 CRAN (R 4.0.0)                      
##  61 httr           1.4.2         2020-07-20 CRAN (R 4.0.2)                      
##  62 ica            1.0-2         2018-05-24 CRAN (R 4.0.0)                      
##  63 igraph         1.2.5         2020-03-19 CRAN (R 4.0.2)                      
##  64 irlba          2.3.3         2019-02-05 CRAN (R 4.0.2)                      
##  65 jpeg           0.1-8.1       2019-10-24 CRAN (R 4.0.0)                      
##  66 jsonlite       1.7.0         2020-06-25 CRAN (R 4.0.2)                      
##  67 KernSmooth     2.23-17       2020-04-26 CRAN (R 4.0.2)                      
##  68 knitr          1.29          2020-06-23 CRAN (R 4.0.2)                      
##  69 labeling       0.3           2014-08-23 CRAN (R 4.0.0)                      
##  70 later          1.1.0.1       2020-06-05 CRAN (R 4.0.0)                      
##  71 lattice        0.20-41       2020-04-02 CRAN (R 4.0.2)                      
##  72 lazyeval       0.2.2         2019-03-15 CRAN (R 4.0.0)                      
##  73 leiden         0.3.3         2020-02-04 CRAN (R 4.0.0)                      
##  74 lifecycle      0.2.0         2020-03-06 CRAN (R 4.0.0)                      
##  75 listenv        0.8.0         2019-12-05 CRAN (R 4.0.0)                      
##  76 lmtest         0.9-37        2019-04-30 CRAN (R 4.0.2)                      
##  77 lubridate      1.7.9         2020-07-11 Github (tidyverse/lubridate@de2ee09)
##  78 magrittr       1.5.0.9000    2020-07-27 Github (tidyverse/magrittr@0d14075) 
##  79 MASS           7.3-51.6      2020-04-26 CRAN (R 4.0.2)                      
##  80 Matrix         1.2-18        2019-11-27 CRAN (R 4.0.2)                      
##  81 MatrixModels   0.4-1         2015-08-22 CRAN (R 4.0.0)                      
##  82 memoise        1.1.0         2017-04-21 CRAN (R 4.0.0)                      
##  83 mgcv           1.8-31        2019-11-09 CRAN (R 4.0.2)                      
##  84 mime           0.9           2020-02-04 CRAN (R 4.0.0)                      
##  85 miniUI         0.1.1.1       2018-05-18 CRAN (R 4.0.0)                      
##  86 modelr         0.1.8.9000    2020-05-19 Github (tidyverse/modelr@16168e0)   
##  87 munsell        0.5.0         2018-06-12 CRAN (R 4.0.0)                      
##  88 mvtnorm        1.1-1         2020-06-09 CRAN (R 4.0.2)                      
##  89 nlme           3.1-148       2020-05-24 CRAN (R 4.0.2)                      
##  90 patchwork      1.0.1.9000    2020-06-22 Github (thomasp85/patchwork@82a5e03)
##  91 pbapply        1.4-2         2019-08-31 CRAN (R 4.0.0)                      
##  92 pillar         1.4.6.9000    2020-07-21 Github (r-lib/pillar@8aef8f2)       
##  93 pkgbuild       1.1.0.9000    2020-07-14 Github (r-lib/pkgbuild@3a87bd9)     
##  94 pkgconfig      2.0.3         2019-09-22 CRAN (R 4.0.0)                      
##  95 pkgload        1.1.0         2020-05-29 CRAN (R 4.0.0)                      
##  96 plotly         4.9.2.1       2020-04-04 CRAN (R 4.0.0)                      
##  97 plyr           1.8.6         2020-03-03 CRAN (R 4.0.0)                      
##  98 png            0.1-7         2013-12-03 CRAN (R 4.0.0)                      
##  99 polyclip       1.10-0        2019-03-14 CRAN (R 4.0.2)                      
## 100 prettyunits    1.1.1         2020-01-24 CRAN (R 4.0.2)                      
## 101 processx       3.4.3         2020-07-05 CRAN (R 4.0.2)                      
## 102 promises       1.1.1         2020-06-09 CRAN (R 4.0.0)                      
## 103 ps             1.3.3         2020-05-08 CRAN (R 4.0.0)                      
## 104 purrr          0.3.4.9000    2020-07-31 Github (tidyverse/purrr@c133378)    
## 105 R6             2.4.1.9000    2020-07-18 Github (r-lib/R6@1415d11)           
## 106 RANN           2.6.1         2019-01-08 CRAN (R 4.0.0)                      
## 107 RColorBrewer   1.1-2         2014-12-07 CRAN (R 4.0.0)                      
## 108 Rcpp           1.0.5         2020-07-06 CRAN (R 4.0.2)                      
## 109 RcppAnnoy      0.0.16        2020-03-08 CRAN (R 4.0.0)                      
## 110 readr          1.3.1.9000    2020-07-16 Github (tidyverse/readr@2ab51b2)    
## 111 readxl         1.3.1.9000    2020-05-28 Github (tidyverse/readxl@3815961)   
## 112 remotes        2.2.0.9000    2020-07-23 Github (r-lib/remotes@d7fe461)      
## 113 reprex         0.3.0         2019-05-16 CRAN (R 4.0.0)                      
## 114 reshape2       1.4.4         2020-04-09 CRAN (R 4.0.0)                      
## 115 reticulate     1.16          2020-05-27 CRAN (R 4.0.2)                      
## 116 rjson          0.2.20        2018-06-08 CRAN (R 4.0.0)                      
## 117 rlang          0.4.7.9000    2020-07-31 Github (r-lib/rlang@a144ac0)        
## 118 rmarkdown      2.3.3         2020-07-25 Github (rstudio/rmarkdown@204aa41)  
## 119 ROCR           1.0-11        2020-05-02 CRAN (R 4.0.0)                      
## 120 rpart          4.1-15        2019-04-12 CRAN (R 4.0.2)                      
## 121 rprojroot      1.3-2         2018-01-03 CRAN (R 4.0.0)                      
## 122 rstudioapi     0.11.0-9000   2020-07-31 Github (rstudio/rstudioapi@aa17630) 
## 123 rsvd           1.0.3         2020-02-17 CRAN (R 4.0.0)                      
## 124 Rtsne          0.16          2020-07-03 Github (jkrijthe/Rtsne@14b195f)     
## 125 Rttf2pt1       1.3.8         2020-01-10 CRAN (R 4.0.0)                      
## 126 rvest          0.3.6         2020-07-25 CRAN (R 4.0.2)                      
## 127 sass           0.2.0         2020-03-18 CRAN (R 4.0.2)                      
## 128 scales         1.1.1.9000    2020-07-24 Github (r-lib/scales@9ff4757)       
## 129 sctransform    0.2.1         2019-12-17 CRAN (R 4.0.0)                      
## 130 sessioninfo    1.1.1.9000    2020-07-18 Github (r-lib/sessioninfo@791705b)  
## 131 Seurat         3.2.0.9006    2020-08-01 Github (satijalab/seurat@a1f2f73)   
## 132 shape          1.4.4         2018-02-07 CRAN (R 4.0.0)                      
## 133 shiny          1.5.0.9001    2020-07-28 Github (rstudio/shiny@766b910)      
## 134 spatstat       1.64-1        2020-05-12 CRAN (R 4.0.2)                      
## 135 spatstat.data  1.4-3         2020-01-26 CRAN (R 4.0.2)                      
## 136 spatstat.utils 1.17-0        2020-02-07 CRAN (R 4.0.2)                      
## 137 stringi        1.4.6         2020-02-17 CRAN (R 4.0.0)                      
## 138 stringr        1.4.0.9000    2020-06-01 Github (tidyverse/stringr@f70c4ba)  
## 139 styler         1.3.2.9000    2020-07-25 Github (r-lib/styler@16d815e)       
## 140 survival       3.2-3         2020-06-13 CRAN (R 4.0.2)                      
## 141 tensor         1.5           2012-05-05 CRAN (R 4.0.2)                      
## 142 testthat       2.99.0.9000   2020-07-28 Github (r-lib/testthat@0af11cd)     
## 143 tibble         3.0.3.9000    2020-07-21 Github (tidyverse/tibble@b4eec19)   
## 144 tidyr          1.1.1.9000    2020-07-31 Github (tidyverse/tidyr@61e9209)    
## 145 tidyselect     1.1.0.9000    2020-07-11 Github (tidyverse/tidyselect@69fdc9…
## 146 tidyverse      1.3.0.9000    2020-06-01 Github (hadley/tidyverse@8a0bb99)   
## 147 usethis        1.6.1.9001    2020-08-01 Github (r-lib/usethis@00e0600)      
## 148 uwot           0.1.8.9000    2020-07-19 Github (jlmelville/uwot@13a198f)    
## 149 vctrs          0.3.2.9000    2020-07-23 Github (r-lib/vctrs@df8a659)        
## 150 viridisLite    0.3.0         2018-02-01 CRAN (R 4.0.0)                      
## 151 wesanderson    0.3.6.9000    2020-06-05 Github (karthik/wesanderson@d90700a)
## 152 withr          2.2.0         2020-04-20 CRAN (R 4.0.0)                      
## 153 xfun           0.16          2020-07-24 CRAN (R 4.0.2)                      
## 154 xml2           1.3.2         2020-04-23 CRAN (R 4.0.0)                      
## 155 xtable         1.8-4         2019-04-21 CRAN (R 4.0.0)                      
## 156 yaml           2.2.1         2020-02-01 CRAN (R 4.0.0)                      
## 157 yarrr          0.1.6         2020-07-23 Github (ndphillips/yarrr@e2e4488)   
## 158 zoo            1.8-8         2020-05-02 CRAN (R 4.0.0)