library(SingleCellExperiment)
library(ggplot2)
library(plotly)
library(dplyr)
library(colorspace)
library(dittoSeq)
library(tidyseurat)

seurat_obj <- tidyomicsWorkshop::seurat_obj

Question 1

What proportion of all cells are gamma-delta T cells? Use signature_score > 0.7 to identify gamma-delta T cells.

seurat_obj |>
  
  join_features(
    features = c("CD3D", "TRDC", "TRGC1", "TRGC2", "CD8A", "CD8B"),
    shape = "wide"
  ) |>
  
  mutate(signature_score =
           scales::rescale(CD3D + TRDC + TRGC1 + TRGC2, to=c(0,1)) -
           scales::rescale(CD8A + CD8B, to=c(0,1))
  ) |>

  mutate(gamma_delta = signature_score > 0.7) |>
  
  count(gamma_delta) |> 
  summarise(proportion = n/sum(n))

Question 2

There is a cluster of cells characterised by a low RNA output (nCount_RNA < 100). Identify the cell composition (cell_type) of that cluster.

seurat_obj |>
    filter(nCount_RNA < 100) %>% 
    count(cell_type)