Skip to content

Commit

Permalink
Merge pull request #38 from spriyansh/main
Browse files Browse the repository at this point in the history
CPU Core Setting, logo, website, patchwork to ggpubr
  • Loading branch information
spriyansh authored Apr 17, 2024
2 parents 37086c9 + 986f7ec commit 24ef55a
Show file tree
Hide file tree
Showing 21 changed files with 51 additions and 18 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ inst/doc
/doc/
/Meta/
.Rbuildignore
test_dev
test_dev
docs
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Suggests:
BiocStyle,
ComplexUpset,
UpSetR,
patchwork
ggpubr
Config/testthat/edition: 3
URL: https://github.com/BioBam/scMaSigPro/
biocViews: Clustering, Regression, TimeCourse, DifferentialExpression,
Expand Down
2 changes: 1 addition & 1 deletion R/plotIntersect.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#' @importFrom S4Vectors isEmpty
#' @importFrom RColorConesa colorConesa
#' @importFrom utils packageVersion
#'
#'
#' @param scmpObj An object of class \code{\link{ScMaSigPro}}.
#' @param min_intersection_size Minimal number of observations in an intersection
#' for it to be included.
Expand Down
19 changes: 12 additions & 7 deletions R/sc.p.vector.R
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
#' @param max_it Maximum number of iterations to fit the model.
#' @param parallel Use forking process to run parallelly. (Default is FALSE)
#' (Currently, Windows is not supported)
#' @param n_cores Explicitly specify the number of cores to use for parallel model
#' fitting. (Default is inferred from the system using availableCores()-2)
#' @param verbose Print detailed output in the console. (Default is TRUE)
#'
#' @return An object of class \code{\link{ScMaSigPro}}, with updated `Profile`
Expand All @@ -48,6 +50,7 @@ sc.p.vector <- function(scmpObj, p_value = 0.05, mt_correction = "BH",
verbose = TRUE,
offset = TRUE,
parallel = FALSE,
n_cores = availableCores() - 2,
log_offset = FALSE,
max_it = 100,
link = "log") {
Expand Down Expand Up @@ -106,12 +109,6 @@ sc.p.vector <- function(scmpObj, p_value = 0.05, mt_correction = "BH",
p <- dim(dis)[2]
sc.p.vector <- vector(mode = "numeric", length = g)

if (parallel == FALSE) {
if (verbose) {
pb <- txtProgressBar(min = 0, max = g, style = 3)
}
}

# Calculate offset
if (offset) {
dat <- dat + 1
Expand All @@ -130,13 +127,21 @@ sc.p.vector <- function(scmpObj, p_value = 0.05, mt_correction = "BH",
numCores <- 1
warning("Currently, we only support sequential processing on windows based systems...")
} else {
numCores <- availableCores() - 1
n_cores <- as.integer(n_cores)
# Check Required Cores
assert_that(n_cores <= availableCores(),
msg = paste("Number of cores requested is invalid. This session has access to", as.integer(availableCores()), "cores only.")
)
numCores <- n_cores
}
if (verbose) {
message(paste("Running with", numCores, "cores..."))
}
} else {
numCores <- 1
if (verbose) {
pb <- txtProgressBar(min = 0, max = g, style = 3)
}
}

# Check for weight usage
Expand Down
10 changes: 9 additions & 1 deletion R/sc.t.fit.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
#' @param max_it Maximum number of iterations to fit the model.
#' @param parallel Use forking process to run parallelly. (Default is FALSE)
#' (Currently, Windows is not supported)
#' @param n_cores Explicitly specify the number of cores to use for parallel model
#' fitting. (Default is inferred from the system using availableCores()-2)
#' @param verbose Print detailed output in the console. (Default is TRUE)
#'
#' @return An object of class \code{\link{ScMaSigPro}}, with updated `Estimate`
Expand All @@ -47,6 +49,7 @@ sc.t.fit <- function(scmpObj,
offset = scmpObj@Parameters@offset,
verbose = TRUE,
parallel = FALSE,
n_cores = availableCores() - 2,
log_offset = scmpObj@Parameters@log_offset,
max_it = scmpObj@Parameters@max_it,
link = scmpObj@Parameters@link) {
Expand Down Expand Up @@ -137,7 +140,12 @@ sc.t.fit <- function(scmpObj,
numCores <- 1
warning("Currently, we only support sequential processing on windows based systems...")
} else {
numCores <- availableCores() - 1
n_cores <- as.integer(n_cores)
# Check Required Cores
assert_that(n_cores <= availableCores(),
msg = paste("Number of cores requested is invalid. This session has access to", as.integer(availableCores()), "cores only.")
)
numCores <- n_cores
}
if (verbose) {
message(paste("Running with", numCores, "cores..."))
Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# ScMaSigPro
<img src="man/figures/logo.png" alt="scMaSigPro Logo" width="17%"/>

Implementation of MaSigPro for scRNA-Seq Data
### Implementation of MaSigPro for scRNA-Seq Data.

[![R-CMD-Check](https://github.com/BioBam/scMaSigPro/actions/workflows/r.yml/badge.svg?branch=main)](https://github.com/BioBam/scMaSigPro/actions/workflows/r.yml) [![test-coverage](https://github.com/BioBam/scMaSigPro/actions/workflows/test-coverage.yaml/badge.svg?branch=main)](https://github.com/BioBam/scMaSigPro/actions/workflows/test-coverage.yaml)
[![R-CMD-Check](https://github.com/BioBam/scMaSigPro/actions/workflows/r.yml/badge.svg?branch=main)](https://github.com/BioBam/scMaSigPro/actions/workflows/r.yml)
[![test-coverage](https://github.com/BioBam/scMaSigPro/actions/workflows/test-coverage.yaml/badge.svg?branch=main)](https://github.com/BioBam/scMaSigPro/actions/workflows/test-coverage.yaml)

---

Expand Down
5 changes: 5 additions & 0 deletions _pkgdown.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
url: https://github.com/BioBam/scMaSigPro
logo: man/figures/logo.png
template:
bootstrap: 5

Binary file added man/figures/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions man/sc.p.vector.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions man/sc.t.fit.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added pkgdown/favicon/apple-touch-icon-120x120.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pkgdown/favicon/apple-touch-icon-152x152.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pkgdown/favicon/apple-touch-icon-180x180.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pkgdown/favicon/apple-touch-icon-60x60.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pkgdown/favicon/apple-touch-icon-76x76.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pkgdown/favicon/apple-touch-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pkgdown/favicon/favicon-16x16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pkgdown/favicon/favicon-32x32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pkgdown/favicon/favicon.ico
Binary file not shown.
7 changes: 5 additions & 2 deletions vignettes/Basic-Workflow.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ By setting the vars parameter to "groups", the function will add genes with
$R^2$ >= 0.7 to the object. To explore the number of genes per group, we will
make an upset plot:
```{r, "uspet",eval=TRUE, echo=TRUE, fig.width=8, fig.height=6}
plotIntersect(scmp_ob, package = "ComplexUpset")
plotIntersect(scmp_ob, package = "UpSetR")
```

Here, we observe that 23 genes belong to both Path2vsPath1 and Path1, indicating
Expand All @@ -333,7 +333,10 @@ FigureA <- plotTrend(scmp_ob, "Gene9", logs = TRUE, logType = "log")
FigureB <- plotTrend(scmp_ob, "Gene95", logs = TRUE, logType = "log")
FigureC <- plotTrend(scmp_ob, "Gene10", logs = TRUE, logType = "log")
FigureD <- plotTrend(scmp_ob, "Gene92", logs = TRUE, logType = "log")
(FigureA + FigureB) / (FigureC + FigureD)
ggpubr::ggarrange(FigureA, FigureB, FigureC, FigureD,
ncol = 2, nrow = 2,
labels = c("A", "B", "C", "D")
)
```

These plots illustrate the gene expression trends for selected genes, providing
Expand Down
6 changes: 4 additions & 2 deletions vignettes/scMaSigPro-Class.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,9 @@ for (i in rownames(head(pTime_up, 4))) {
}
# Plot combined
(pTime_up.plots[[1]] + pTime_up.plots[[2]]) / (pTime_up.plots[[3]] + pTime_up.plots[[4]])
ggpubr::ggarrange(pTime_up.plots[[1]], pTime_up.plots[[2]], pTime_up.plots[[3]], pTime_up.plots[[4]],
ncol = 2, nrow = 2, labels = c("A", "B", "C", "D")
)
```

```{r, "Pseudotime_path"}
Expand All @@ -272,7 +274,7 @@ for (i in rownames(head(pTime_path_up, 4))) {
}
# Plot combined
(pTime_path_up.plots[[1]] + pTime_path_up.plots[[2]]) / (pTime_path_up.plots[[3]] + pTime_path_up.plots[[4]])
ggpubr::ggarrange(pTime_path_up.plots[[1]], pTime_path_up.plots[[2]], pTime_path_up.plots[[3]], pTime_path_up.plots[[4]], ncol = 2, nrow = 2, labels = c("A", "B", "C", "D"))
```

```{r, echo=FALSE}
Expand Down

0 comments on commit 24ef55a

Please sign in to comment.