def test_find_index_cram_crai(): """Test to find a cram index""" # GIVEN a case with this type of alignment files # bam_file.cram # bam_file.cram.crai with tempfile.TemporaryDirectory() as tmpdirname: with tempfile.NamedTemporaryFile(dir=tmpdirname, suffix="cram.crai") as idx: cram_file = idx.name.replace(".crai", "") # THEN the find_index function should return the correct index file index = find_index(cram_file) assert index.endswith("cram.crai")
def test_find_index_bam_bai(case_obj): # GIVEN a case with this type of alignment files # bam_file.bam # bam_file.bam.bai with tempfile.TemporaryDirectory() as tmpdirname: with tempfile.NamedTemporaryFile(dir=tmpdirname, suffix="bam.bai") as idx: bam_file = idx.name.replace(".bai", "") # THEN the find_index function should return the correct index file index = find_index(bam_file) assert index.endswith("bam.bai")