Skip to content

Commit

Permalink
specify ParDist to be single threaded
Browse files Browse the repository at this point in the history
  • Loading branch information
gavinmdouglas committed Nov 10, 2022
1 parent 43311a5 commit d08ae00
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: FuncDiv
Title: Compute contributional diversity metrics
Version: 0.4.2
Version: 0.4.3
Authors@R:
person("Gavin", "Douglas", , "[email protected]", role = c("aut", "cre"),
comment = c(ORCID = "0000-0001-5164-6707"))
Expand Down
4 changes: 2 additions & 2 deletions R/beta_workflow.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ parDist_methods <- c("bhjattacharyya", "bray", "canberra", "chord",

for (m in parDist_methods) {
func_dist_cmd_char <- paste("function(in_tab, ...) {\n",
"func_dist <- as.matrix(parallelDist::parDist(in_tab, method = \"", eval(m), "\"))\n",
"func_dist <- as.matrix(parallelDist::parDist(in_tab, method = \"", eval(m), "\", threads = 1))\n",
"func_dist[lower.tri(func_dist, diag = TRUE)] <- NA\n",
"return(func_dist)\n}", sep = "")

Expand All @@ -30,7 +30,7 @@ compute_betadiv[["unweighted_unifrac"]] <- function(in_tab, in_phylo) {
}

compute_betadiv[["jensen_shannon_div"]] <- function(in_tab, ...) {
func_dist <- as.matrix(parallelDist::parDist(in_tab, method = "custom", func = jensen_shannon_divergence_FuncPtr))
func_dist <- as.matrix(parallelDist::parDist(in_tab, method = "custom", func = jensen_shannon_divergence_FuncPtr, threads = 1))
func_dist[lower.tri(func_dist, diag = TRUE)] <- NA
return(func_dist)
}
Expand Down

0 comments on commit d08ae00

Please sign in to comment.