Gamgee
You miserable little maggot. I'll stove your head in!
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <ctype.h>
#include <zlib.h>
#include "htslib/sam.h"
#include "htslib/bgzf.h"
#include "cram/cram.h"
#include "htslib/hfile.h"
#include "htslib/khash.h"
#include "htslib/kseq.h"
#include "htslib/kstring.h"
#include <assert.h>
Classes | |
struct | hts_cram_idx_t |
struct | cstate_t |
struct | __linkbuf_t |
struct | mempool_t |
struct | __bam_mplp_t |
Macros | |
#define | _read_token(_p) (_p); for (; *(_p) && *(_p) != '\t'; ++(_p)); if (*(_p) != '\t') goto err_ret; *(_p)++ = 0 |
#define | _read_token_aux(_p) (_p); for (; *(_p) && *(_p) != '\t'; ++(_p)); *(_p)++ = 0 |
#define | _get_mem(type_t, _x, _s, _l) ks_resize((_s), (_s)->l + (_l)); *(_x) = (type_t*)((_s)->s + (_s)->l); (_s)->l += (_l) |
#define | _parse_err(cond, msg) do { if ((cond) && hts_verbose >= 1) { fprintf(stderr, "[E::%s] " msg "\n", __func__); goto err_ret; } } while (0) |
#define | _parse_warn(cond, msg) if ((cond) && hts_verbose >= 2) fprintf(stderr, "[W::%s] " msg "\n", __func__) |
#define | STRNCMP(a, b, n) (strncasecmp((a),(b),(n)) || strlen(a)!=(n)) |
#define | _cop(c) ((c)&BAM_CIGAR_MASK) |
#define | _cln(c) ((c)>>BAM_CIGAR_SHIFT) |
Typedefs | |
typedef struct hts_cram_idx_t | hts_cram_idx_t |
typedef struct __linkbuf_t | lbnode_t |
Functions | |
typedef | khash_t (s2i) |
void | bam_hdr_destroy (bam_hdr_t *h) |
bam_hdr_t * | bam_hdr_dup (const bam_hdr_t *h0) |
bam_hdr_t * | bam_hdr_read (BGZF *fp) |
int | bam_hdr_write (BGZF *fp, const bam_hdr_t *h) |
int | bam_name2id (bam_hdr_t *h, const char *ref) |
bam1_t * | bam_init1 () |
void | bam_destroy1 (bam1_t *b) |
bam1_t * | bam_copy1 (bam1_t *bdst, const bam1_t *bsrc) |
bam1_t * | bam_dup1 (const bam1_t *bsrc) |
int | bam_cigar2qlen (int n_cigar, const uint32_t *cigar) |
int | bam_cigar2rlen (int n_cigar, const uint32_t *cigar) |
int32_t | bam_endpos (const bam1_t *b) |
int | bam_read1 (BGZF *fp, bam1_t *b) |
int | bam_write1 (BGZF *fp, const bam1_t *b) |
int | bam_index_build (const char *fn, int min_shift) |
hts_idx_t * | sam_index_load (samFile *fp, const char *fn) |
hts_itr_t * | sam_itr_queryi (const hts_idx_t *idx, int tid, int beg, int end) |
hts_itr_t * | sam_itr_querys (const hts_idx_t *idx, bam_hdr_t *hdr, const char *region) |
bam_hdr_t * | sam_hdr_parse (int l_text, const char *text) |
bam_hdr_t * | sam_hdr_read (htsFile *fp) |
int | sam_hdr_write (htsFile *fp, const bam_hdr_t *h) |
int | sam_parse1 (kstring_t *s, bam_hdr_t *h, bam1_t *b) |
int | sam_read1 (htsFile *fp, bam_hdr_t *h, bam1_t *b) |
int | sam_format1 (const bam_hdr_t *h, const bam1_t *b, kstring_t *str) |
int | sam_write1 (htsFile *fp, const bam_hdr_t *h, const bam1_t *b) |
void | bam_aux_append (bam1_t *b, const char tag[2], char type, int len, uint8_t *data) |
uint8_t * | bam_aux_get (const bam1_t *b, const char tag[2]) |
int | bam_aux_del (bam1_t *b, uint8_t *s) |
int32_t | bam_aux2i (const uint8_t *s) |
double | bam_aux2f (const uint8_t *s) |
char | bam_aux2A (const uint8_t *s) |
char * | bam_aux2Z (const uint8_t *s) |
int | sam_open_mode (char *mode, const char *fn, const char *format) |
int | bam_str2flag (const char *str) |
char * | bam_flag2str (int flag) |
typedef | khash_t (olap_hash) |
bam_plp_t | bam_plp_init (bam_plp_auto_f func, void *data) |
void | bam_plp_init_overlaps (bam_plp_t iter) |
void | bam_plp_destroy (bam_plp_t iter) |
const bam_pileup1_t * | bam_plp_next (bam_plp_t iter, int *_tid, int *_pos, int *_n_plp) |
int | bam_plp_push (bam_plp_t iter, const bam1_t *b) |
const bam_pileup1_t * | bam_plp_auto (bam_plp_t iter, int *_tid, int *_pos, int *_n_plp) |
void | bam_plp_reset (bam_plp_t iter) |
void | bam_plp_set_maxcnt (bam_plp_t iter, int maxcnt) |
bam_mplp_t | bam_mplp_init (int n, bam_plp_auto_f func, void **data) |
void | bam_mplp_init_overlaps (bam_mplp_t iter) |
void | bam_mplp_set_maxcnt (bam_mplp_t iter, int maxcnt) |
void | bam_mplp_destroy (bam_mplp_t iter) |
int | bam_mplp_auto (bam_mplp_t iter, int *_tid, int *_pos, int *n_plp, const bam_pileup1_t **plp) |
#define _cln | ( | c | ) | ((c)>>BAM_CIGAR_SHIFT) |
#define _cop | ( | c | ) | ((c)&BAM_CIGAR_MASK) |
#define _get_mem | ( | type_t, | |
_x, | |||
_s, | |||
_l | |||
) | ks_resize((_s), (_s)->l + (_l)); *(_x) = (type_t*)((_s)->s + (_s)->l); (_s)->l += (_l) |
#define _parse_err | ( | cond, | |
msg | |||
) | do { if ((cond) && hts_verbose >= 1) { fprintf(stderr, "[E::%s] " msg "\n", __func__); goto err_ret; } } while (0) |
#define _parse_warn | ( | cond, | |
msg | |||
) | if ((cond) && hts_verbose >= 2) fprintf(stderr, "[W::%s] " msg "\n", __func__) |
#define _read_token | ( | _p | ) | (_p); for (; *(_p) && *(_p) != '\t'; ++(_p)); if (*(_p) != '\t') goto err_ret; *(_p)++ = 0 |
#define _read_token_aux | ( | _p | ) | (_p); for (; *(_p) && *(_p) != '\t'; ++(_p)); *(_p)++ = 0 |
#define STRNCMP | ( | a, | |
b, | |||
n | |||
) | (strncasecmp((a),(b),(n)) || strlen(a)!=(n)) |
typedef struct hts_cram_idx_t hts_cram_idx_t |
typedef struct __linkbuf_t lbnode_t |
char bam_aux2A | ( | const uint8_t * | s | ) |
double bam_aux2f | ( | const uint8_t * | s | ) |
int32_t bam_aux2i | ( | const uint8_t * | s | ) |
char* bam_aux2Z | ( | const uint8_t * | s | ) |
void bam_aux_append | ( | bam1_t * | b, |
const char | tag[2], | ||
char | type, | ||
int | len, | ||
uint8_t * | data | ||
) |
int bam_aux_del | ( | bam1_t * | b, |
uint8_t * | s | ||
) |
uint8_t* bam_aux_get | ( | const bam1_t * | b, |
const char | tag[2] | ||
) |
int bam_cigar2qlen | ( | int | n_cigar, |
const uint32_t * | cigar | ||
) |
int bam_cigar2rlen | ( | int | n_cigar, |
const uint32_t * | cigar | ||
) |
void bam_destroy1 | ( | bam1_t * | b | ) |
int32_t bam_endpos | ( | const bam1_t * | b | ) |
Calculate the rightmost base position of an alignment on the reference genome.
b | pointer to an alignment |
For a mapped read, this is just b->core.pos + bam_cigar2rlen. For an unmapped read (either according to its flags or if it has no cigar string), we return b->core.pos + 1 by convention.
char* bam_flag2str | ( | int | flag | ) |
returns negative value on error
void bam_hdr_destroy | ( | bam_hdr_t * | h | ) |
int bam_index_build | ( | const char * | fn, |
int | min_shift | ||
) |
bam1_t* bam_init1 | ( | void | ) |
int bam_mplp_auto | ( | bam_mplp_t | iter, |
int * | _tid, | ||
int * | _pos, | ||
int * | n_plp, | ||
const bam_pileup1_t ** | plp | ||
) |
void bam_mplp_destroy | ( | bam_mplp_t | iter | ) |
bam_mplp_t bam_mplp_init | ( | int | n, |
bam_plp_auto_f | func, | ||
void ** | data | ||
) |
void bam_mplp_init_overlaps | ( | bam_mplp_t | iter | ) |
bam_mplp_init_overlaps() - if called, mpileup will detect overlapping read pairs and for each base pair set the base quality of the lower-quality base to zero, thus effectively discarding it from calling. If the two bases are identical, the quality of the other base is increased to the sum of their qualities (capped at 200), otherwise it is multiplied by 0.8.
void bam_mplp_set_maxcnt | ( | bam_mplp_t | iter, |
int | maxcnt | ||
) |
int bam_name2id | ( | bam_hdr_t * | h, |
const char * | ref | ||
) |
const bam_pileup1_t* bam_plp_auto | ( | bam_plp_t | iter, |
int * | _tid, | ||
int * | _pos, | ||
int * | _n_plp | ||
) |
void bam_plp_destroy | ( | bam_plp_t | iter | ) |
bam_plp_t bam_plp_init | ( | bam_plp_auto_f | func, |
void * | data | ||
) |
bam_plp_init() - sets an iterator over multiple : see mplp_func in bam_plcmd.c in samtools for an example. Expected return status: 0 on success, -1 on end, < -1 on non-recoverable errors : user data to pass to
void bam_plp_init_overlaps | ( | bam_plp_t | iter | ) |
const bam_pileup1_t* bam_plp_next | ( | bam_plp_t | iter, |
int * | _tid, | ||
int * | _pos, | ||
int * | _n_plp | ||
) |
void bam_plp_reset | ( | bam_plp_t | iter | ) |
void bam_plp_set_maxcnt | ( | bam_plp_t | iter, |
int | maxcnt | ||
) |
int bam_str2flag | ( | const char * | str | ) |
typedef khash_t | ( | s2i | ) |
typedef khash_t | ( | olap_hash | ) |
bam_hdr_t* sam_hdr_parse | ( | int | l_text, |
const char * | text | ||
) |
int sam_open_mode | ( | char * | mode, |
const char * | fn, | ||
const char * | format | ||
) |