Browse code

Finished fixing up importGeneSet functions. Modified and moved featureIndex function from Celda to sctk. Added msigdb object and documentation

Joshua D. Campbell authored on 28/06/2020 19:18:31
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,72 @@
1
+% Generated by roxygen2: do not edit by hand
2
+% Please edit documentation in R/featureIndex.R
3
+\name{featureIndex}
4
+\alias{featureIndex}
5
+\title{Retrieve row index for a set of features}
6
+\usage{
7
+featureIndex(
8
+  features,
9
+  inSCE,
10
+  by = "rownames",
11
+  exactMatch = TRUE,
12
+  removeNA = FALSE,
13
+  errorOnNoMatch = TRUE,
14
+  warningOnPartialMatch = TRUE
15
+)
16
+}
17
+\arguments{
18
+\item{features}{Character vector of feature names to find in the rows of
19
+\code{inSCE}.}
20
+
21
+\item{inSCE}{A data.frame, matrix, or \linkS4class{SingleCellExperiment}
22
+object to search.}
23
+
24
+\item{by}{Character. Where to search for features in \code{inSCE}. If set to
25
+\code{"rownames"} then the features will be searched for among
26
+\code{rownames(inSCE)}. If \code{inSCE} inherits from class
27
+\linkS4class{SummarizedExperiment}, then \code{by} can be one of the
28
+fields in the row annotation data.frame (i.e. one of
29
+\code{colnames(rowData(inSCE))}).}
30
+
31
+\item{exactMatch}{Boolean. Whether to only identify exact matches
32
+or to identify partial matches using \code{\link{grep}}.}
33
+
34
+\item{removeNA}{Boolean. If set to \code{FALSE}, features not found in
35
+\code{inSCE} will be given \code{NA} and the returned vector will be the same
36
+length as \code{features}. If set to \code{TRUE}, then the \code{NA}
37
+values will be removed from the returned vector. Default \code{FALSE}.}
38
+
39
+\item{errorOnNoMatch}{Boolean. If \code{TRUE}, an error will be given if
40
+no matches are found. If \code{FALSE}, an empty vector will be returned if 
41
+\code{removeNA} is set to \code{TRUE} or a vector of \code{NA} if 
42
+\code{removeNA} is set to \code{FALSE}. Default \code{TRUE}.}
43
+
44
+\item{warningOnPartialMatch}{Boolean. If \code{TRUE}, a warning will be
45
+given if some of the entries in \code{features} were not found in 
46
+\code{inSCE}. The warning will list the features not found.
47
+Default \code{TRUE}.}
48
+}
49
+\value{
50
+A vector of row indices for the matching features in \code{inSCE}.
51
+}
52
+\description{
53
+This will return indices of features among the rownames
54
+or rowData of a data.frame, matrix, or a \linkS4class{SummarizedExperiment}
55
+object including a \linkS4class{SingleCellExperiment}.
56
+Partial matching (i.e. grepping) can be used by setting
57
+\code{exactMatch = FALSE}.
58
+}
59
+\examples{
60
+data(scExample)
61
+ix <- featureIndex(features = c("MT-CYB", "MT-ND2"),
62
+                             inSCE = sce,
63
+                             by = "feature_name")
64
+}
65
+\seealso{
66
+'\link[scater]{retrieveFeatureInfo}' from package \code{'scater'}
67
+and \code{link{regex}} for how to use regular expressions when
68
+\code{exactMatch = FALSE}.
69
+}
70
+\author{
71
+Yusuke Koga, Joshua D. Campbell
72
+}