@@ -149,3 +149,69 @@ def test_oxbow_gtf_query(data_dir, test_interval, test_itv):
149149 assert col in df .columns
150150 assert df .shape [0 ] > 0
151151
152+
153+ def test_oxbow_bigwig_query (data_dir , test_interval , test_itv ):
154+ path = f"{ data_dir } /bigwig_{ test_itv } .bw"
155+ rdr = TabFileReaderWithOxbow (path )
156+ df = rdr .query (test_interval )
157+ # BigWig should have chrom,start,end,value
158+ for col in FMT2COLUMNS ["bigwig" ]:
159+ assert col in df .columns
160+ assert df .shape [0 ] > 0
161+
162+
163+ @pytest .mark .skipif (
164+ platform .system () == "Windows" or not check_tool ("samtools" )[0 ],
165+ reason = "samtools not available or non-Unix" ,
166+ )
167+ def test_tabix_bam_query (data_dir , test_interval , test_itv ):
168+ path = f"{ data_dir } /bam_{ test_itv } .bam"
169+ indexed_path = index_tab_file (path )
170+ rdr = TabFileReaderWithTabix (indexed_path )
171+ df = rdr .query (test_interval )
172+ assert list (df .columns ) == FMT2COLUMNS ["bam" ]
173+ assert df .shape [0 ] > 0
174+
175+
176+ @pytest .mark .skipif (
177+ platform .system () == "Windows" or not check_tool ("tabix" )[0 ],
178+ reason = "tabix not available or non-Unix" ,
179+ )
180+ def test_tabix_gtf_query (data_dir , test_interval , test_itv ):
181+ path = f"{ data_dir } /gtf_{ test_itv } .gtf"
182+ indexed_path = index_tab_file (path )
183+ rdr = TabFileReaderWithTabix (indexed_path )
184+ df = rdr .query (test_interval )
185+ assert list (df .columns ) == FMT2COLUMNS ["gtf" ]
186+ assert df .shape [0 ] > 0
187+
188+
189+ @pytest .mark .skipif (
190+ platform .system () == "Windows"
191+ or not (check_tool ("bgzip" )[0 ] and check_tool ("pairix" )[0 ]),
192+ reason = "bgzip/pairix not available or non-Unix" ,
193+ )
194+ def test_tabix_bedpe_query (data_dir , test_interval , test_itv ):
195+ path = f"{ data_dir } /bedpe_{ test_itv } .bedpe"
196+ indexed_path = index_tab_file (path )
197+ rdr = TabFileReaderWithTabix (indexed_path )
198+ df_same = rdr .query (test_interval )
199+ assert list (df_same .columns ) == FMT2COLUMNS ["bedpe" ]
200+ assert df_same .shape [0 ] > 0
201+ df_2d = rdr .query (test_interval , second = test_interval )
202+ assert df_2d .shape [0 ] > 0
203+
204+
205+ @pytest .mark .skipif (
206+ platform .system () == "Windows" or not check_tool ("samtools" )[0 ],
207+ reason = "samtools not available or non-Unix" ,
208+ )
209+ def test_oxbow_bam_query (data_dir , test_interval , test_itv ):
210+ path = f"{ data_dir } /bam_{ test_itv } .bam"
211+ indexed_path = index_tab_file (path )
212+ rdr = TabFileReaderWithOxbow (indexed_path )
213+ df = rdr .query (test_interval )
214+ assert df .shape [0 ] > 0
215+ # Check a few SAM/BAM fields commonly present
216+ for col in FMT2COLUMNS ["bam" ]:
217+ assert col in df .columns
0 commit comments