NVBIO
Main Page
Modules
Classes
Examples
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
contrib
htslib
cram
cram_index.h
Go to the documentation of this file.
1
/*
2
Copyright (c) 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_INDEX_H_
32
#define _CRAM_INDEX_H_
33
34
#ifdef __cplusplus
35
extern
"C"
{
36
#endif
37
38
/*
39
* Loads a CRAM .crai index into memory.
40
* Returns 0 for success
41
* -1 for failure
42
*/
43
int
cram_index_load
(
cram_fd
*fd,
const
char
*fn);
44
45
void
cram_index_free
(
cram_fd
*fd);
46
47
/*
48
* Searches the index for the first slice overlapping a reference ID
49
* and position.
50
*
51
* Returns the cram_index pointer on sucess
52
* NULL on failure
53
*/
54
cram_index
*
cram_index_query
(
cram_fd
*fd,
int
refid,
int
pos,
cram_index
*frm);
55
56
/*
57
* Skips to a container overlapping the start coordinate listed in
58
* cram_range.
59
*
60
* Returns 0 on success
61
* -1 on failure
62
*/
63
int
cram_seek_to_refpos
(
cram_fd
*fd,
cram_range
*r);
64
65
void
cram_index_free
(
cram_fd
*fd);
66
67
/*
68
* Skips to a container overlapping the start coordinate listed in
69
* cram_range.
70
*
71
* In theory we call cram_index_query multiple times, once per slice
72
* overlapping the range. However slices may be absent from the index
73
* which makes this problematic. Instead we find the left-most slice
74
* and then read from then on, skipping decoding of slices and/or
75
* whole containers when they don't overlap the specified cram_range.
76
*
77
* Returns 0 on success
78
* -1 on failure
79
*/
80
int
cram_seek_to_refpos
(
cram_fd
*fd,
cram_range
*r);
81
82
/*
83
* Builds an index file.
84
*
85
* fd is a newly opened cram file that we wish to index.
86
* fn_base is the filename of the associated CRAM file. Internally we
87
* add ".crai" to this to get the index filename.
88
*
89
* Returns 0 on success
90
* -1 on failure
91
*/
92
int
cram_index_build
(
cram_fd
*fd,
const
char
*fn_base);
93
94
#ifdef __cplusplus
95
}
96
#endif
97
98
#endif
Generated on Wed Feb 25 2015 08:32:47 for NVBIO by
1.8.4