Skip to content
Snippets Groups Projects
Commit b299e9c2 authored by Arnaud Duvermy's avatar Arnaud Duvermy
Browse files

fix pb with interaction in get_effects_from_rnorm

Former-commit-id: add949833d02628cc864cb8cfd3b40de6a302029
Former-commit-id: d1e055ee38670215d20b9da8dd773be1626da26b
Former-commit-id: 4e40eeb084f58add6946d3ab911f9b897474c432
parent 00ec14ba
Branches
Tags
No related merge requests found
......@@ -79,14 +79,16 @@ get_effects_from_rnorm <- function(list_var, metadata){
variable_2rnorm <- names(list_stdev)
l_effects <- lapply(stats::setNames(variable_2rnorm, variable_2rnorm) , function(var){
col_labels <- paste("label", var, sep = "_")
list_combinations <- paste(metadata[["geneID"]], metadata[[col_labels]])
col_labels <- paste("label", unlist(strsplit(var, ":")), sep = "_")
cols2paste <- c("geneID", col_labels)
list_combinations <- apply( metadata[ , cols2paste ] , 1 , paste , collapse = "-" )
list_effects <- unique(list_combinations)
list_beta <- rnorm(length(list_effects), mean = list_mu[var], sd = list_stdev[var])
names(list_beta) <- list_effects
unname(list_beta[list_combinations])
})
df_effects <- do.call("cbind", l_effects)
return(df_effects)
}
......
......@@ -1596,14 +1596,16 @@ get_effects_from_rnorm <- function(list_var, metadata){
variable_2rnorm <- names(list_stdev)
l_effects <- lapply(stats::setNames(variable_2rnorm, variable_2rnorm) , function(var){
col_labels <- paste("label", var, sep = "_")
list_combinations <- paste(metadata[["geneID"]], metadata[[col_labels]])
col_labels <- paste("label", unlist(strsplit(var, ":")), sep = "_")
cols2paste <- c("geneID", col_labels)
list_combinations <- apply( metadata[ , cols2paste ] , 1 , paste , collapse = "-" )
list_effects <- unique(list_combinations)
list_beta <- rnorm(length(list_effects), mean = list_mu[var], sd = list_stdev[var])
names(list_beta) <- list_effects
unname(list_beta[list_combinations])
})
df_effects <- do.call("cbind", l_effects)
return(df_effects)
}
......@@ -2268,7 +2270,7 @@ get_messages_sequencing_depth <- function(scaling_factors, threshold_cov_var = 1
warning_too_low_mu_ij_row <- function(mu_ij_matrix, threshold = 1 ){
n_too_low_row <- length(which(detect_row_matx_bellow_threshold(mu_ij_matrix, threshold)))
if (n_too_low_row > 0){
msg <- paste("INFO:", n_too_low_row, "genes have all(mu_ij) < 1, indicating very low counts. Consider removing them for future analysis using prepareData2fit with row_cnt_threshold = 10. To detect them, try increasing sequencing depth.\n",
msg <- paste("INFO:", n_too_low_row, "genes have all(mu_ij) < 1, indicating very low counts. Consider removing them for future analysis using prepareData2fit with row_threshold = 10. To detect them in future experiment, try increasing sequencing depth.\n",
sep = " ")
message(msg)
}
......@@ -2694,7 +2696,7 @@ prepareData2fit <- function(countMatrix, metadata, response_name = "kij",
if (row_threshold > 0){
message(paste("INFO: filtering", response_name, "<", row_threshold, sep = " " ))
idx <- detect_row_matx_bellow_threshold(countMatrix, threshold = row_threshold)
message(paste(length(idx), "genes removed from data.", sep = " "))
message(paste(length(which(idx)), "genes removed from data.", sep = " "))
countMatrix <- countMatrix[ !idx , ]
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment