library(Seurat)
library(ggplot2)
library(plotly)
library(dplyr)
library(colorspace)
library(SeuratWrappers)
library(dittoSeq)

Question 1

What is the proportion of gamma-delta T cells, among all cells?

seurat_obj |>


  join_features(
    features = c("CD3D", "TRDC", "TRGC1", "TRGC2", "CD8A", "CD8B"),
    shape = "wide",
    assay = "SCT"

  ) |>

  mutate(signature_score =
           scales::rescale(CD3D + TRDC + TRGC1+ TRGC2, to=c(0,1)) -
           scales::rescale(CD8A + CD8B, to=c(0,1))
  ) |>

  mutate(gate = tidygate::gate_int(
    UMAP_1, UMAP_2, 
    .size = 0.1, 
    .color =signature_score
  )) |>

  count(gate) %>% 
  summarise(proportion = n/sum(n))

Question 2

There is a cluster of cells characterised by a low RNA output (nCount_RNA). Use tidygate to identify the cell composition (curated_cell_type) of that cluster.

seurat_obj |>

    mutate(gate = tidygate::gate_int(
        UMAP_1, UMAP_2, 
        .size = 0.1, 
        .color =nCount_RNA 
    )) %>% 

    filter(gate==1) %>% 
    count(curated_cell_type)


tidytranscriptomics-workshops/iscb2022_tidytranscriptomics documentation built on Jan. 13, 2023, 12:52 a.m.