Skip to content

Commit

Permalink
Add additional parameter validation to median_normalization()
Browse files Browse the repository at this point in the history
  • Loading branch information
const-ae committed Aug 13, 2019
1 parent 35eb43b commit 8720964
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions R/normalization.R
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,15 @@ median_normalization <- function(X, spike_in_rows = NULL){
spike_in_rows <- seq_len(nrow(X))
}else if(! is.numeric(spike_in_rows) && ! is.logical(spike_in_rows)){
stop("spike_in_rows must either be a numeric or a logical vector")
}else if(is.logical(spike_in_rows)){
if(length(spike_in_rows) != nrow(X)){
stop("The spike_in_rows logical vector must have one entry for each row.")
}else if(all(spike_in_rows == FALSE)){
stop("Not all elements of the spike_in_rows vector can be FALSE.")
}
}


Xnorm <- X
for(idx in seq_len(ncol(X))){
Xnorm[, idx] <- X[, idx, drop=FALSE] -
Expand Down

0 comments on commit 8720964

Please sign in to comment.