modified: src1/input.c
[GalaxyCodeBases.git] / c_cpp / lib / klib / ksw.h
blob5162dc03d1ceda9280854f538de53cccf931da12
1 #ifndef __AC_KSW_H
2 #define __AC_KSW_H
4 #include <stdint.h>
6 #define KSW_XBYTE 0x10000
7 #define KSW_XSTOP 0x20000
8 #define KSW_XSUBO 0x40000
9 #define KSW_XSTART 0x80000
11 struct _kswq_t;
12 typedef struct _kswq_t kswq_t;
14 typedef struct {
15 int score; // best score
16 int te, qe; // target end and query end
17 int score2, te2; // second best score and ending position on the target
18 int tb, qb; // target start and query start
19 } kswr_t;
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
25 /**
26 * Aligning two sequences
28 * @param qlen length of the query sequence (typically <tlen)
29 * @param query query sequence with 0 <= query[i] < m
30 * @param tlen length of the target sequence
31 * @param target target sequence
32 * @param m number of residue types
33 * @param mat m*m scoring matrix in one-dimention array
34 * @param gapo gap open penalty; a gap of length l cost "-(gapo+l*gape)"
35 * @param gape gap extension penalty
36 * @param xtra extra information (see below)
37 * @param qry query profile (see below)
39 * @return alignment information in a struct; unset values to -1
41 * When xtra==0, ksw_align() uses a signed two-byte integer to store a
42 * score and only finds the best score and the end positions. The 2nd best
43 * score or the start positions are not attempted. The default behavior can
44 * be tuned by setting KSW_X* flags:
46 * KSW_XBYTE: use an unsigned byte to store a score. If overflow occurs,
47 * kswr_t::score will be set to 255
49 * KSW_XSUBO: track the 2nd best score and the ending position on the
50 * target if the 2nd best is higher than (xtra&0xffff)
52 * KSW_XSTOP: stop if the maximum score is above (xtra&0xffff)
54 * KSW_XSTART: find the start positions
56 * When *qry==NULL, ksw_align() will compute and allocate the query profile
57 * and when the function returns, *qry will point to the profile, which can
58 * be deallocated simply by free(). If one query is aligned against multiple
59 * target sequences, *qry should be set to NULL during the first call and
60 * freed after the last call. Note that qry can equal 0. In this case, the
61 * query profile will be deallocated in ksw_align().
63 kswr_t ksw_align(int qlen, uint8_t *query, int tlen, uint8_t *target, int m, const int8_t *mat, int gapo, int gape, int xtra, kswq_t **qry);
65 int ksw_extend(int qlen, const uint8_t *query, int tlen, const uint8_t *target, int m, const int8_t *mat, int gapo, int gape, int w, int h0, int *_qle, int *_tle);
66 int ksw_global(int qlen, const uint8_t *query, int tlen, const uint8_t *target, int m, const int8_t *mat, int gapo, int gape, int w, int *_n_cigar, uint32_t **_cigar);
68 #ifdef __cplusplus
70 #endif
72 #endif