/
misc.R
63 lines (61 loc) · 2 KB
/
misc.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#' @title Celda models
#' @description List of available Celda models with correpsonding descriptions.
#' @export
#' @examples
#' celda()
#' @return None
celda <- function() {
message(
"celda_C: Clusters the columns of a count matrix containing",
" single-cell data into K subpopulations."
)
message(
"celda_G: Clusters the rows of a count matrix containing",
" single-cell data into L modules."
)
message(
"celda_CG: Clusters the rows and columns of a count matrix",
" containing single-cell data into L modules and K subpopulations,",
" respectively."
)
message(
"celdaGridSearch: Run Celda with different combinations of",
" parameters and multiple chains in parallel."
)
}
#' @title Append two celdaList objects
#' @description Returns a single celdaList representing the combination of two
#' provided celdaList objects.
#' @return A celdaList object. This object contains all resList entries and
#' runParam records from both lists.
#' @param list1 A celda_list object
#' @param list2 A celda_list object to be joined with list_1
#' @examples
#' data(celdaCGGridSearchRes)
#' appendedList <- appendCeldaList(
#' celdaCGGridSearchRes,
#' celdaCGGridSearchRes
#' )
#' @importFrom methods new
#' @export
appendCeldaList <- function(list1, list2) {
if (!is.element("celdaList", class(list1)) |
!is.element("celdaList", class(list2))) {
stop("Both parameters to appendCeldaList must be of class celdaList.")
}
if (!(countChecksum(list1) == countChecksum(list2))) {
warning(
"Provided lists have different countChecksums and may have",
" been generated from different count matrices. Using checksum",
" from first list..."
)
}
newList <- methods::new(
"celdaList",
runParams = rbind(runParams(list1), runParams(list2)),
resList = c(resList(list1), resList(list2)),
countChecksum = countChecksum(list1),
perplexity = matrix(nrow = 0, ncol = 0)
)
return(newList)
}