Skip to content

Commit

Permalink
fix main function
Browse files Browse the repository at this point in the history
  • Loading branch information
kalidouBA committed Dec 11, 2023
1 parent 6cccfe4 commit e9c50a1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
15 changes: 5 additions & 10 deletions R/DICEPRO.R
Original file line number Diff line number Diff line change
Expand Up @@ -72,21 +72,16 @@ DICEPRO <- function(reference, bulk, methodDeconv = "CSx", cibersortx_email = NU
bulk <- as.data.frame(apply(bulk[geneIntersect, ], 2, as.numeric))
rownames(reference) <- rownames(bulk) <- geneIntersect

matrixAbundances <- performs <- normFrobs <- performs2plot <- opt <- NULL
out_Dec <- running_method(bulk, reference, methodDeconv, cibersortx_email, cibersortx_token)
k_CT <- ncol(reference) + 1

out_Dec <- running_method(bulk, W, methodDeconv, cibersortx_email, cibersortx_token)
B_Deconv <- as.matrix(W) %*% t(out_Dec)

k_CT <- ncol(W)

res <- nmf_conjugate_gradient(V = bulk, W = W, H = out_Dec, k_CT+1)
res <- nmf_conjugate_gradient(V = bulk, W = reference, H = out_Dec, k = k_CT)
W <- res$W

colnames(W) <- c(cellTypeName, paste0("Unknown"))
dimnames(W) <- list(geneIntersect, c(cellTypeName, paste0("Unknown")))

out_Dec_Update <- res$H[,1:ncol(out_Dec)]
out_Dec_Update <- res$H[,-k_CT]
dimnames(out_Dec_Update) <- dimnames(out_Dec)
rownames(performs2plot) <- NULL

results <- list("Prediction" = out_Dec_Update, "New_signature" = W)

Expand Down
2 changes: 1 addition & 1 deletion R/NMF_optim.R
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ nmf_conjugate_gradient <- function(V, k = 1, W = NULL, H = NULL) {

list(W = W, H = t(H), Error = rmse_nmf)
}
cl <- min(5, detectCores())
cl <- min(5, detectCores())
result_list <- mclapply(seq(0,1,0.25), function(i) {
par_nmf(i)
}, mc.cores = cl)
Expand Down

0 comments on commit e9c50a1

Please sign in to comment.