Skip to content

Commit

Permalink
Updated ComputeProximityScore
Browse files Browse the repository at this point in the history
  • Loading branch information
pcamara committed Apr 1, 2024
1 parent 7546054 commit cb9e481
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
8 changes: 6 additions & 2 deletions R/ComputeProximityScore.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#' ComputeProximityScore
#' @description Compute the average distance between the query dataset and the nearest 10 training datasets normalized by the average distance between training datasets
#' @description Compute the average inverse distance between the query dataset and the nearest 10 training datasets
#' normalized by the average distance between training datasets. This score is expected to range between 0 (for
#' single-cell reference data unrelated to the query bulk data) and approximately 1 (for single-cell reference data
#' that accurately match the query bulk data). the score depends on the parameters of CoDecon such as the number of
#' training data points and therefore score comparisons should be performed for the same choice of parameters.
#' @import pdist
#' @import Matrix
#' @param cond ConDecon object
Expand All @@ -26,7 +30,7 @@ ComputeProximityScore <- function(cond) {
euclid_train[i[1],i[2:(k)]]
}))

cond$proximity_score <- Matrix::rowMeans(knn_dist/mean(as.vector(knn_dist_train)))
cond$proximity_score <- Matrix::rowMeans(mean(as.vector(knn_dist_train))/knn_dist)

return(cond)
}
6 changes: 5 additions & 1 deletion man/ComputeProximityScore.Rd

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

0 comments on commit cb9e481

Please sign in to comment.