-
Notifications
You must be signed in to change notification settings - Fork 0
test: add Visualization Unit Tests #49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
ed645ff
747e403
88bde28
f097b13
f55dab0
50c328b
5abb667
b7898e7
b31562a
89bf1c5
0faf7b8
1de3773
7fde883
d6c1fbb
ca42d15
92d67ba
9ad9411
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| * using log directory ‘/Users/bianjh/Documents/Projects/Development/SCOT/..Rcheck’ | ||
| * using R version 4.5.1 (2025-06-13) | ||
| * using platform: aarch64-apple-darwin20 | ||
| * R was compiled by | ||
| Apple clang version 16.0.0 (clang-1600.0.26.6) | ||
| GNU Fortran (GCC) 14.2.0 | ||
| * running under: macOS Tahoe 26.4.1 | ||
| * using session charset: UTF-8 | ||
| * checking for file ‘./DESCRIPTION’ ... ERROR | ||
| Required fields missing or empty: | ||
| ‘Author’ ‘Maintainer’ | ||
| * DONE | ||
| Status: 1 ERROR |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,6 +15,25 @@ | |
| #' @return The updated Seurat single cell object with recalculated PCA, | ||
| #' neighbors, UMAP and clusters | ||
| seurat_clustering <- function(so_in, npcs_in, resolution = 0.8, algorithm = 3) { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we should consider renaming this function to a verb. see https://style.tidyverse.org/functions.html @wong-nw |
||
| # Validate npcs_in: must be a positive integer >= 3 (for UMAP n.components) | ||
| if (!is.numeric(npcs_in) || npcs_in != as.integer(npcs_in) || npcs_in <= 0) { | ||
| rlang::abort("npcs_in must be a positive integer") | ||
| } | ||
|
|
||
| if (npcs_in < 3) { | ||
| rlang::abort("npcs_in must be at least 3 for UMAP computation") | ||
| } | ||
|
|
||
| # Validate resolution: must be positive | ||
| if (!is.numeric(resolution) || resolution <= 0) { | ||
| rlang::abort("resolution must be a positive numeric value") | ||
| } | ||
|
|
||
| # Validate algorithm: must be 1, 2, or 3 | ||
| if (!is.numeric(algorithm) || !(algorithm %in% c(1, 2, 3))) { | ||
| rlang::abort("algorithm must be 1 (Louvain), 2 (Leiden), or 3 (SLM)") | ||
| } | ||
|
|
||
|
Comment on lines
+18
to
+36
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nice input validation! |
||
| so <- Seurat::RunPCA( | ||
| object = so_in, | ||
| features = Seurat::VariableFeatures(object = so_in), | ||
|
|
@@ -24,8 +43,8 @@ seurat_clustering <- function(so_in, npcs_in, resolution = 0.8, algorithm = 3) { | |
| so <- Seurat::FindNeighbors(so, dims = 1:npcs_in) | ||
| so <- Seurat::FindClusters( | ||
| so, | ||
| resolution = 0.8, | ||
| algorithm = 3, | ||
| resolution = resolution, | ||
| algorithm = algorithm, | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. good catch! using parameters is important |
||
| verbose = TRUE | ||
| ) | ||
| so <- Seurat::RunUMAP(so, dims = 1:npcs_in, n.components = 3) | ||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since this function currently only supports mouse -> human perhaps the name should reflect that. in the future we can add a more generic function that handles any-to-any genome.