Ejemplo n.º 1
0
def read_index(index_path: PathType,
               storage_options: Optional[Dict[str, str]] = None) -> Any:
    url = str(index_path)
    if url.endswith(TABIX_EXTENSION):
        return read_tabix(url, storage_options=storage_options)
    elif url.endswith(CSI_EXTENSION):
        return read_csi(url, storage_options=storage_options)
    else:
        raise ValueError("Only .tbi or .csi indexes are supported.")
Ejemplo n.º 2
0
def test_record_counts_csi(shared_datadir, vcf_file, is_path):
    # Check record counts in csi with actual count of VCF
    vcf_path = path_for_test(shared_datadir, vcf_file, is_path)
    csi_path = get_csi_path(vcf_path)
    assert csi_path is not None
    csi = read_csi(csi_path)

    for i, contig in enumerate(VCF(vcf_path).seqnames):
        assert csi.record_counts[i] == count_variants(vcf_path, contig)
Ejemplo n.º 3
0
def test_read_csi__invalid_csi(shared_datadir, file, is_path):
    with pytest.raises(ValueError, match=r"File not in CSI format."):
        read_csi(path_for_test(shared_datadir, file, is_path))