-
Notifications
You must be signed in to change notification settings - Fork 18
/
SelectGeneSet.R
47 lines (39 loc) · 1.93 KB
/
SelectGeneSet.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#' @title Select a Subset of Genes in an ExpressionSet
#' @description
#' Select a subset of genes stored in the input \code{ExpressionSet}.
#' @param ExpressionSet a standard PhyloExpressionSet or DivergenceExpressionSet object.
#' @param gene.set a character vector storing the gene ids for which gene expression profiles shall be visualized.
#' @param use.only.map a logical value indicating whether instead of a standard \code{ExpressionSet} only a \code{Phylostratigraphic Map} or \code{Divergene Map} is passed to the function.
#' @author Hajk-Georg Drost
#' @details
#'
#' This function selects a subset of genes specified in \code{gene.set} stored in the input \code{ExpressionSet} and returns a subset \code{ExpressionSet}.
#'
#' This function is useful for studying the evolutionary \emph{properties} of a subset of genes
#' stored in the \code{ExpressionSet}.
#'
#' @examples
#' data(PhyloExpressionSetExample)
#'
#' # receive a subset ExpressionSet for the fist 5 genes stored in
#' # the PhyloExpressionSetExample
#' SelectGeneSet(ExpressionSet = PhyloExpressionSetExample,
#' gene.set = PhyloExpressionSetExample[1:5, 2])
#'
#'
#' # get a gene subset using only a phylostratihraphic map
#' ExamplePSMap <- PhyloExpressionSetExample[ , 1:2]
#'
#' SelectGeneSet(ExpressionSet = ExamplePSMap,
#' gene.set = PhyloExpressionSetExample[1:5, 2],
#' use.only.map = TRUE)
#'
#' @seealso \code{\link{PlotGeneSet}}, \code{\link{PlotEnrichment}}, \code{\link{DiffGenes}}
#' @export
SelectGeneSet <- function(ExpressionSet, gene.set, use.only.map = FALSE) {
ExpressionSet <- as.data.frame(ExpressionSet)
return( PlotGeneSet(ExpressionSet = ExpressionSet,
gene.set = gene.set,
get.subset = TRUE,
use.only.map = use.only.map) )
}