Browse code

Add documentation for the S4 methods

Milan Malfait authored on 09/03/2021 10:36:11
Showing 2 changed files

... ...
@@ -1,4 +1,63 @@
1
-
1
+#' Find spatially variable genes with **SpatialDE**
2
+#'
3
+#' Identify genes that significantly depend on spatial coordinates with the
4
+#' [**SpatialDE**](https://github.com/Teichlab/SpatialDE) Python package.
5
+#'
6
+#' @param x A numeric `matrix` of counts where genes are rows and cells are columns.
7
+#'
8
+#'    Alternatively, a \linkS4class{SpatialExperiment} object.
9
+#'
10
+#' @param ... For the generic, arguments to pass to specific methods.
11
+#' @param coordinates A `data.frame` with sample coordinates. Each row is a
12
+#'   sample, the columns with coordinates should be named 'x' and 'y'.
13
+#'
14
+#'   For the *SpatialExperiment* method, coordinates are taken from
15
+#'   `spatialCoords(x)`.
16
+#'
17
+#' @param assay_type A `character` string specifying the assay from `x` to use
18
+#'   as input. Defaults to `"counts"`.
19
+#' @param verbose A `logical` controlling the display of a progress bar from the
20
+#'   Python package.
21
+#'
22
+#' @return A `data.frame` with DE results where each row is a gene and columns
23
+#'   contain relevant statistics.
24
+#'
25
+#'   The most important columns are:
26
+#'
27
+#'   * `g`: the name of the gene
28
+#'   * `pval`: the p-value for spatial differential expression
29
+#'   * `qval`: the q-value, indicating significance after correcting for
30
+#'   multiple testing
31
+#'   * `l`: A parameter indicating the distance scale a gene changes expression
32
+#'   over
33
+#'
34
+#' @examples
35
+#' ## Mock up a SpatialExperiment object wit 100 cells, 200 genes
36
+#' set.seed(42)
37
+#' spe <- mockSVG(size = 10, tot_genes = 200, de_genes = 20, return_SPE = TRUE)
38
+#'
39
+#' ## Run spatialDE
40
+#' de_results <- spatialDE(spe)
41
+#' head(de_results)
42
+#'
43
+#' @seealso
44
+#' The individual steps performed by this function: [stabilize()],
45
+#' [regress_out()] and [run()].
46
+#'
47
+#' For further analysis of the DE results:
48
+#' [model_search()] and [spatial_patterns()].
49
+#'
50
+#' @references
51
+#' Svensson, V., Teichmann, S. & Stegle, O. SpatialDE: identification of
52
+#' spatially variable genes. Nat Methods 15, 343–346 (2018).
53
+#' \url{https://doi.org/10.1038/nmeth.4636}
54
+#'
55
+#' [**SpatialDE 1.1.3**](https://pypi.org/project/SpatialDE/1.1.3/): the version
56
+#' of the Python package used under the hood.
57
+#'
58
+#' @author Davide Corso, Milan Malfait
59
+#' @name spatialDE
60
+NULL
2 61
 
3 62
 ## Run spatialDE pipeline on any matrix-like object
4 63
 #' @importFrom Matrix colSums
5 64
new file mode 100644
... ...
@@ -0,0 +1,79 @@
1
+% Generated by roxygen2: do not edit by hand
2
+% Please edit documentation in R/spatialDE.R
3
+\name{spatialDE}
4
+\alias{spatialDE}
5
+\alias{spatialDE,matrix-method}
6
+\alias{spatialDE,SpatialExperiment-method}
7
+\title{Find spatially variable genes with \strong{SpatialDE}}
8
+\usage{
9
+spatialDE(x, ...)
10
+
11
+\S4method{spatialDE}{matrix}(x, coordinates, verbose = FALSE)
12
+
13
+\S4method{spatialDE}{SpatialExperiment}(x, assay_type = "counts", verbose = FALSE)
14
+}
15
+\arguments{
16
+\item{x}{A numeric \code{matrix} of counts where genes are rows and cells are columns.
17
+
18
+Alternatively, a \linkS4class{SpatialExperiment} object.}
19
+
20
+\item{...}{For the generic, arguments to pass to specific methods.}
21
+
22
+\item{coordinates}{A \code{data.frame} with sample coordinates. Each row is a
23
+sample, the columns with coordinates should be named 'x' and 'y'.
24
+
25
+For the \emph{SpatialExperiment} method, coordinates are taken from
26
+\code{spatialCoords(x)}.}
27
+
28
+\item{verbose}{A \code{logical} controlling the display of a progress bar from the
29
+Python package.}
30
+
31
+\item{assay_type}{A \code{character} string specifying the assay from \code{x} to use
32
+as input. Defaults to \code{"counts"}.}
33
+}
34
+\value{
35
+A \code{data.frame} with DE results where each row is a gene and columns
36
+contain relevant statistics.
37
+
38
+The most important columns are:
39
+\itemize{
40
+\item \code{g}: the name of the gene
41
+\item \code{pval}: the p-value for spatial differential expression
42
+\item \code{qval}: the q-value, indicating significance after correcting for
43
+multiple testing
44
+\item \code{l}: A parameter indicating the distance scale a gene changes expression
45
+over
46
+}
47
+}
48
+\description{
49
+Identify genes that significantly depend on spatial coordinates with the
50
+\href{https://github.com/Teichlab/SpatialDE}{\strong{SpatialDE}} Python package.
51
+}
52
+\examples{
53
+## Mock up a SpatialExperiment object wit 100 cells, 200 genes
54
+set.seed(42)
55
+spe <- mockSVG(size = 10, tot_genes = 200, de_genes = 20, return_SPE = TRUE)
56
+
57
+## Run spatialDE
58
+de_results <- spatialDE(spe)
59
+head(de_results)
60
+
61
+}
62
+\references{
63
+Svensson, V., Teichmann, S. & Stegle, O. SpatialDE: identification of
64
+spatially variable genes. Nat Methods 15, 343–346 (2018).
65
+\url{https://doi.org/10.1038/nmeth.4636}
66
+
67
+\href{https://pypi.org/project/SpatialDE/1.1.3/}{\strong{SpatialDE 1.1.3}}: the version
68
+of the Python package used under the hood.
69
+}
70
+\seealso{
71
+The individual steps performed by this function: \code{\link[=stabilize]{stabilize()}},
72
+\code{\link[=regress_out]{regress_out()}} and \code{\link[=run]{run()}}.
73
+
74
+For further analysis of the DE results:
75
+\code{\link[=model_search]{model_search()}} and \code{\link[=spatial_patterns]{spatial_patterns()}}.
76
+}
77
+\author{
78
+Davide Corso, Milan Malfait
79
+}