Mercurial > repos > youngkim > ezbamqc
comparison ezBAMQC/src/htslib/cram/cram_samtools.h @ 0:dfa3745e5fd8
Uploaded
| author | youngkim |
|---|---|
| date | Thu, 24 Mar 2016 17:12:52 -0400 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:dfa3745e5fd8 |
|---|---|
| 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 { | |
| 64 BAM_CMATCH_=BAM_CMATCH, | |
| 65 BAM_CINS_=BAM_CINS, | |
| 66 BAM_CDEL_=BAM_CDEL, | |
| 67 BAM_CREF_SKIP_=BAM_CREF_SKIP, | |
| 68 BAM_CSOFT_CLIP_=BAM_CSOFT_CLIP, | |
| 69 BAM_CHARD_CLIP_=BAM_CHARD_CLIP, | |
| 70 BAM_CPAD_=BAM_CPAD, | |
| 71 BAM_CBASE_MATCH=BAM_CEQUAL, | |
| 72 BAM_CBASE_MISMATCH=BAM_CDIFF | |
| 73 }; | |
| 74 | |
| 75 typedef bam1_t bam_seq_t; | |
| 76 | |
| 77 #include "cram/sam_header.h" | |
| 78 | |
| 79 bam_hdr_t *cram_header_to_bam(SAM_hdr *h); | |
| 80 SAM_hdr *bam_header_to_cram(bam_hdr_t *h); | |
| 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_ */ |
