Gamgee
You miserable little maggot. I'll stove your head in!
|
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <limits.h>
#include <errno.h>
#include <ctype.h>
#include <sys/stat.h>
#include "htslib/synced_bcf_reader.h"
#include "htslib/kseq.h"
#include "htslib/khash_str2int.h"
Classes | |
struct | region1_t |
struct | _region_t |
Macros | |
#define | MAX_CSI_COOR 0x7fffffff |
Typedefs | |
typedef struct _region_t | region_t |
Functions | |
char * | bcf_sr_strerror (int errnum) |
int | bcf_sr_set_regions (bcf_srs_t *readers, const char *regions, int is_file) |
int | bcf_sr_set_targets (bcf_srs_t *readers, const char *targets, int is_file, int alleles) |
int | bcf_sr_add_reader (bcf_srs_t *files, const char *fname) |
bcf_srs_t * | bcf_sr_init (void) |
void | bcf_sr_destroy (bcf_srs_t *files) |
void | bcf_sr_remove_reader (bcf_srs_t *files, int i) |
void | debug_buffer (FILE *fp, bcf_sr_t *reader) |
void | debug_buffers (FILE *fp, bcf_srs_t *files) |
int | _reader_next_line (bcf_srs_t *files) |
int | bcf_sr_next_line (bcf_srs_t *files) |
int | bcf_sr_seek (bcf_srs_t *readers, const char *seq, int pos) |
int | bcf_sr_set_samples (bcf_srs_t *files, const char *fname, int is_file) |
bcf_sr_regions_t * | bcf_sr_regions_init (const char *regions, int is_file, int ichr, int ifrom, int ito) |
void | bcf_sr_regions_destroy (bcf_sr_regions_t *reg) |
int | bcf_sr_regions_seek (bcf_sr_regions_t *reg, const char *seq) |
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 *reg) |
#define MAX_CSI_COOR 0x7fffffff |
int _reader_next_line | ( | bcf_srs_t * | files | ) |
int bcf_sr_add_reader | ( | bcf_srs_t * | readers, |
const char * | fname | ||
) |
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.
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.
void bcf_sr_regions_destroy | ( | bcf_sr_regions_t * | reg | ) |
void bcf_sr_regions_flush | ( | bcf_sr_regions_t * | reg | ) |
bcf_sr_regions_t* bcf_sr_regions_init | ( | const char * | regions, |
int | is_file, | ||
int | ichr, | ||
int | ifrom, | ||
int | ito | ||
) |
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 | ||
) |
int bcf_sr_regions_seek | ( | bcf_sr_regions_t * | reg, |
const char * | seq | ||
) |
void bcf_sr_remove_reader | ( | bcf_srs_t * | files, |
int | i | ||
) |
int bcf_sr_seek | ( | bcf_srs_t * | readers, |
const char * | seq, | ||
int | pos | ||
) |
bcf_sr_seek() - set all readers to selected position : sequence name; NULL to seek to start : 0-based coordinate
int bcf_sr_set_regions | ( | bcf_srs_t * | readers, |
const char * | regions, | ||
int | is_file | ||
) |
int bcf_sr_set_samples | ( | bcf_srs_t * | readers, |
const char * | samples, | ||
int | is_file | ||
) |
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.
int bcf_sr_set_targets | ( | bcf_srs_t * | readers, |
const char * | targets, | ||
int | is_file, | ||
int | alleles | ||
) |
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. 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.
char* bcf_sr_strerror | ( | int | errnum | ) |
void debug_buffer | ( | FILE * | fp, |
bcf_sr_t * | reader | ||
) |
void debug_buffers | ( | FILE * | fp, |
bcf_srs_t * | files | ||
) |