Skip to content

Commit

Permalink
Merge remote-tracking branch 'AlexsLemonade/main' into allyhawkins/on…
Browse files Browse the repository at this point in the history
…tology-exploration
  • Loading branch information
allyhawkins committed Dec 17, 2024
2 parents 991be1d + e1daebb commit 2fab7a5
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ get_cluster_stats <- function(sce,
return(stats_df)
}) |>
dplyr::bind_rows(.id = "cluster_params") |>
dplyr::left_join(all_cluster_results, by = c("cell_id", "cluster_params"))
dplyr::left_join(all_cluster_results, by = c("cell_id", "cluster_params", "cluster"))

return(all_stats_df)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,21 @@ all_stats <- split_umap_df |>
purrr::map(\(df) {get_cluster_stats(sce,df)})
```

Before we show any statistics, we will first show the number of clusters for each set of parameters.
For any cases where we only see 1 cluster, no distributions will be shown in the plots.

```{r}
all_stats |>
purrr::imap(\(df, method){
df |>
dplyr::select(resolution, nn, cluster) |>
dplyr::group_by(resolution, nn) |>
dplyr::summarise(num_of_clusters = length(unique(cluster))) |>
knitr::kable()
})
```


### Silhouette width

```{r}
Expand All @@ -169,17 +184,17 @@ all_stats |>

```{r, warning=FALSE, message=FALSE}
# calculate cluster stability
stability_stats <- split_umap_df |>
stability_stats <- split_umap_df |>
purrr::map(\(df){ get_cluster_stability(sce, df, params$threads)})
```


```{r, warning=FALSE, message=FALSE}
# plot stability across all parameters
stability_stats |>
stability_stats |>
purrr::imap(\(df, cluster_method){
# plot stability across all values of k
ggplot(df, aes(x = nn, y = ari)) +
geom_jitter(width = 0.1) +
Expand All @@ -198,8 +213,8 @@ stability_stats |>
quantile(x, 0.75)
}
)
})
```

Expand Down

0 comments on commit 2fab7a5

Please sign in to comment.