@@ -188,3 +188,49 @@ def test_cli_xenium(runner: CliRunner, dataset: str) -> None:
188188 )
189189 assert result .exit_code == 0 , result .output
190190 _ = read_zarr (output_zarr )
191+
192+ @skip_if_below_python_version ()
193+ @pytest .mark .parametrize (
194+ ("dataset" , "gex_only" ,),
195+ [("Xenium_V1_human_Lung_2fov_outs" , False ),
196+ ("Xenium_V1_human_Lung_2fov_outs" , True ),
197+ ("Xenium_V1_Human_Ovary_tiny_outs" , False ),
198+ ("Xenium_V1_Human_Ovary_tiny_outs" , True ),
199+ ("Xenium_V1_MultiCellSeg_Human_Ovary_tiny_outs" , False ),
200+ ("Xenium_V1_MultiCellSeg_Human_Ovary_tiny_outs" , True ),
201+ ("Xenium_V1_Protein_Human_Kidney_tiny_outs" , False ),
202+ ("Xenium_V1_Protein_Human_Kidney_tiny_outs" , True )
203+ ]
204+ )
205+ def test_xenium_other_feature_types (dataset : str , gex_only : bool ) -> None :
206+ f = Path ("./data" ) / dataset
207+ assert f .is_dir ()
208+ sdata = xenium (f , cells_as_circles = False , gex_only = gex_only )
209+ if gex_only :
210+ assert set (sdata ["table" ].var ["feature_types" ]) == {"Gene Expression" }
211+ elif dataset == "Xenium_V1_human_Lung_2fov_outs" :
212+ assert set (sdata ["table" ].var ["feature_types" ]) == {"Deprecated Codeword" ,
213+ "Gene Expression" ,
214+ "Negative Control Codeword" ,
215+ "Negative Control Probe" ,
216+ "Unassigned Codeword" }
217+ elif dataset in {"Xenium_V1_Human_Ovary_tiny_outs" , "Xenium_V1_MultiCellSeg_Human_Ovary_tiny_outs" }:
218+ assert set (sdata ["table" ].var ["feature_types" ]) == {"Gene Expression" ,
219+ "Genomic Control" ,
220+ "Negative Control Codeword" ,
221+ "Negative Control Probe" ,
222+ "Unassigned Codeword" }
223+ elif dataset == "Xenium_V1_Protein_Human_Kidney_tiny_outs" :
224+ assert set (sdata ["table" ].var ["feature_types" ]) == {"Gene Expression" ,
225+ "Genomic Control" ,
226+ "Negative Control Codeword" ,
227+ "Negative Control Probe" ,
228+ "Protein Expression" ,
229+ "Unassigned Codeword" }
230+ # Protein feature
231+ assert np .allclose (sdata ["table" ].X [0 :3 , sdata ["table" ].var_names .str .match ("VISTA" )].toarray ().squeeze (), [0.7 , 1.2 , 0.0 ])
232+ # RNA feature
233+ assert np .allclose (sdata ["table" ].X [[6 ,7 ,24 ], sdata ["table" ].var_names .str .match ("ACTG2" )].squeeze (), [1 , 0 , 2 ])
234+
235+ else :
236+ assert ValueError (f"Unexpected dataset { dataset } " )
0 commit comments