-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_sampling_quick.R
More file actions
40 lines (33 loc) · 1.11 KB
/
test_sampling_quick.R
File metadata and controls
40 lines (33 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/env Rscript
# Quick test of data sampling functions
cat("Quick Data Sampling Test\n")
cat("========================\n\n")
# Source functions
source("R/data_sampling.R")
# Test memory estimation function
cat("Testing memory estimation...\n")
test_stats <- estimate_memory_usage(list(
meta.data = data.frame(a = 1:1000),
reductions = list()
), include_assays = FALSE)
cat(sprintf("Memory stats calculated: %.2f MB\n", test_stats$metadata_mb))
# Test UMAP extraction
cat("\nTesting UMAP extraction function...\n")
# Create mock Seurat-like object
mock_obj <- list(
reductions = list(
umap = list(
cell.embeddings = matrix(rnorm(200), ncol = 2,
dimnames = list(paste0("Cell", 1:100), c("UMAP_1", "UMAP_2")))
)
),
meta.data = data.frame(
seurat_clusters = factor(sample(0:3, 100, replace = TRUE)),
orig.ident = rep("Sample1", 100)
)
)
class(mock_obj) <- "Seurat"
# Extract UMAP
umap_data <- extract_umap_data(mock_obj, sample_n = 50)
cat(sprintf("Extracted %d cells with %d columns\n", nrow(umap_data), ncol(umap_data)))
cat("\n✅ Quick test passed!\n")