Browse code

set seed in simpleCOMPASS throught arguments

Greg Finak authored on 29/11/2020 00:01:33
Showing 2 changed files

... ...
@@ -1,7 +1,7 @@
1 1
 Package: COMPASS
2 2
 Type: Package
3 3
 Title: Combinatorial Polyfunctionality Analysis of Single Cells
4
-Version: 1.29.0
4
+Version: 1.29.1
5 5
 Date: 2014-07-11
6 6
 Author: Lynn Lin, Kevin Ushey, Greg Finak, Ravio Kolde (pheatmap)
7 7
 Authors@R: c( person("Lynn", "Lin", role="aut", email="[email protected]"),
... ...
@@ -17,6 +17,7 @@
17 17
 ##' @param replications The number of 'replications' to perform. In order to
18 18
 ##'   conserve memory, we only keep the model estimates from the last replication.
19 19
 ##' @param verbose Boolean; if \code{TRUE} we output progress information.
20
+##' @param seed A seed for the random number generator. Defaults to 100.
20 21
 ##' @return A \code{list} with class \code{COMPASSResult} with two components,
21 22
 ##'   the \code{fit} containing parameter estimates and parameter acceptance
22 23
 ##'   rates, and \code{data} containing the generated data used as input for
... ...
@@ -52,7 +53,7 @@
52 53
 ##' ## prefer using more iterations for a real fit
53 54
 ##' scr = SimpleCOMPASS(n_s, n_u, meta, "iid", iterations=1000)
54 55
 SimpleCOMPASS <- function(n_s, n_u, meta, individual_id,
55
-  iterations=1E4, replications=8, verbose=TRUE) {
56
+  iterations=1E4, replications=8, verbose=TRUE,seed=100) {
56 57
 
57 58
 
58 59
   # Order, n_s, n_u, and meta (if needed)
... ...
@@ -67,7 +68,8 @@ SimpleCOMPASS <- function(n_s, n_u, meta, individual_id,
67 68
   message("Ordering meta, n_s and n_u by individual_id since this wasn't done.\n",
68 69
           "If you think this is an error, check your data and rerun the code.")
69 70
   }
70
-  set.seed(100);
71
+  cat("Setting the seed to ",seed,"\n");
72
+  set.seed(seed)
71 73
   if (!all(colnames(n_s) == colnames(n_u))) {
72 74
     stop("The column names of 'n_s' and 'n_u' do not match.")
73 75
   }