comparison ezBAMQC/src/htslib/cram/cram_encode.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) 2012-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 /*! \file
32 * Include cram.h instead.
33 *
34 * This is an internal part of the CRAM system and is automatically included
35 * when you #include cram.h.
36 *
37 * Implements the encoding portion of CRAM I/O. Also see
38 * cram_codecs.[ch] for the actual encoding functions themselves.
39 */
40
41 #ifndef _CRAM_WRITE_H_
42 #define _CRAM_WRITE_H_
43
44 #ifdef __cplusplus
45 extern "C" {
46 #endif
47
48 /* ----------------------------------------------------------------------
49 * CRAM sequence iterators.
50 */
51
52 /*! Write iterator: put BAM format sequences into a CRAM file.
53 *
54 * We buffer up a containers worth of data at a time.
55 *
56 * FIXME: break this into smaller pieces.
57 *
58 * @return
59 * Returns 0 on success;
60 * -1 on failure
61 */
62 int cram_put_bam_seq(cram_fd *fd, bam_seq_t *b);
63
64
65 /* ----------------------------------------------------------------------
66 * Internal functions
67 */
68
69 /*! INTERNAL:
70 * Encodes a compression header block into a generic cram_block structure.
71 *
72 * @return
73 * Returns cram_block ptr on success;
74 * NULL on failure
75 */
76 cram_block *cram_encode_compression_header(cram_fd *fd, cram_container *c,
77 cram_block_compression_hdr *h);
78
79 /*! INTERNAL:
80 * Encodes a slice compression header.
81 *
82 * @return
83 * Returns cram_block on success;
84 * NULL on failure
85 */
86 cram_block *cram_encode_slice_header(cram_fd *fd, cram_slice *s);
87
88 /*! INTERNAL:
89 * Encodes all slices in a container into blocks.
90 *
91 * @return
92 * Returns 0 on success;
93 * -1 on failure
94 *
95 * FIXME: separate into encode_container and write_container. Ideally
96 * we should be able to do read_container / write_container or
97 * decode_container / encode_container.
98 */
99 int cram_encode_container(cram_fd *fd, cram_container *c);
100
101 #ifdef __cplusplus
102 }
103 #endif
104
105 #endif