File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change 44
55## VIASH START
66par = {
7- "input" : "resources_test/task_cyto_batch_integration/mouse_spleen_flow_cytometry_subset/censored_split2 .h5ad" ,
8- "output" : "resources_test/task_cyto_batch_integration/mouse_spleen_flow_cytometry_subset/output_harmony_split2 .h5ad" ,
7+ "input" : "/Users/putri.g/Documents/cytobenchmark/debug_general/_viash_par/input_1/censored_split1 .h5ad" ,
8+ "output" : "/Users/putri.g/Documents/cytobenchmark/debug_general/_viash_par/output_1/output_harmony_split1 .h5ad" ,
99}
1010meta = {"name" : "harmonypy" }
1111## VIASH END
1212
1313print ("Reading and preparing input files" , flush = True )
1414adata = ad .read_h5ad (par ["input" ])
1515
16+ # harmony can't handle integer batch labels
1617adata .obs ["batch_str" ] = adata .obs ["batch" ].astype (str )
1718
1819markers_to_correct = adata .var [adata .var ["to_correct" ]].index .to_numpy ()
2122adata_to_correct = adata [:, markers_to_correct ].copy ()
2223
2324print ("Run harmony" , flush = True )
24- # harmony can't handle integer batch labels
25+
26+ # TODO numerical instability in kmeans causing problem with harmony.
27+ # so adding a very small value to all entries to make sure there are no zeros
28+ epsilon = 1e-20
2529
2630out = harmonypy .run_harmony (
27- data_mat = adata_to_correct .layers ["preprocessed" ],
31+ data_mat = adata_to_correct .layers ["preprocessed" ] + epsilon ,
2832 meta_data = adata_to_correct .obs ,
2933 vars_use = "batch_str" ,
3034)
You can’t perform that action at this time.
0 commit comments