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