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