Skip to content

Commit

Permalink
fix bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
zhanghao-njmu committed Feb 12, 2024
1 parent b0e49c8 commit 775eeaa
Show file tree
Hide file tree
Showing 8 changed files with 171 additions and 105 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ tmaps
src/*.so
src/*.o
test.R
test.cpp
test.cpp
test
6 changes: 5 additions & 1 deletion R/SCP-analysis.R
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ FindCorrelatedFeatures <- function(srt, feature, method = "ejaccard", assay = NU
assay <- assay %||% DefaultAssay(srt)
x <- as_matrix(t(FetchData(srt, feature)))
y <- GetAssayData(srt, assay = assay, slot = slot)
out <- proxyC::simil(x = x, y = y, method = "ejaccard", use_nan = TRUE)
out <- proxyC::simil(x = x, y = y, method = method, use_nan = TRUE)
out[is.na(out)] <- 0
out <- sort(out[1, ], decreasing = T)
return(out)
Expand Down Expand Up @@ -3996,6 +3996,8 @@ RunEnrichment <- function(srt = NULL, group_by = NULL, test.use = "wilcox", DE_t
results <- results[!sapply(results, is.null)]
results <- results[intersect(c(nm, paste0(nm, "_sim")), names(results))]
enrichment <- do.call(rbind, lapply(results, function(x) x@result))
enrichment[["Groups"]] <- factor(enrichment[["Groups"]], levels = levels(geneID_groups))
enrichment[["Database"]] <- factor(enrichment[["Database"]], levels = unique(enrichment[["Database"]]))
rownames(enrichment) <- NULL

time_end <- Sys.time()
Expand Down Expand Up @@ -4293,6 +4295,8 @@ RunGSEA <- function(srt = NULL, group_by = NULL, test.use = "wilcox", DE_thresho
results <- results[!sapply(results, is.null)]
results <- results[intersect(c(nm, paste0(nm, "_sim")), names(results))]
enrichment <- do.call(rbind, lapply(results, function(x) x@result))
enrichment[["Groups"]] <- factor(enrichment[["Groups"]], levels = levels(geneID_groups))
enrichment[["Database"]] <- factor(enrichment[["Database"]], levels = unique(enrichment[["Database"]]))
rownames(enrichment) <- NULL

time_end <- Sys.time()
Expand Down
2 changes: 1 addition & 1 deletion R/SCP-app.R
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,7 @@ RunSCExplorer <- function(base_dir = "SCExplorer",
initial_raster = NULL,
session_workers = 2,
plotting_workers = 8,
create_script = FALSE,
create_script = TRUE,
style_script = require("styler", quietly = TRUE),
overwrite = FALSE) {
check_R(c("rhdf5", "HDF5Array", "[email protected]", "ggplot2", "ragg", "htmlwidgets", "plotly", "bslib", "future", "promises", "BiocParallel"))
Expand Down
2 changes: 1 addition & 1 deletion R/SCP-cell_annotation.R
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ RunKNNPredict <- function(srt_query, srt_ref = NULL, bulk_ref = NULL,
match_prob <- do.call(rbind, lapply(match_freq, function(x) {
x[level[!level %in% names(x)]] <- 0
x <- x / sum(x)
return(x)
return(x[level])
}))
match_prob <- as_matrix(match_prob)
rownames(match_prob) <- names(match_freq)
Expand Down
224 changes: 123 additions & 101 deletions R/SCP-plot.R

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions man/CellDimPlot.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions man/FeatureStatPlot.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 31 additions & 0 deletions man/MergeRows.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 775eeaa

Please sign in to comment.