From 83077cd79c31edebddb17a8e1aead4085de66f0e Mon Sep 17 00:00:00 2001 From: RihaoQu Date: Wed, 6 Dec 2023 04:23:30 -0500 Subject: [PATCH] add simulation functions --- DESCRIPTION | 3 +-- NAMESPACE | 4 +++ man/AddGeneBinScore.Rd | 4 --- man/CoarseGrain.Rd | 4 --- man/ExtractGeneTrajectory.Rd | 4 --- man/GetGeneEmbedding.Rd | 8 ++---- man/GetGenePseudoorder.Rd | 8 ++---- man/GetGraphDistance.Rd | 4 --- man/LoadGeneDistMat.Rd | 3 --- man/RunDM.Rd | 4 --- man/coarse.grain.Rd | 4 --- man/diffusion.map.Rd | 4 --- man/get.RW.matrix.Rd | 4 --- man/simulate_bifurcation.Rd | 49 ++++++++++++++++++++++++++++++++++++ man/simulate_cyclic.Rd | 47 ++++++++++++++++++++++++++++++++++ man/simulate_cylinder.Rd | 49 ++++++++++++++++++++++++++++++++++++ man/simulate_linear.Rd | 49 ++++++++++++++++++++++++++++++++++++ 17 files changed, 203 insertions(+), 49 deletions(-) create mode 100644 man/simulate_bifurcation.Rd create mode 100644 man/simulate_cyclic.Rd create mode 100644 man/simulate_cylinder.Rd create mode 100644 man/simulate_linear.Rd diff --git a/DESCRIPTION b/DESCRIPTION index 646158b..0655a6b 100755 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -13,7 +13,7 @@ License: `use_mit_license()`, `use_gpl3_license()` or friends to pick a Encoding: UTF-8 LazyData: true Roxygen: list(markdown = TRUE) -RoxygenNote: 7.1.1 +RoxygenNote: 7.2.3 Depends: R (>= 4.0) Imports: @@ -25,4 +25,3 @@ Imports: biclust, stats, Matrix (>= 1.5) - diff --git a/NAMESPACE b/NAMESPACE index 6d84bbc..85f23e6 100755 --- a/NAMESPACE +++ b/NAMESPACE @@ -11,3 +11,7 @@ export(RunDM) export(coarse.grain) export(diffusion.map) export(get.RW.matrix) +export(simulate_bifurcation) +export(simulate_cyclic) +export(simulate_cylinder) +export(simulate_linear) diff --git a/man/AddGeneBinScore.Rd b/man/AddGeneBinScore.Rd index 8265f39..78846dd 100644 --- a/man/AddGeneBinScore.Rd +++ b/man/AddGeneBinScore.Rd @@ -38,7 +38,3 @@ Seurat object with gene bin score added in the metadata \description{ Add gene bin score } -\examples{ - - -} diff --git a/man/CoarseGrain.Rd b/man/CoarseGrain.Rd index 351a642..17fabe8 100644 --- a/man/CoarseGrain.Rd +++ b/man/CoarseGrain.Rd @@ -39,7 +39,3 @@ Returns a list \description{ Coarse-graining } -\examples{ - - -} diff --git a/man/ExtractGeneTrajectory.Rd b/man/ExtractGeneTrajectory.Rd index a90d526..6b9a687 100644 --- a/man/ExtractGeneTrajectory.Rd +++ b/man/ExtractGeneTrajectory.Rd @@ -35,7 +35,3 @@ A data frame indicating gene trajectories and gene ordering along each trajector \description{ Extract gene trajectories } -\examples{ - - -} diff --git a/man/GetGeneEmbedding.Rd b/man/GetGeneEmbedding.Rd index f825604..f47370b 100644 --- a/man/GetGeneEmbedding.Rd +++ b/man/GetGeneEmbedding.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/GetGeneEmbedding.R \name{GetGeneEmbedding} \alias{GetGeneEmbedding} -\title{Run Diffusion Map on the gene-gene Wasserstein distance matrix} +\title{Get the diffusion embedding of genes based on the gene-gene Wasserstein distance matrix} \usage{ GetGeneEmbedding(dist.mat, K = 10, sigma = NULL, nEV = 30, t = 1) } @@ -26,9 +26,5 @@ List with the following elements: } } \description{ -Run Diffusion Map on the gene-gene Wasserstein distance matrix -} -\examples{ - - +Get the diffusion embedding of genes based on the gene-gene Wasserstein distance matrix } diff --git a/man/GetGenePseudoorder.Rd b/man/GetGenePseudoorder.Rd index 28a7154..85c0970 100644 --- a/man/GetGenePseudoorder.Rd +++ b/man/GetGenePseudoorder.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/GetGenePseudoorder.R \name{GetGenePseudoorder} \alias{GetGenePseudoorder} -\title{Extract gene trajectories} +\title{Order genes along a given trajectory} \usage{ GetGenePseudoorder(dist.mat, subset, max.id = NULL) } @@ -17,9 +17,5 @@ GetGenePseudoorder(dist.mat, subset, max.id = NULL) Pseudoorder of genes along a given trajectory } \description{ -Extract gene trajectories -} -\examples{ - - +Order genes along a given trajectory } diff --git a/man/GetGraphDistance.Rd b/man/GetGraphDistance.Rd index 7c94ccf..b1d74e3 100644 --- a/man/GetGraphDistance.Rd +++ b/man/GetGraphDistance.Rd @@ -21,7 +21,3 @@ Returns a cell-cell graph distance matrix \description{ Run Diffusion Map on a Seurat object } -\examples{ - - -} diff --git a/man/LoadGeneDistMat.Rd b/man/LoadGeneDistMat.Rd index a91c06e..036a7db 100644 --- a/man/LoadGeneDistMat.Rd +++ b/man/LoadGeneDistMat.Rd @@ -17,6 +17,3 @@ Gene-gene Wasserstein matrix \description{ Load gene-gene Wasserstein matrix } -\examples{ - -} diff --git a/man/RunDM.Rd b/man/RunDM.Rd index a14b404..9754b46 100644 --- a/man/RunDM.Rd +++ b/man/RunDM.Rd @@ -41,7 +41,3 @@ Returns a Seurat object containing a Diffusion Map representation \description{ Run Diffusion Map on a Seurat object } -\examples{ - - -} diff --git a/man/coarse.grain.Rd b/man/coarse.grain.Rd index 1f001d2..144eeb8 100644 --- a/man/coarse.grain.Rd +++ b/man/coarse.grain.Rd @@ -29,7 +29,3 @@ Returns a list \description{ Base function called by CoarseGrain } -\examples{ - - -} diff --git a/man/diffusion.map.Rd b/man/diffusion.map.Rd index 9741cea..289c3d7 100644 --- a/man/diffusion.map.Rd +++ b/man/diffusion.map.Rd @@ -28,7 +28,3 @@ List with the following elements: \description{ Run Diffusion Map on a precomputed distance matrix } -\examples{ - - -} diff --git a/man/get.RW.matrix.Rd b/man/get.RW.matrix.Rd index 5b790a7..4ff7d82 100644 --- a/man/get.RW.matrix.Rd +++ b/man/get.RW.matrix.Rd @@ -17,7 +17,3 @@ Random-walk matrix \description{ Convert a distance matrix into a random-walk matrix based on adaptive Gaussian kernel } -\examples{ - - -} diff --git a/man/simulate_bifurcation.Rd b/man/simulate_bifurcation.Rd new file mode 100644 index 0000000..5e8e26a --- /dev/null +++ b/man/simulate_bifurcation.Rd @@ -0,0 +1,49 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/simulate_bifurcation.R +\name{simulate_bifurcation} +\alias{simulate_bifurcation} +\title{Simulate bifurcating gene process} +\usage{ +simulate_bifurcation( + N_cells = 5 * c(100, 50, 50), + N_genes = 5 * c(100, 50, 50), + model = "poisson", + meanlog = 0, + sdlog = 0.25, + scale = 25, + seed = 1, + maxT = 15, + sort = TRUE, + sparsity = 0.1, + theta = 10 +) +} +\arguments{ +\item{N_cells}{integer vector; Number of cells in the parent process and two daughter processes} + +\item{N_genes}{integer vector; Number of genes associated with the parent process and two daughter processes} + +\item{model}{character; Count model ("poisson" or "negbin")} + +\item{meanlog}{numeric; Mean of log normal distribution} + +\item{sdlog}{numeric; Standard deviation of log normal distribution} + +\item{scale}{numeric; Scale of UMI counts} + +\item{seed}{integer; Random seed} + +\item{maxT}{numeric; Maximum cell pseudotime} + +\item{sort}{boolean; Whether to sort genes based on their peak times} + +\item{sparsity}{numeric; Sparsity of count matrix} + +\item{theta}{numeric; Dipersion parameter for negative binomial model} +} +\value{ +Returns a gene-by-cell count matrix +} +\description{ +Simulate bifurcating gene process +} diff --git a/man/simulate_cyclic.Rd b/man/simulate_cyclic.Rd new file mode 100644 index 0000000..477cce1 --- /dev/null +++ b/man/simulate_cyclic.Rd @@ -0,0 +1,47 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/simulate_cyclic.R +\name{simulate_cyclic} +\alias{simulate_cyclic} +\title{Simulate cyclic gene process} +\usage{ +simulate_cyclic( + N_cells = 1000, + N_genes = 500, + model = "poisson", + meanlog = 0, + sdlog = 0.25, + scale_l = 1, + scale = 25, + seed = 1, + maxT = 15, + sparsity = NULL, + theta = 10 +) +} +\arguments{ +\item{N_cells}{integer; Number of cells} + +\item{N_genes}{integer; Number of genes} + +\item{model}{character; Count model ("poisson" or "negbin")} + +\item{meanlog}{numeric; Mean of log normal distribution} + +\item{sdlog}{numeric; Standard deviation of log normal distribution} + +\item{scale}{numeric; Scale of UMI counts} + +\item{seed}{integer; Random seed} + +\item{maxT}{numeric; Maximum cell pseudotime} + +\item{sparsity}{numeric; Sparsity of count matrix} + +\item{theta}{numeric; Dipersion parameter for negative binomial model} +} +\value{ +Returns a gene-by-cell count matrix +} +\description{ +Simulate cyclic gene process +} diff --git a/man/simulate_cylinder.Rd b/man/simulate_cylinder.Rd new file mode 100644 index 0000000..2a53bb8 --- /dev/null +++ b/man/simulate_cylinder.Rd @@ -0,0 +1,49 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/simulate_cylinder.R +\name{simulate_cylinder} +\alias{simulate_cylinder} +\title{Simulate concurrent independent linear and cyclic gene processes} +\usage{ +simulate_cylinder( + N_cells = 5000, + N_genes = rep(500, 2), + model = "poisson", + meanlog = 0, + sdlog = 0.25, + scale = 25, + seed = 1, + maxT = 15, + sort = TRUE, + sparsity = 0.1, + theta = 10 +) +} +\arguments{ +\item{N_cells}{integer; Number of cells} + +\item{N_genes}{integer vector; Number of genes associated with the linear and cyclic processes} + +\item{model}{character; Count model ("poisson" or "negbin")} + +\item{meanlog}{numeric; Mean of log normal distribution} + +\item{sdlog}{numeric; Standard deviation of log normal distribution} + +\item{scale}{numeric; Scale of UMI counts} + +\item{seed}{integer; Random seed} + +\item{maxT}{numeric; Maximum cell pseudotime} + +\item{sort}{boolean; Whether to sort genes based on their peak times} + +\item{sparsity}{numeric; Sparsity of count matrix} + +\item{theta}{numeric; Dipersion parameter for negative binomial model} +} +\value{ +Returns a gene-by-cell count matrix +} +\description{ +Simulate concurrent independent linear and cyclic gene processes +} diff --git a/man/simulate_linear.Rd b/man/simulate_linear.Rd new file mode 100644 index 0000000..a00aebb --- /dev/null +++ b/man/simulate_linear.Rd @@ -0,0 +1,49 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/simulate_linear.R +\name{simulate_linear} +\alias{simulate_linear} +\title{Simulate linear gene process} +\usage{ +simulate_linear( + N_cells = 1000, + N_genes = 200, + model = "poisson", + meanlog = 0, + sdlog = 0.25, + scale = 25, + seed = 1, + maxT = 15, + sort = TRUE, + sparsity = NULL, + theta = 10 +) +} +\arguments{ +\item{N_cells}{integer; Number of cells} + +\item{N_genes}{integer; Number of genes} + +\item{model}{character; Count model ("poisson" or "negbin")} + +\item{meanlog}{numeric; Mean of log normal distribution} + +\item{sdlog}{numeric; Standard deviation of log normal distribution} + +\item{scale}{numeric; Scale of UMI counts} + +\item{seed}{integer; Random seed} + +\item{maxT}{numeric; Maximum cell pseudotime} + +\item{sort}{boolean; Whether to sort genes based on their peak times} + +\item{sparsity}{numeric; Sparsity of count matrix} + +\item{theta}{numeric; Dipersion parameter for negative binomial model} +} +\value{ +Returns a gene-by-cell count matrix +} +\description{ +Simulate linear gene process +}