Skip to content

Commit

Permalink
1.0.4
Browse files Browse the repository at this point in the history
  • Loading branch information
atpoint authored and atpoint committed Aug 26, 2024
1 parent 7b5630e commit 0e06f8c
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 6 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: SigGenes
Title: Automated differential analysis and signature generation for bulk and single-cell data
Description: Automated differential analysis between groups based on limma-voom and generation of per-group signatures via custom filtering.
Version: 1.0.3
Version: 1.0.4
Author: Alexander Bender [aut,cre]
Maintainer: Alexander Bender <[email protected]>
License: LGPL (>=2)
Expand All @@ -21,4 +21,4 @@ Suggests:
testthat
URL: https://github.com/atpoint/SigGenes
BugReports: https://github.com/atpoint/SigGenes/issues
RoxygenNote: 7.2.3
RoxygenNote: 7.3.2
5 changes: 5 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
CHANGES IN VERSION 1.0.4
------------------------

o internal bug fixes and additional checks

CHANGES IN VERSION 1.0.0
------------------------

Expand Down
18 changes: 14 additions & 4 deletions R/de_testing.R
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,22 @@ de_limma <- function(x, use_assay = "counts", aggregate_by=NULL, use_existing_sf
if(!is(use_existing_sf, "logical"))
stop("use_existing_sf must be logical")

is_main <- main_covariate %in% colnames(colData(x))
is_too_long_main <- length(main_covariate)
if(is_too_long_main > 1) stop("main_covariate must be length 1")

is_main <- all(main_covariate %in% colnames(colData(x)))
if(!is_main) stop("Not all entries in <main_covariate> are in colData(x)")

if(!is.null(other_covariates)){
is_other <- other_covariates %in% colnames(colData(x))
is_other <- all(other_covariates %in% colnames(colData(x)))
if(!is_other) stop("Not all entries in <other_covariates> are in colData(x)")
}

if(!is.null(aggregate_by)){
is_agg <- all(aggregate_by %in% colnames(colData(x)))
if(!is_agg) stop("Not all entries in <aggregate_by> are in colData(x)")
}

is_pct <- min_pct >= 0 & is.numeric(min_pct)
if(!is_pct) stop("min_pct must be numeric and not negative")

Expand Down Expand Up @@ -160,8 +168,8 @@ de_limma <- function(x, use_assay = "counts", aggregate_by=NULL, use_existing_sf
if(max_n == 1) stop("No replication in any group -- DE analysis not possible!")

# Design, allowing any additional covariates
others <- if(!is.null(other_covariates)) paste0(" + ", other_covariates) else ""
f <- as.formula(paste0("~ 0 + ", main_covariate, others))
others <- if(!is.null(other_covariates)) paste(other_covariates, collapse = " + ") else ""
f <- as.formula(paste("~ 0", main_covariate, others, sep = "+ "))
design <- model.matrix(f, pb$samples)
colnames(design) <- gsub(paste0("^", main_covariate), "", colnames(design))

Expand Down Expand Up @@ -289,6 +297,8 @@ de_limma <- function(x, use_assay = "counts", aggregate_by=NULL, use_existing_sf
to_return[["params"]]$mode <- mode
to_return[["params"]]$delim <- delim
to_return[["params"]]$min_pct <- min_pct
to_return[["params"]]$formula <- paste(f, collapse = "")


return(to_return)

Expand Down

0 comments on commit 0e06f8c

Please sign in to comment.