### Complete SeuratData Workflow Example Source: https://context7.com/satijalab/seurat-data/llms.txt Demonstrates a typical single-cell analysis workflow using SeuratData to install, load, and process datasets. ```r library(SeuratData) library(Seurat) library(ggplot2) # Check available datasets and install what we need AvailableData() InstallData("pbmc3k") # Load the dataset pbmc3k <- LoadData("pbmc3k") ``` -------------------------------- ### Install and Load Datasets Source: https://github.com/satijalab/seurat-data/blob/main/README.md Installs a specific dataset package and loads it into the R workspace for immediate use. ```R InstallData("pbmc3k") data("pbmc3k") ``` -------------------------------- ### Install SeuratData Package Source: https://github.com/satijalab/seurat-data/blob/main/README.md Installs the SeuratData package from the GitHub repository using the devtools library. ```R devtools::install_github('satijalab/seurat-data') ``` -------------------------------- ### Install Seurat Datasets (R) Source: https://context7.com/satijalab/seurat-data/llms.txt Installs one or more specified datasets from the SeuratData repository. Datasets can be referenced by their common name (e.g., 'pbmc3k') or their full package name (e.g., 'pbmc3k.SeuratData'). The function automatically attaches the dataset package after installation, making it ready for use. It supports options like forcing reinstallation and passing arguments to underlying R installation functions. ```r library(SeuratData) # Install a single dataset InstallData("pbmc3k") # Install multiple datasets at once InstallData(c("pbmc3k", "ifnb", "panc8")) # Force reinstall of an already installed dataset InstallData("pbmc3k", force.reinstall = TRUE) # Install using the full package name InstallData("cbmc.SeuratData") # Install with additional parameters passed to install.packages InstallData("hcabm40k", quiet = TRUE) # After installation, datasets are automatically attached # Check that they're loaded search() #> ... "package:pbmc3k.SeuratData" ... ``` -------------------------------- ### List Installed Seurat Datasets (R) Source: https://context7.com/satijalab/seurat-data/llms.txt Returns a dataframe listing only the Seurat datasets that are currently installed on the local system. This is useful for quickly checking available local datasets without querying the remote repository. It includes dataset names, versions, and installation status. ```r library(SeuratData) # Get list of installed datasets installed <- InstalledData() # View installed datasets and their versions print(installed) # Get dataset names as a vector dataset_names <- installed$Dataset print(dataset_names) # Check if a specific dataset is installed is_pbmc3k_installed <- "pbmc3k" %in% installed$Dataset print(is_pbmc3k_installed) ``` -------------------------------- ### R Package DESCRIPTION Example for CBMC Dataset Source: https://github.com/satijalab/seurat-data/wiki/Datasets This snippet shows the structure of a DESCRIPTION file for an R package used by SeuratData. It includes essential metadata like package name, version, author, license, and dependencies. ```R Package: cbmc.SeuratData Date: 2019-07-17 Type: Package Title: scRNAseq and 13-antibody sequencing of CBMCs Version: 3.0.0 Authors@R: c( person(given = 'Satija', family = 'Lab', email = 'nygcSatijalab@nygenome.org', role = c('aut', 'cre')) ) Description: species: human system: CBMC (cord blood) ncells: 8617 tech: CITE-seq default.dataset: raw License: CC BY 4.0 Encoding: UTF-8 LazyData: true RoxygenNote: 6.1.1 Suggests: Seurat (>= 3.0.0) ``` -------------------------------- ### List Available Seurat Datasets (R) Source: https://context7.com/satijalab/seurat-data/llms.txt Retrieves a manifest of all datasets available in the SeuratData remote repository. The output is a dataframe containing dataset names, versions, installation status, and metadata such as species, system, cell count, and sequencing technology. It also shows whether the dataset is currently installed. ```r library(SeuratData) # Get a manifest of all available datasets available <- AvailableData() # View the manifest print(available) # Filter to see only installed datasets installed_only <- available[available$Installed == TRUE, ] # Filter by species human_datasets <- available[available$species == "human", ] # Filter by technology cite_seq_data <- available[grepl("CITE-seq", available$tech), ] ``` -------------------------------- ### UpdateData Source: https://context7.com/satijalab/seurat-data/llms.txt Updates installed dataset packages to their latest versions from the repository. ```APIDOC ## UpdateData ### Description Updates all installed dataset packages to their latest versions from the SeuratData repository. ### Method Function Call ### Parameters #### Arguments - **ask** (boolean) - Optional - Whether to prompt for confirmation. - **lib.loc** (string) - Optional - Library location to update. ``` -------------------------------- ### Get Citation Information for Seurat Data Package (R) Source: https://context7.com/satijalab/seurat-data/llms.txt This R command retrieves citation information for a specific Seurat data package, 'pbmc3k.SeuratData'. The citation() function is used to obtain the recommended text for acknowledging the data source in publications or reports. This ensures proper attribution and reproducibility by referencing the exact dataset used. ```R citation("pbmc3k.SeuratData") ``` -------------------------------- ### Update Seurat Datasets Source: https://context7.com/satijalab/seurat-data/llms.txt Updates all installed dataset packages to their latest versions from the SeuratData repository. This function wraps the base R `update.packages` function, ensuring correct repository settings. ```r library(SeuratData) # Update all installed datasets interactively (prompts for each) UpdateData() # Update all datasets without prompting UpdateData(ask = FALSE) # Update datasets in a specific library location UpdateData(ask = FALSE, lib.loc = "/custom/library/path") # Check for available updates first installed <- InstalledData() available <- AvailableData() # Compare versions to see what needs updating needs_update <- installed$InstalledVersion < available[rownames(installed), "Version"] datasets_to_update <- installed$Dataset[needs_update] print(datasets_to_update) ``` -------------------------------- ### Accessing Dataset Help Pages in R Source: https://github.com/satijalab/seurat-data/blob/main/README.md Demonstrates how to use the `help()` function in R to access documentation for specific SeuratData datasets, such as 'pbmc3k' and 'ifnb'. This allows users to view detailed information and command lists associated with each dataset. ```R > ?pbmc3k > ?ifnb ``` -------------------------------- ### List Available Datasets Source: https://github.com/satijalab/seurat-data/blob/main/README.md Displays a manifest of all datasets available in the repository, including metadata such as species, cell counts, and technology used. ```R AvailableData() ``` -------------------------------- ### Configure SeuratData Package Options Source: https://context7.com/satijalab/seurat-data/llms.txt Sets and retrieves configuration options for the SeuratData package, including repository location, manifest caching, and Windows roaming profile behavior. ```r library(SeuratData) # View current package options getOption("SeuratData.repo.use") getOption("SeuratData.manifest.cache") getOption("SeuratData.roaming") # Enable manifest caching for faster subsequent lookups options(SeuratData.manifest.cache = TRUE) # For Windows domain users: enable roaming profile directory options(SeuratData.roaming = TRUE) # Custom repository (advanced usage - not recommended) options(SeuratData.repo.use = "http://custom.repo.url/") # Suppress startup messages when loading the package suppressPackageStartupMessages(library(SeuratData)) ``` -------------------------------- ### Basic Seurat Workflow for Single-Cell Data Analysis (R) Source: https://context7.com/satijalab/seurat-data/llms.txt This snippet demonstrates a typical workflow for analyzing single-cell RNA-seq data using the Seurat package in R. It includes steps for data normalization, identifying highly variable features, scaling the data, performing Principal Component Analysis (PCA), finding nearest neighbors, clustering cells, and running Uniform Manifold Approximation and Projection (UMAP) for visualization. The code assumes a Seurat object named 'pbmc3k' is already loaded. ```R pbmc3k <- NormalizeData(pbmc3k) pbmc3k <- FindVariableFeatures(pbmc3k, selection.method = "vst", nfeatures = 2000) pbmc3k <- ScaleData(pbmc3k) pbmc3k <- RunPCA(pbmc3k) pbmc3k <- FindNeighbors(pbmc3k, dims = 1:10) pbmc3k <- FindClusters(pbmc3k, resolution = 0.5) pbmc3k <- RunUMAP(pbmc3k, dims = 1:10) ``` -------------------------------- ### Access Seurat Dataset Documentation (R) Source: https://context7.com/satijalab/seurat-data/llms.txt This R command accesses the documentation for a specific dataset within the Seurat ecosystem. The question mark (?) operator is a standard R function to retrieve help pages for objects, functions, or datasets. In this case, it would display information about the 'pbmc3k' dataset, including its origin, characteristics, and how it was processed. ```R ?pbmc3k ``` -------------------------------- ### Load Seurat Datasets Source: https://context7.com/satijalab/seurat-data/llms.txt Loads specified datasets into memory as Seurat objects. Supports default datasets and alternative types like 'raw' or 'azimuth'. Automatically updates the Seurat object and converts assays to Assay5 format if applicable. ```r library(SeuratData) library(Seurat) # Install and load PBMC 3k dataset InstallData("pbmc3k") pbmc3k <- LoadData("pbmc3k") # View the loaded Seurat object print(pbmc3k) # Alternative: load using base R data function after installation data("pbmc3k") # Load a specific type of dataset (if available in manifest) # Options include: 'default', 'raw', 'azimuth' pbmc_raw <- LoadData("pbmc3k", type = "raw") # Load dataset and immediately start analysis InstallData("ifnb") ifnb <- LoadData("ifnb") # View cell metadata head(ifnb@meta.data) # Check available assays Assays(ifnb) # Load CBMC dataset with CITE-seq data (contains RNA and ADT assays) InstallData("cbmc") cbmc <- LoadData("cbmc") Assays(cbmc) ``` -------------------------------- ### LoadReference Source: https://context7.com/satijalab/seurat-data/llms.txt Loads Azimuth reference files (ref.Rds and idx.annoy) for cell type mapping. ```APIDOC ## LoadReference ### Description Loads Azimuth reference files from a specified path. Returns a list containing both a mapping reference object and a plotting reference object. ### Method Function Call ### Parameters #### Arguments - **path** (string) - Required - Path to the directory containing ref.Rds and idx.annoy. ### Response - **List** (object) - Contains 'map' (mapping reference) and 'plot' (plotting reference). ``` -------------------------------- ### Load Azimuth References Source: https://context7.com/satijalab/seurat-data/llms.txt Loads Azimuth reference files (ref.Rds and idx.annoy) from a specified path for cell type mapping. It returns a list containing both a mapping reference object and a plotting reference object. ```r library(SeuratData) library(Seurat) library(Azimuth) # Load a dataset with Azimuth reference InstallData("pbmcref") # If available as a reference dataset # Load reference from a local path # Path must contain: ref.Rds (reference Seurat object) and idx.annoy (annoy index) reference <- LoadReference("/path/to/reference") # Access the mapping reference (downsampled for efficient mapping) map_ref <- reference$map print(map_ref) # Access the plotting reference (for visualization) plot_ref <- reference$plot print(plot_ref) # Alternative: Load azimuth reference through LoadData # Some datasets support loading as azimuth type ref <- LoadData("some_dataset", type = "azimuth") # Use the reference for cell type annotation query <- LoadData("pbmc3k") query <- RunAzimuth(query, reference = reference$map) ``` -------------------------------- ### LoadData Source: https://context7.com/satijalab/seurat-data/llms.txt Loads a dataset into memory as a Seurat object. Supports loading the default dataset or alternative types like 'raw' or 'azimuth'. ```APIDOC ## LoadData ### Description Loads a dataset into memory as a Seurat object. Automatically updates the object to the current version. ### Method Function Call ### Parameters #### Arguments - **ds** (string) - Required - The name of the dataset to load. - **type** (string) - Optional - The type of data to load (e.g., 'default', 'raw', 'azimuth'). ### Request Example LoadData("pbmc3k", type = "raw") ### Response - **Object** (Seurat) - A loaded Seurat object containing features and samples. ``` -------------------------------- ### Retrieving Package Citation Information in R Source: https://github.com/satijalab/seurat-data/blob/main/README.md Shows how to use the `citation()` function in R to obtain citation details for an R package, specifically 'cbmc.SeuratData'. This includes the citation text and a BibTeX entry for LaTeX users, which is essential for academic referencing. ```R > citation('cbmc.SeuratData') To cite the CBMC dataset, please use: Stoeckius et al. Simultaneous epitope and transcriptome measurement in single cells. Nature Methods (2017) A BibTeX entry for LaTeX users is @Article{ author = {Marlon Stoeckius and Christoph Hafemeister and William Stephenson and Brian Houck-Loomis and Pratip K Chattopadhyay and Harold Swerdlow and Rahul Satija and Peter Smibert}, title = {Simultaneous epitope and transcriptome measurement in single cells}, journal = {Nature Methods}, year = {2017}, doi = {10.1038/nmeth.4380}, url = {https://www.nature.com/articles/nmeth.4380}, } ``` -------------------------------- ### RemoveData Source: https://context7.com/satijalab/seurat-data/llms.txt Uninstalls a dataset package from the local R library and detaches it if loaded. ```APIDOC ## RemoveData ### Description Uninstalls a dataset package from the local R library. Automatically detaches the package if it is currently loaded. ### Method Function Call ### Parameters #### Arguments - **ds** (string/vector) - Required - Name or vector of names of datasets to remove. - **lib** (string) - Optional - Custom library path for removal. ### Request Example RemoveData("pbmc3k") ### Response - **Status** (boolean) - Returns TRUE if the package was successfully removed. ``` -------------------------------- ### Remove Seurat Datasets Source: https://context7.com/satijalab/seurat-data/llms.txt Uninstalls specified dataset packages from the local R library. The function automatically detaches the package if it is currently loaded before removal. ```r library(SeuratData) # Remove a single dataset RemoveData("pbmc3k") # Remove multiple datasets RemoveData(c("ifnb", "panc8")) # Remove using full package name RemoveData("cbmc.SeuratData") # Specify a custom library location for removal RemoveData("pbmc3k", lib = "/custom/library/path") # Verify removal installed <- InstalledData() "pbmc3k" %in% installed$Dataset ``` -------------------------------- ### Visualize UMAP Results in Seurat (R) Source: https://context7.com/satijalab/seurat-data/llms.txt This R code snippet visualizes the results of the UMAP dimensionality reduction performed on a Seurat object. The DimPlot function creates a scatter plot where cells are colored based on their cluster assignments or other metadata, allowing for visual inspection of cell populations and their relationships in the reduced-dimensional space. The 'reduction = "umap"' argument specifies that the UMAP coordinates should be used for plotting. ```R DimPlot(pbmc3k, reduction = "umap") ``` -------------------------------- ### Clean Up Seurat Data Object (R) Source: https://context7.com/satijalab/seurat-data/llms.txt This R command removes a specified Seurat object from the current R session's memory. The RemoveData function is used to free up memory, which is particularly useful when working with large datasets or multiple objects to manage computational resources efficiently. It takes the name of the object to be removed as an argument. ```R RemoveData("pbmc3k") ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.