comparison PsiCLASS-1.0.2/samtools-0.1.19/faidx.h @ 0:903fc43d6227 draft default tip

Uploaded
author lsong10
date Fri, 26 Mar 2021 16:52:45 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:903fc43d6227
1 /* The MIT License
2
3 Copyright (c) 2008 Genome Research Ltd (GRL).
4
5 Permission is hereby granted, free of charge, to any person obtaining
6 a copy of this software and associated documentation files (the
7 "Software"), to deal in the Software without restriction, including
8 without limitation the rights to use, copy, modify, merge, publish,
9 distribute, sublicense, and/or sell copies of the Software, and to
10 permit persons to whom the Software is furnished to do so, subject to
11 the following conditions:
12
13 The above copyright notice and this permission notice shall be
14 included in all copies or substantial portions of the Software.
15
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
20 BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
21 ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 SOFTWARE.
24 */
25
26 /* Contact: Heng Li <lh3@sanger.ac.uk> */
27
28 #ifndef FAIDX_H
29 #define FAIDX_H
30
31 /*!
32 @header
33
34 Index FASTA files and extract subsequence.
35
36 @copyright The Wellcome Trust Sanger Institute.
37 */
38
39 struct __faidx_t;
40 typedef struct __faidx_t faidx_t;
41
42 #ifdef __cplusplus
43 extern "C" {
44 #endif
45
46 /*!
47 @abstract Build index for a FASTA or razip compressed FASTA file.
48 @param fn FASTA file name
49 @return 0 on success; or -1 on failure
50 @discussion File "fn.fai" will be generated.
51 */
52 int fai_build(const char *fn);
53
54 /*!
55 @abstract Distroy a faidx_t struct.
56 @param fai Pointer to the struct to be destroyed
57 */
58 void fai_destroy(faidx_t *fai);
59
60 /*!
61 @abstract Load index from "fn.fai".
62 @param fn File name of the FASTA file
63 */
64 faidx_t *fai_load(const char *fn);
65
66 /*!
67 @abstract Fetch the sequence in a region.
68 @param fai Pointer to the faidx_t struct
69 @param reg Region in the format "chr2:20,000-30,000"
70 @param len Length of the region
71 @return Pointer to the sequence; null on failure
72
73 @discussion The returned sequence is allocated by malloc family
74 and should be destroyed by end users by calling free() on it.
75 */
76 char *fai_fetch(const faidx_t *fai, const char *reg, int *len);
77
78 /*!
79 @abstract Fetch the number of sequences.
80 @param fai Pointer to the faidx_t struct
81 @return The number of sequences
82 */
83 int faidx_fetch_nseq(const faidx_t *fai);
84
85 /*!
86 @abstract Fetch the sequence in a region.
87 @param fai Pointer to the faidx_t struct
88 @param c_name Region name
89 @param p_beg_i Beginning position number (zero-based)
90 @param p_end_i End position number (zero-based)
91 @param len Length of the region
92 @return Pointer to the sequence; null on failure
93
94 @discussion The returned sequence is allocated by malloc family
95 and should be destroyed by end users by calling free() on it.
96 */
97 char *faidx_fetch_seq(const faidx_t *fai, char *c_name, int p_beg_i, int p_end_i, int *len);
98
99 #ifdef __cplusplus
100 }
101 #endif
102
103 #endif