Gamgee
You miserable little maggot. I'll stove your head in!
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
cram_samtools.h
Go to the documentation of this file.
1 /*
2 Copyright (c) 2010-2013 Genome Research Ltd.
3 Author: James Bonfield <jkb@sanger.ac.uk>
4 
5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions are met:
7 
8  1. Redistributions of source code must retain the above copyright notice,
9 this list of conditions and the following disclaimer.
10 
11  2. Redistributions in binary form must reproduce the above copyright notice,
12 this list of conditions and the following disclaimer in the documentation
13 and/or other materials provided with the distribution.
14 
15  3. Neither the names Genome Research Ltd and Wellcome Trust Sanger
16 Institute nor the names of its contributors may be used to endorse or promote
17 products derived from this software without specific prior written permission.
18 
19 THIS SOFTWARE IS PROVIDED BY GENOME RESEARCH LTD AND CONTRIBUTORS "AS IS" AND
20 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 DISCLAIMED. IN NO EVENT SHALL GENOME RESEARCH LTD OR CONTRIBUTORS BE LIABLE
23 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30 
31 #ifndef _CRAM_SAMTOOLS_H_
32 #define _CRAM_SAMTOOLS_H_
33 
34 /* Samtools compatible API */
35 #define bam_blk_size(b) ((b)->l_data)
36 #define bam_set_blk_size(b,v) ((b)->data_len = (v))
37 
38 #define bam_ref(b) (b)->core.tid
39 #define bam_pos(b) (b)->core.pos
40 #define bam_mate_pos(b) (b)->core.mpos
41 #define bam_mate_ref(b) (b)->core.mtid
42 #define bam_ins_size(b) (b)->core.isize
43 #define bam_seq_len(b) (b)->core.l_qseq
44 #define bam_cigar_len(b) (b)->core.n_cigar
45 #define bam_flag(b) (b)->core.flag
46 #define bam_bin(b) (b)->core.bin
47 #define bam_map_qual(b) (b)->core.qual
48 #define bam_name_len(b) (b)->core.l_qname
49 #define bam_name(b) bam_get_qname((b))
50 #define bam_qual(b) bam_get_qual((b))
51 #define bam_seq(b) bam_get_seq((b))
52 #define bam_cigar(b) bam_get_cigar((b))
53 #define bam_aux(b) bam_get_aux((b))
54 
55 #define bam_dup(b) bam_copy1(bam_init1(), (b))
56 
57 #define bam_free(b) bam_destroy1((b))
58 
59 #define bam_reg2bin(beg,end) hts_reg2bin((beg),(end),14,5)
60 
61 #include "htslib/sam.h"
62 
63 enum cigar_op {
73 };
74 
75 typedef bam1_t bam_seq_t;
76 
77 #include "cram/sam_header.h"
78 
81 
82 int bam_construct_seq(bam_seq_t **bp, size_t extra_len,
83  const char *qname, size_t qname_len,
84  int flag,
85  int rname, // Ref ID
86  int pos,
87  int end, // aligned start/end coords
88  int mapq,
89  uint32_t ncigar, const uint32_t *cigar,
90  int mrnm, // Mate Ref ID
91  int mpos,
92  int isize,
93  int len,
94  const char *seq,
95  const char *qual);
96 
97 #endif /* _CRAM_SAMTOOLS_H_ */
Definition: cram_samtools.h:71
#define BAM_CREF_SKIP
Definition: sam.h:63
Definition: cram_samtools.h:70
#define BAM_CINS
Definition: sam.h:61
#define BAM_CDEL
Definition: sam.h:62
cigar_op
Definition: cram_samtools.h:63
Definition: sam_header.h:183
Definition: cram_samtools.h:66
Definition: sam.h:170
#define BAM_CPAD
Definition: sam.h:66
Definition: cram_samtools.h:69
int bam_construct_seq(bam_seq_t **bp, size_t extra_len, const char *qname, size_t qname_len, int flag, int rname, int pos, int end, int mapq, uint32_t ncigar, const uint32_t *cigar, int mrnm, int mpos, int isize, int len, const char *seq, const char *qual)
Definition: cram_samtools.c:41
Definition: cram_samtools.h:65
bam1_t bam_seq_t
Definition: cram_samtools.h:75
#define BAM_CEQUAL
Definition: sam.h:67
Definition: sam.h:46
Definition: cram_samtools.h:64
#define BAM_CHARD_CLIP
Definition: sam.h:65
Definition: cram_samtools.h:68
#define BAM_CSOFT_CLIP
Definition: sam.h:64
#define BAM_CDIFF
Definition: sam.h:68
Definition: cram_samtools.h:67
Definition: cram_samtools.h:72
SAM_hdr * bam_header_to_cram(bam_hdr_t *h)
Definition: cram_samtools.c:145
#define BAM_CMATCH
Definition: sam.h:60
bam_hdr_t * cram_header_to_bam(SAM_hdr *h)
Definition: cram_samtools.c:123