Function rust_htslib::htslib::bcf_sr_set_targets [] [src]

pub unsafe extern "C" fn bcf_sr_set_targets(
    readers: *mut bcf_srs_t,
    targets: *const c_char,
    is_file: c_int,
    alleles: c_int
) -> c_int

bcf_sr_set_targets(), bcf_sr_set_regions() - init targets/regions @readers: holder of the open readers @targets: list of regions, one-based and inclusive. @is_fname: 0: targets is a comma-separated list of regions (chr,chr:from-to) 1: targets is a tabix indexed file with a list of regions (<chr,pos> or <chr,from,to>)

Returns 0 if the call succeeded, or -1 on error.

Both functions behave the same way, unlisted positions will be skipped by bcf_sr_next_line(). However, there is an important difference: regions use index to jump to desired positions while targets streams the whole files and merely skip unlisted positions.

Moreover, bcf_sr_set_targets() accepts an optional parameter $alleles which is intepreted as a 1-based column index in the tab-delimited file where alleles are listed. This in principle enables to perform the COLLAPSE_* logic also with tab-delimited files. However, the current implementation considers the alleles merely as a suggestion for prioritizing one of possibly duplicate VCF lines. It is up to the caller to examine targets->als if perfect match is sought after. Note that the duplicate positions in targets file are currently not supported. Targets (but not regions) can be prefixed with "^" to request logical complement, for example "^X,Y,MT" indicates that sequences X, Y and MT should be skipped.