NVBIO
|
Go to the source code of this file.
Classes | |
struct | _bcf_sr_regions_t |
struct | bcf_sr_t |
struct | bcf_srs_t |
Macros | |
#define | COLLAPSE_NONE 0 |
#define | COLLAPSE_SNPS 1 |
#define | COLLAPSE_INDELS 2 |
#define | COLLAPSE_ANY 4 |
#define | COLLAPSE_SOME 8 |
#define | COLLAPSE_BOTH (COLLAPSE_SNPS|COLLAPSE_INDELS) |
#define | bcf_sr_has_line(readers, i) (readers)->has_line[i] |
#define | bcf_sr_get_line(_readers, i) ((_readers)->has_line[i] ? ((_readers)->readers[i].buffer[0]) : NULL) |
#define | bcf_sr_region_done(_readers, i) (!(_readers)->has_line[i] && !(_readers)->readers[i].nbuffer ? 1 : 0) |
Typedefs | |
typedef struct _bcf_sr_regions_t | bcf_sr_regions_t |
Functions | |
bcf_srs_t * | bcf_sr_init (void) |
void | bcf_sr_destroy (bcf_srs_t *readers) |
int | bcf_sr_add_reader (bcf_srs_t *readers, const char *fname) |
void | bcf_sr_remove_reader (bcf_srs_t *files, int i) |
int | bcf_sr_next_line (bcf_srs_t *readers) |
int | bcf_sr_seek (bcf_srs_t *readers, const char *seq, int pos) |
int | bcf_sr_set_samples (bcf_srs_t *readers, const char *samples, int is_file) |
int | bcf_sr_set_targets (bcf_srs_t *readers, const char *targets, int is_file, int alleles) |
int | bcf_sr_set_regions (bcf_srs_t *readers, const char *regions, int is_file) |
bcf_sr_regions_t * | bcf_sr_regions_init (const char *regions, int is_file, int chr, int from, int to) |
void | bcf_sr_regions_destroy (bcf_sr_regions_t *regions) |
int | bcf_sr_regions_seek (bcf_sr_regions_t *regions, const char *chr) |
int | bcf_sr_regions_next (bcf_sr_regions_t *reg) |
int | bcf_sr_regions_overlap (bcf_sr_regions_t *reg, const char *seq, int start, int end) |
void | bcf_sr_regions_flush (bcf_sr_regions_t *regs) |
#define bcf_sr_get_line | ( | _readers, | |
i | |||
) | ((_readers)->has_line[i] ? ((_readers)->readers[i].buffer[0]) : NULL) |
Definition at line 146 of file synced_bcf_reader.h.
#define bcf_sr_has_line | ( | readers, | |
i | |||
) | (readers)->has_line[i] |
Definition at line 145 of file synced_bcf_reader.h.
#define bcf_sr_region_done | ( | _readers, | |
i | |||
) | (!(_readers)->has_line[i] && !(_readers)->readers[i].nbuffer ? 1 : 0) |
Definition at line 147 of file synced_bcf_reader.h.
#define COLLAPSE_ANY 4 |
Definition at line 39 of file synced_bcf_reader.h.
#define COLLAPSE_BOTH (COLLAPSE_SNPS|COLLAPSE_INDELS) |
Definition at line 41 of file synced_bcf_reader.h.
#define COLLAPSE_INDELS 2 |
Definition at line 38 of file synced_bcf_reader.h.
#define COLLAPSE_NONE 0 |
Definition at line 36 of file synced_bcf_reader.h.
#define COLLAPSE_SNPS 1 |
Definition at line 37 of file synced_bcf_reader.h.
#define COLLAPSE_SOME 8 |
Definition at line 40 of file synced_bcf_reader.h.
typedef struct _bcf_sr_regions_t bcf_sr_regions_t |
bcf_sr_add_reader() - open new reader : holder of the open readers : the VCF file
Returns 1 if the call succeeded, or 0 on error.
See also the bcf_srs_t data structure for parameters controlling the reader's logic.
Definition at line 83 of file synced_bcf_reader.c.
void bcf_sr_destroy | ( | bcf_srs_t * | readers) |
Destroy bcf_srs_t struct
Definition at line 198 of file synced_bcf_reader.c.
bcf_srs_t* bcf_sr_init | ( | void | ) |
Init bcf_srs_t struct
Definition at line 178 of file synced_bcf_reader.c.
int bcf_sr_next_line | ( | bcf_srs_t * | readers) |
bcf_sr_next_line() - the iterator : holder of the open readers
Returns the number of readers which have the current line (bcf_sr_t.buffer[0]) set at this position. Use the bcf_sr_has_line macro to determine which of the readers are set.
Definition at line 609 of file synced_bcf_reader.c.
void bcf_sr_regions_destroy | ( | bcf_sr_regions_t * | regions) |
Definition at line 976 of file synced_bcf_reader.c.
void bcf_sr_regions_flush | ( | bcf_sr_regions_t * | regs) |
Definition at line 1179 of file synced_bcf_reader.c.
bcf_sr_regions_t* bcf_sr_regions_init | ( | const char * | regions, |
int | is_file, | ||
int | chr, | ||
int | from, | ||
int | to | ||
) |
Definition at line 909 of file synced_bcf_reader.c.
int bcf_sr_regions_next | ( | bcf_sr_regions_t * | reg) |
Definition at line 1017 of file synced_bcf_reader.c.
int bcf_sr_regions_overlap | ( | bcf_sr_regions_t * | reg, |
const char * | seq, | ||
int | start, | ||
int | end | ||
) |
Definition at line 1151 of file synced_bcf_reader.c.
int bcf_sr_regions_seek | ( | bcf_sr_regions_t * | regions, |
const char * | chr | ||
) |
Definition at line 1001 of file synced_bcf_reader.c.
void bcf_sr_remove_reader | ( | bcf_srs_t * | files, |
int | i | ||
) |
Definition at line 213 of file synced_bcf_reader.c.
bcf_sr_seek() - set all readers to selected position : sequence name; NULL to seek to start : 0-based coordinate
Definition at line 646 of file synced_bcf_reader.c.
Definition at line 60 of file synced_bcf_reader.c.
bcf_sr_set_samples() - sets active samples : holder of the open readers : this can be one of: file name with one sample per line; or column-separated list of samples; or '-' for a list of samples shared by all files. If first character is the exclamation mark, all but the listed samples are included. : 0: list of samples; 1: file with sample names
Returns 1 if the call succeeded, or 0 on error.
Definition at line 664 of file synced_bcf_reader.c.
bcf_sr_set_targets(), bcf_sr_set_regions() - init targets/regions : holder of the open readers : list of regions, one-based and inclusive. : 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.
Definition at line 74 of file synced_bcf_reader.c.