1- test_that(" Harmony returns seurat object with adjusted embeddings for
2- TEC data" , {
3- skip_on_ci()
4-
5- tec = getHarmonyParam(" TEC" )
6-
7- object.harmonized = do.call(harmonyBatchCorrect , tec )
8-
9- # expect_snapshot_file(
10- # .drawHarmonyFig(object.harmonized$adj.tsne),
11- # "tec_harm.png"
12- # )
13-
14- expect_equal(mean(object.harmonized [[" Harmony" ]][" Lum" ,]),
15- 0.06279209 , tolerance = 5e-1 )
16-
17- # expected_elements = c("adj.object","adj.tsne")
18- # expect_setequal(names(object.harmonized), expected_elements)
19- })
20-
21- test_that(" Harmony returns seurat object with adjusted embeddings for Chariou
22- data" , {
23- skip_on_ci()
24- chariou = getHarmonyParam(" Chariou" )
25-
26- object.harmonized = do.call(harmonyBatchCorrect , chariou )
27-
28-
29- # expect_snapshot_file(
30- # .drawHarmonyFig(object.harmonized$adj.tsne),
31- # "char_harm.png"
32- # )
33-
34- expect_equal(mean(object.harmonized [[" Harmony" ]][" Ccl8" ,]),
35- 0.2046126 , tolerance = 5e-1 )
36-
37- # expected_elements = c("adj.object","adj.tsne")
38- # expect_setequal(names(object.harmonized), expected_elements)
39- })
40-
41- test_that(" Harmony returns seurat object with adjusted embeddings for
42- pbmc_single data" , {
43- skip_on_ci()
44- pbmc.single = getHarmonyParam(" pbmc_single" )
45-
46- object.harmonized = do.call(harmonyBatchCorrect , pbmc.single )
47-
48-
49- # expect_snapshot_file(
50- # .drawHarmonyFig(object.harmonized$adj.tsne),
51- # "pbmc_single_harm.png"
52- # )
53-
54- expect_equal(mean(object.harmonized [[" Harmony" ]][" CLU" ,]),
55- - 0.002671558 , tolerance = 5e-1 )
56-
57- # expected_elements = c("adj.object","adj.tsne")
58- # expect_setequal(names(object.harmonized), expected_elements)
59- })
60-
61- test_that(" Harmony returns seurat object with adjusted embeddings for
62- nsclc_multi data" , {
63- skip_on_ci()
64- nsclc.multi = getHarmonyParam(" nsclc_multi" )
65-
66- object.harmonized = do.call(harmonyBatchCorrect , nsclc.multi )
67-
68- # expect_snapshot_file(
69- # .drawHarmonyFig(object.harmonized$adj.tsne),
70- # "nsclc_multi_harm.png"
71- # )
72-
73- expect_equal(mean(object.harmonized [[" Harmony" ]][" LCN2" ,]),
74- 0.1265227 , tolerance = 5e-1 )
75-
76- # expected_elements = c("adj.object","adj.tsne")
77- # expect_setequal(names(object.harmonized), expected_elements)
78- })
79-
80- test_that(" Harmony returns seurat object with adjusted embeddings for
81- BRCA data" , {
82- skip_on_ci()
83-
84- brca = getHarmonyParam(" BRCA" )
85-
86- object.harmonized = do.call(harmonyBatchCorrect , brca )
87-
88- # expect_snapshot_file(
89- # .drawHarmonyFig(object.harmonized$adj.tsne),
90- # "BRCA_harm.png"
91- # )
92-
93- expect_equal(mean(object.harmonized [[" Harmony" ]][" SCGB2A2" ,]),
94- - 0.1078249 , tolerance = 5e-1 )
95-
96- # expected_elements = c("adj.object","adj.tsne")
97- # expect_setequal(names(object.harmonized), expected_elements)
98- })
99-
100- test_that(" Harmony provides warning when genes are not found in the data" , {
101- skip_on_ci()
102- tec = getHarmonyParam(" TEC" )
103-
104- expect_warning(harmonyBatchCorrect(
105- object = tec $ object ,
106- nvar = tec $ nvar ,
107- genes.to.add = c(" wrong_gene" ," wrong_gene2" ),
108- group.by.var = tec $ group.by.var ),
109- " specified genes were not found and therefore cannot be added" )
110-
111- })
112-
113- test_that(" Harmony stops when variable features to subset by exceeds number of
114- genes in the data" , {
115- skip_on_ci()
116- tec = getHarmonyParam(" TEC" )
117-
118- expect_error(harmonyBatchCorrect(
119- object = tec $ object ,
120- nvar = 100000 ,
121- genes.to.add = NULL ,
122- group.by.var = tec $ group.by.var ),
123- " nvar exceed total number of variable genes in the data" )
124-
125- })
1+ # test_that("Harmony returns seurat object with adjusted embeddings for
2+ # TEC data", {
3+ # skip_on_ci()
4+ #
5+ # tec = getHarmonyParam("TEC")
6+ #
7+ # object.harmonized = do.call(harmonyBatchCorrect, tec)
8+ #
9+ # # expect_snapshot_file(
10+ # # .drawHarmonyFig(object.harmonized$adj.tsne),
11+ # # "tec_harm.png"
12+ # # )
13+ #
14+ # expect_equal(mean(object.harmonized[["Harmony"]]["Lum",]),
15+ # 0.06279209, tolerance = 5e-1)
16+ #
17+ # # expected_elements = c("adj.object","adj.tsne")
18+ # # expect_setequal(names(object.harmonized), expected_elements)
19+ # })
20+ #
21+ # test_that("Harmony returns seurat object with adjusted embeddings for Chariou
22+ # data", {
23+ # skip_on_ci()
24+ # chariou = getHarmonyParam("Chariou")
25+ #
26+ # object.harmonized = do.call(harmonyBatchCorrect, chariou)
27+ #
28+ #
29+ # # expect_snapshot_file(
30+ # # .drawHarmonyFig(object.harmonized$adj.tsne),
31+ # # "char_harm.png"
32+ # # )
33+ #
34+ # expect_equal(mean(object.harmonized[["Harmony"]]["Ccl8",]),
35+ # 0.2046126, tolerance = 5e-1)
36+ #
37+ # #expected_elements = c("adj.object","adj.tsne")
38+ # #expect_setequal(names(object.harmonized), expected_elements)
39+ # })
40+ #
41+ # test_that("Harmony returns seurat object with adjusted embeddings for
42+ # pbmc_single data", {
43+ # skip_on_ci()
44+ # pbmc.single = getHarmonyParam("pbmc_single")
45+ #
46+ # object.harmonized = do.call(harmonyBatchCorrect, pbmc.single)
47+ #
48+ #
49+ # # expect_snapshot_file(
50+ # # .drawHarmonyFig(object.harmonized$adj.tsne),
51+ # # "pbmc_single_harm.png"
52+ # # )
53+ #
54+ # expect_equal(mean(object.harmonized[["Harmony"]]["CLU",]),
55+ # -0.002671558, tolerance = 5e-1)
56+ #
57+ # # expected_elements = c("adj.object","adj.tsne")
58+ # # expect_setequal(names(object.harmonized), expected_elements)
59+ # })
60+ #
61+ # test_that("Harmony returns seurat object with adjusted embeddings for
62+ # nsclc_multi data", {
63+ # skip_on_ci()
64+ # nsclc.multi = getHarmonyParam("nsclc_multi")
65+ #
66+ # object.harmonized = do.call(harmonyBatchCorrect, nsclc.multi)
67+ #
68+ # # expect_snapshot_file(
69+ # # .drawHarmonyFig(object.harmonized$adj.tsne),
70+ # # "nsclc_multi_harm.png"
71+ # # )
72+ #
73+ # expect_equal(mean(object.harmonized[["Harmony"]]["LCN2",]),
74+ # 0.1265227, tolerance = 5e-1)
75+ #
76+ # # expected_elements = c("adj.object","adj.tsne")
77+ # # expect_setequal(names(object.harmonized), expected_elements)
78+ # })
79+ #
80+ # test_that("Harmony returns seurat object with adjusted embeddings for
81+ # BRCA data", {
82+ # skip_on_ci()
83+ #
84+ # brca = getHarmonyParam("BRCA")
85+ #
86+ # object.harmonized = do.call(harmonyBatchCorrect, brca)
87+ #
88+ # # expect_snapshot_file(
89+ # # .drawHarmonyFig(object.harmonized$adj.tsne),
90+ # # "BRCA_harm.png"
91+ # # )
92+ #
93+ # expect_equal(mean(object.harmonized[["Harmony"]]["SCGB2A2",]),
94+ # -0.1078249, tolerance = 5e-1)
95+ #
96+ # # expected_elements = c("adj.object","adj.tsne")
97+ # # expect_setequal(names(object.harmonized), expected_elements)
98+ # })
99+ #
100+ # test_that("Harmony provides warning when genes are not found in the data", {
101+ # skip_on_ci()
102+ # tec = getHarmonyParam("TEC")
103+ #
104+ # expect_warning(harmonyBatchCorrect(
105+ # object = tec$object,
106+ # nvar = tec$nvar,
107+ # genes.to.add = c("wrong_gene","wrong_gene2"),
108+ # group.by.var = tec$group.by.var),
109+ # "specified genes were not found and therefore cannot be added")
110+ #
111+ # })
112+ #
113+ # test_that("Harmony stops when variable features to subset by exceeds number of
114+ # genes in the data", {
115+ # skip_on_ci()
116+ # tec = getHarmonyParam("TEC")
117+ #
118+ # expect_error(harmonyBatchCorrect(
119+ # object = tec$object,
120+ # nvar = 100000,
121+ # genes.to.add = NULL,
122+ # group.by.var = tec$group.by.var),
123+ # "nvar exceed total number of variable genes in the data")
124+ #
125+ # })
0 commit comments