Show how you would use the FetchData() function to generate a dataframe of fullumapsketch_1, fullumapsketch_2 and orig.ident values for each cell.
# Use FetchData to pull selected information from the Seurat objectFetchData(seurat_processed,vars =c("fullumapsketch_1", "fullumapsketch_2", "orig.ident")) %>%head()
---title: "Seurat Cheatsheet Answer Key"author: - Noor Sohail - Will Gammerdingerdate: "2025-12-07"---```{r}#| label: load_data#| echo: false# Load librarieslibrary(Seurat)library(tidyverse)# Load dataseurat_processed <- qs2::qs_read("intermediate/08_seurat_processed.qs")```# Exercise 1**What are the last 5 cells barcodes and the last 5 genes in the seurat object.**```{r}#| label: print_final_genes_cells# Show last bin barcodesCells(seurat_processed) %>%tail()# Show last bin barcodescolnames(seurat_processed) %>%tail()# Show the last genes namesFeatures(seurat_processed) %>%tail()# Show the last genes namesrownames(seurat_processed) %>%tail()```# Exercise 2**What are the last 5 identities for the bins in the Seurat object?**```{r}#| label: rename_idents#| echo: false# Rename all identitiesseurat_processed <-RenameIdents(object = seurat_processed, "1"="Tumor","2"="B cells","3"="Intestinal epithelial cells")# These new celltype values are only stored in the idents# Good practice is to store these changes in a columnseurat_processed$celltype <-Idents(seurat_processed)``````{r}#| label: print_final_idents# Print final five identsIdents(seurat_processed) %>%tail()```# Exercise 3**What are the 5 least variable genes in the Seurat object?**```{r}#| label: set_var_features#| echo: false# Get list of all variable genes# Remove variable genes that start with MT-var_genes <-VariableFeatures(seurat_processed)var_genes <- var_genes[!startsWith(var_genes, "MT-")]# Now we set our vector of gene names back to VariableFeatures()VariableFeatures(seurat_processed) <- var_genes``````{r}#| label: show_var_features# Show five least variable featuresVariableFeatures(seurat_processed) %>%tail()```# Exercise 4**What are the dimensions for each assay in the Seurat object?**```{r}#| label: show_dim_assays# Obtain the number of bins and genes for the Spatial.008um assaydim(seurat_processed[["Spatial.008um"]])# Obtain the number of bins and genes for the sketch assaydim(seurat_processed[["sketch"]])```# Exercise 5**Show the code to get the entire sketch log-normalized (`data`) count matrix.**```{r}#| label: get_counts_mtx#| eval: false# Obtain sketch count matrix for normalized count matrixLayerData(seurat_processed,assay ="sketch",layer ="data")```# Exercise 6**Show how you would use the `FetchData()` function to generate a dataframe of fullumapsketch_1, fullumapsketch_2 and orig.ident values for each cell.**```{r}#| label: fetchdata_exercise# Use FetchData to pull selected information from the Seurat objectFetchData(seurat_processed,vars =c("fullumapsketch_1", "fullumapsketch_2", "orig.ident")) %>%head()```