Skip to content

Commit

Permalink
Version 1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
tmorikuicr committed Jan 21, 2022
1 parent b24bef2 commit ad6d79d
Show file tree
Hide file tree
Showing 15 changed files with 1,256 additions and 989 deletions.
6 changes: 3 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ Package: espresso
Type: Package
Title: Enhanced spatial reconstruction by stochastic self-organizing
map
Version: 0.2.17
Date: 2022-01-13
Version: 1.0.0
Date: 2022-01-21
Authors@R: person("Tomoya", "Mori", role = c("aut", "cre"), email = "[email protected]")
Description: This is a package for domain estimation of cells only from gene expression profile based on graph-structured stochastic self-organizing map (GraphSOM) and Markov chain Monte Carlo (MCMC) method.
License: GPL-3
Expand All @@ -18,6 +18,6 @@ LazyData: true
Suggests: knitr, rmarkdown
VignetteBuilder: knitr
NeedsCompilation: no
Packaged: 2022-01-14 01:52:59 UTC; tmori
Packaged: 2022-01-21 06:50:12 UTC; tmori
Author: Tomoya Mori [aut, cre]
Maintainer: Tomoya Mori <[email protected]>
5 changes: 4 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
## 1.0.0
* Add an option `version` to `graphSOM` and `rxmcmc` functions in order to enable us to perform SOM computations based on the previous version (= 0.2.17).

## 0.2.17
* Add options `size_d` and `size_s` to `plotDistMap` function.
# Add options `color_by_group`, `grpcol`, and `magnify` to `plotUMAP` function.
* Add options `color_by_group`, `grpcol`, and `magnify` to `plotUMAP` function.

## 0.2.16
* Replace graphSOM and rxmcmc functions of v.0.2.15 with those of v.0.2.14
Expand Down
2 changes: 1 addition & 1 deletion R/boruta.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#'
selectFeatures <- function(obj, maxRuns = 500, decision = "nr", seed = NULL) {
if (!is.null(seed)) {
set.seed(seed)
set.seed(seed, kind = "Mersenne-Twister")
}
X <- obj@exprs
Y <- as.factor(obj@asgmt[, "domain"])
Expand Down
18 changes: 14 additions & 4 deletions R/graphsom.R
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,7 @@ initGraphSOM <- function(obj, nsamples = NULL, rept = 1,
stochastic = TRUE, rmin = 0.5, rmax = 1.0, nmin = 1, nmax = NULL,
map_method = "sample", bmu_method = "min", coef = 1.0, swap = TRUE, seed = NULL) {
if (!is.null(seed)) {
set.seed(as.numeric(seed))
set.seed(as.numeric(seed), kind = "Mersenne-Twister")
}
obj <- .genSampleSets(obj = obj, nsamples = nsamples, rept = as.integer(rept))
obj <- .initGraphSOM(obj = obj, lsteps = as.integer(lsteps), radius = radius,
Expand All @@ -607,12 +607,22 @@ initGraphSOM <- function(obj, nsamples = NULL, rept = 1,
#' @param gset Gene set.
#' @param seed Random seed.
#' @param verbose Whether to show messages.
#' @param version Character that specifies on which previous version GraphSOM computation should be performed. (e.g., "0.2.17")
#' @return \code{espresso} object
#' @export
#'
graphSOM <- function(obj, gset = NULL, seed = NULL, verbose = TRUE) {
if (!is.null(seed)) {
set.seed(seed)
graphSOM <- function(obj, gset = NULL, seed = NULL, verbose = TRUE, version = NULL) {
if (is.null(version)) {
if (!is.null(seed)) {
set.seed(seed, kind = "L'Ecuyer-CMRG")
}
} else if (version == "0.2.17") {
if (!is.null(seed)) {
set.seed(seed, kind = "Mersenne-Twister")
}
} else {
stop(paste("version", ver, "is not available."))
return(obj)
}
if (!is.null(gset)) {
obj@gset <- gset[!is.na(match(gset, colnames(obj@exprs)))]
Expand Down
34 changes: 25 additions & 9 deletions R/rxmcmc.R
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@
#' @param n_repl Number of replicas (default: \code{detectCores()}).
#' @param n_ig Number of initial genes randomly selected for MCMC.
#' @param fact Scaling factor for computing selection probability.
#' @param version Character that specifies on which previous version GraphSOM computation should be performed. (e.g., "0.2.17")
#' @import doParallel
#' @import parallel
#' @import foreach
Expand All @@ -215,16 +216,20 @@
#' @export
#'
rxmcmc <- function(obj, gset = NULL, temp = 1.0, itr = 10, k = 1, seed = NULL,
n_cl = detectCores(), n_ex = 10, n_repl = detectCores(), n_ig = 3, fact = NULL) {
n_cl = detectCores(), n_ex = 10, n_repl = detectCores(), n_ig = 3, fact = NULL, version = NULL) {
if (!is.null(seed)) {
set.seed(seed)
set.seed(seed, kind = "Mersenne-Twister")
} else {
seed <- 0
}
if (is.null(gset)) {
warning("Input `gset` to be optimized.")
return(obj)
}
if (version != "0.2.17" && !is.null(version)) {
stop(paste("version", version, "is not available."))
return(obj)
}
gset0 <- gset
exist <- match(gset, colnames(obj@exprs))
gset <- colnames(obj@exprs)[exist[!is.na(exist)]]
Expand Down Expand Up @@ -283,13 +288,24 @@ rxmcmc <- function(obj, gset = NULL, temp = 1.0, itr = 10, k = 1, seed = NULL,
}
n_sets <- length(cand_sets)
res <- .generateDataFrameForRXMCMC(1, n_sets)[[1]]
for (l in 1:n_sets) {
res_tmp <- graphSOM(obj, gset = cand_sets[[l]], verbose = FALSE)
res[l, ] <- c(as.numeric(unlist(res_tmp@summary)), length(cand_sets[[l]]))
map_tmp[[l]] <- res_tmp@map
bmu_tmp[[l]] <- res_tmp@bmu
score_tmp[[l]] <- res_tmp@score
summary_tmp[[l]] <- res_tmp@summary
if (is.null(version)) {
for (l in 1:n_sets) {
res_tmp <- graphSOM(obj, gset = cand_sets[[l]], verbose = FALSE, seed = seed)
res[l, ] <- c(as.numeric(unlist(res_tmp@summary)), length(cand_sets[[l]]))
map_tmp[[l]] <- res_tmp@map
bmu_tmp[[l]] <- res_tmp@bmu
score_tmp[[l]] <- res_tmp@score
summary_tmp[[l]] <- res_tmp@summary
}
} else if (version == "0.2.17"){
for (l in 1:n_sets) {
res_tmp <- graphSOM(obj, gset = cand_sets[[l]], verbose = FALSE, version = "0.2.17")
res[l, ] <- c(as.numeric(unlist(res_tmp@summary)), length(cand_sets[[l]]))
map_tmp[[l]] <- res_tmp@map
bmu_tmp[[l]] <- res_tmp@bmu
score_tmp[[l]] <- res_tmp@score
summary_tmp[[l]] <- res_tmp@summary
}
}
probs <- .definePriorDistr(res, fact)
idx <- .sampleGeneSet(probs)
Expand Down
2 changes: 1 addition & 1 deletion R/umap.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#' @importFrom uwot umap
#' @export
runUMAP <- function(obj, umap_param = NULL, gset = NULL, seed = 0) {
set.seed(as.numeric(seed))
set.seed(as.numeric(seed), kind = "Mersenne-Twister")
if (!is.null(gset)) {
gset <- gset[!is.na(match(gset, colnames(obj@exprs)))]
genes <- gset
Expand Down
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# eSPRESSO

21-Jan-2022: espresso 1.0.0 released.

<br/>

`espresso` is a package for domain estimation of cells only from gene expression profile based on graph-structured stochastic self-organizing map (graph-SOM) and Markov chain Monte Carlo (MCMC) method.

<img src="img/fig1.png">
Expand All @@ -18,5 +22,5 @@ install_github("tmorikuicr/espresso")
```

## Usage
Refer to the following documentation for the usage of eSPRESSO package.
Refer to the following documentation for the usage of `espresso` package.
[Vignette](https://tmorikuicr.github.io/espresso/)
Binary file modified build/partial.rdb
Binary file not shown.
Loading

0 comments on commit ad6d79d

Please sign in to comment.