From 2889f55c05022edbfd6daa4c996aa6628795c6ea Mon Sep 17 00:00:00 2001 From: huangyaqing-123 Date: Fri, 25 Jul 2025 13:39:55 -0400 Subject: [PATCH] vignette updates --- .Rbuildignore | 2 ++ .gitignore | 3 ++ DESCRIPTION | 4 ++- vignettes/.gitignore | 2 ++ vignettes/examples.Rmd | 69 ++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 79 insertions(+), 1 deletion(-) create mode 100644 vignettes/.gitignore create mode 100644 vignettes/examples.Rmd diff --git a/.Rbuildignore b/.Rbuildignore index e13c405..f2ab003 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -1,3 +1,5 @@ ^.*\.Rproj$ ^\.Rproj\.user$ ^LICENSE\.md$ +^doc$ +^Meta$ diff --git a/.gitignore b/.gitignore index d95edeb..09f5760 100644 --- a/.gitignore +++ b/.gitignore @@ -50,3 +50,6 @@ po/*~ # RStudio Connect folder rsconnect/ +inst/doc +/doc/ +/Meta/ diff --git a/DESCRIPTION b/DESCRIPTION index 6bf7b4a..d65ba52 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -27,7 +27,9 @@ Imports: tidyverse, purrr Suggests: + knitr, + rmarkdown, testthat (>= 3.0.0) Config/testthat/edition: 3 LazyData: true - +VignetteBuilder: knitr diff --git a/vignettes/.gitignore b/vignettes/.gitignore new file mode 100644 index 0000000..097b241 --- /dev/null +++ b/vignettes/.gitignore @@ -0,0 +1,2 @@ +*.html +*.R diff --git a/vignettes/examples.Rmd b/vignettes/examples.Rmd new file mode 100644 index 0000000..c0c4541 --- /dev/null +++ b/vignettes/examples.Rmd @@ -0,0 +1,69 @@ +--- +title: "examples" +output: rmarkdown::html_vignette +vignette: > + %\VignetteIndexEntry{examples} + %\VignetteEngine{knitr::rmarkdown} + %\VignetteEncoding{UTF-8} +--- + +```{r, include = FALSE} +knitr::opts_chunk$set( + collapse = TRUE, + comment = "#>" +) +``` + +## Overview +This vignette demonstrates how to use the PathwayEmbed package to compute and visualize pathway activation using single-cell transcriptomic data. We use the example dataset fake_test_object included with the package. + +## Load Package and Example Data +```{r setup} +library(PathwayEmbed) +# Load the example Seurat object included in the package +data(fake_test_object) +``` + +## Compute Pathway Activation +```{r} +# Calculate pathway activation using MDS +# Default batch.size is set to 1000 +mds_results <- ComputeCellData( + fake_test_object, + pathway = "Wnt", + distance.method = "manhattan" +) +``` + +## Prepare Data for Plotting +```{r} +# Format MDS results and metadata for plotting +plot_data <- PreparePlotData( + fake_test_object, + mds_results, + group = "genotype" +) +``` + +## Visualize Pathway Activation +```{r} +# Visualize 2D MDS embedding colored by genotype +PlotPathway( + to.plot = plot_data, + pathway = "Wnt", + group = "genotype", + color = c("#ae282c", "#2066a8") +) +``` + +## Calculate Group-wise Activation Percentage (Optional) +```{r} +# Calculate % of cells per group with high pathway activation +CalculatePercentage( + to.plot = plot_data, + group_var = "genotype" +) +``` + +--- +