Skip to content

Commit

Permalink
Updates on algorithm and test cases.
Browse files Browse the repository at this point in the history
  • Loading branch information
skpalan committed Sep 5, 2019
1 parent a7b259a commit a7db077
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion R/liger.R
Original file line number Diff line number Diff line change
Expand Up @@ -4516,7 +4516,7 @@ imputeKNN <- function(object, reference, queries = NULL, knn_k = 50, weight = FA
for (query in queries) {
query_cells = rownames(object@scale.data[[query]])
#find nearest neighbors for query cell in normed ref datasets
nn.k = get.knnx(object@H.norm[reference_cells,],object@H.norm[query_cells,],k=knn_k)
nn.k = get.knnx(object@H.norm[reference_cells,],object@H.norm[query_cells,], k=knn_k, algorithm='CR')
imputed_vals = sapply(1:nrow(nn.k$nn.index),function(n){ # for each cell in the target dataset:
weights = nn.k$nn.dist[n,]
weights = as.matrix(exp(-weights)/sum(exp(-weights)))
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test_post_factorization.R
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ test_that("List names and dimensions correct", {
})

test_that("Imputation results correct", {
expect_equivalent(imputation[['tenx']][1, 1:5], c(0.100934163, 0.101276286, 0.2445604407, 0.1012499851, 0.1010526404),
expect_equivalent(imputation[['tenx']][1, 1:5], c(0.1010272982, 0.1480327620, 0.2882094083, 0.1549154381, 0.1010290263),
tolerance = 1e-8)
})

0 comments on commit a7db077

Please sign in to comment.