Skip to content

Commit

Permalink
Allow the use of DelayedMatrix
Browse files Browse the repository at this point in the history
  • Loading branch information
JesperGrud authored Sep 25, 2023
1 parent 609b009 commit fbc7798
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions R/quality_metrics.R
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ quality_metrics = function(counts, contrast = NULL, contrast_type = "denominator
if(missing(counts)) {
stop('No count matrix was provided', call. = FALSE)
} else {
if (!any(class(counts) == c("dgTMatrix", "Matrix","matrix", "dgCMatrix"))) { stop('Count matrix has an unacceptable format. Accepted formats: matrix, Matrix, dgTMatrix, dgCMatrix', call. = FALSE) }
if (!any(class(counts) == c("dgTMatrix", "Matrix","matrix", "dgCMatrix","DelayedMatrix"))) { stop('Count matrix has an unacceptable format. Accepted formats: matrix, Matrix, dgTMatrix, dgCMatrix, DelayedMatrix', call. = FALSE) }
}

# species arugment
Expand All @@ -50,7 +50,7 @@ quality_metrics = function(counts, contrast = NULL, contrast_type = "denominator

# contrast matrix
if(!is.null(contrast)) {
if (!any(class(contrast) == c("dgTMatrix", "Matrix","matrix", "dgCMatrix"))) { stop('Contrast matrix has an unacceptable format. Accepted formats: matrix, Matrix, dgTMatrix, dgCMatrix', call. = FALSE) }
if (!any(class(contrast) == c("dgTMatrix", "Matrix","matrix", "dgCMatrix","DelayedMatrix"))) { stop('Contrast matrix has an unacceptable format. Accepted formats: matrix, Matrix, dgTMatrix, dgCMatrix, DelayedMatrix', call. = FALSE) }
}

# contrast_type argument
Expand All @@ -75,7 +75,7 @@ quality_metrics = function(counts, contrast = NULL, contrast_type = "denominator
if (!isTRUE(verbose) & !isFALSE(verbose)) { stop("verbose must be either TRUE or FALSE") }

## convert the counts into dgCMatrix if its class() is not dgCMatrix
if(class(counts) != "dgCMatrix") { counts = as(counts, "dgCMatrix") }
if(class(counts) == "matrix") { counts = as(counts, "dgCMatrix") }

## create a list for holding the output
output <- list()
Expand Down

0 comments on commit fbc7798

Please sign in to comment.