Load the libraries
library(Seurat)
## Loading required package: SeuratObject
## Loading required package: sp
## 'SeuratObject' was built under R 4.4.0 but the current version is
## 4.4.1; it is recomended that you reinstall 'SeuratObject' as the ABI
## for R may have changed
## 'SeuratObject' was built with package 'Matrix' 1.7.0 but the current
## version is 1.7.1; it is recomended that you reinstall 'SeuratObject' as
## the ABI for 'Matrix' may have changed
##
## Attaching package: 'SeuratObject'
## The following objects are masked from 'package:base':
##
## intersect, t
library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr 1.1.4 ✔ readr 2.1.5
## ✔ forcats 1.0.0 ✔ stringr 1.5.1
## ✔ ggplot2 3.5.1 ✔ tibble 3.2.1
## ✔ lubridate 1.9.3 ✔ tidyr 1.3.1
## ✔ purrr 1.0.2
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
Load dataset
ATH_root = readRDS("/Users/tranchau/Documents/GFP_2024/Data/S11_WER_GFP/Seurat_Obj_WER_wlabels.rds")
ATH_root
## An object of class Seurat
## 32834 features across 8572 samples within 1 assay
## Active assay: RNA (32834 features, 2000 variable features)
## 3 layers present: counts, data, scale.data
## 2 dimensional reductions calculated: pca, umap
Visualize data
DimPlot(ATH_root, reduction = "umap", label = TRUE)

Find marker genes
ATH_root_marker <- FindAllMarkers(ATH_root, only.pos = TRUE, min.pct = 0.5, logfc.threshold = 0.5) %>%
group_by(cluster) %>% arrange(cluster, desc(avg_log2FC))
## Calculating cluster MZ
## For a (much!) faster implementation of the Wilcoxon Rank Sum Test,
## (default method for FindMarkers) please install the presto package
## --------------------------------------------
## install.packages('devtools')
## devtools::install_github('immunogenomics/presto')
## --------------------------------------------
## After installation of presto, Seurat will automatically use the more
## efficient implementation (no further action necessary).
## This message will be shown once per session
## Calculating cluster Cortex
## Calculating cluster Stele
## Calculating cluster Hair
## Calculating cluster Rootcap
## Calculating cluster Endodermis
## Calculating cluster Nonhair
## Calculating cluster Phloem
## Calculating cluster Xylem
head(ATH_root_marker)
## # A tibble: 6 × 7
## # Groups: cluster [1]
## p_val avg_log2FC pct.1 pct.2 p_val_adj cluster gene
## <dbl> <dbl> <dbl> <dbl> <dbl> <fct> <chr>
## 1 4.15e- 3 1.82 0.47 0.566 1 e+ 0 MZ gene:ATMG00090
## 2 1.79e- 73 1.59 0.971 0.988 5.89e- 69 MZ gene:ATMG01390
## 3 1.62e-107 1.53 0.573 0.453 5.31e-103 MZ gene:AT4G15910
## 4 8.54e-121 1.52 0.557 0.41 2.80e-116 MZ gene:AT3G45030
## 5 9.93e-206 1.49 0.734 0.639 3.26e-201 MZ gene:AT3G07110
## 6 2.16e-171 1.48 0.687 0.581 7.09e-167 MZ gene:AT2G32060
table(ATH_root_marker$cluster)
##
## MZ Cortex Stele Hair Rootcap Endodermis Nonhair
## 194 217 150 229 625 116 347
## Phloem Xylem
## 241 249
Tutorial video