Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Joshua Shapiro <josh.shapiro@ccdatalab.org>
  • Loading branch information
sjspielman and jashapiro authored Sep 25, 2024
1 parent ac6929c commit 9b90c0a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
7 changes: 2 additions & 5 deletions packages/rOpenScPCA/R/evaluate-clusters.R
Original file line number Diff line number Diff line change
Expand Up @@ -222,15 +222,12 @@ calculate_stability <- function(

resampled_df <- calculate_clusters(resampled_pca, ...)

ari <- pdfCluster::adj.rand.index(resampled_df$cluster, clusters[sample_cells])
ari <- pdfCluster::adj.rand.index(resampled_df$cluster, original_clusters)

# return df with ari and clustering parameters
ari_df <- resampled_df |>
dplyr::slice(1) |>
dplyr::select(
-"cell_id",
-"cluster"
) |>
dplyr::select(!c("cell_id", "cluster")) |>
dplyr::mutate(
replicate = i, # define this variable here to ensure it's numeric
ari = ari
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ test_that("calculate_stability works as expected with object and pc_name", {

test_that("calculate_stability errors as expected", {
expect_error({
# mismatched cluster vector length
calculate_stability(test_mat, cluster_df$cluster[1:5])
})

Expand Down

0 comments on commit 9b90c0a

Please sign in to comment.