~ubuntu-branches/ubuntu/quantal/genometools/quantal-backports

« back to all changes in this revision

Viewing changes to src/match/eis-sa-common.h

  • Committer: Package Import Robot
  • Author(s): Sascha Steinbiss
  • Date: 2012-07-09 14:10:23 UTC
  • Revision ID: package-import@ubuntu.com-20120709141023-juuu4spm6chqsf9o
Tags: upstream-1.4.1
ImportĀ upstreamĀ versionĀ 1.4.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
  Copyright (C) 2007 Thomas Jahns <Thomas.Jahns@gmx.net>
 
3
 
 
4
  Permission to use, copy, modify, and distribute this software for any
 
5
  purpose with or without fee is hereby granted, provided that the above
 
6
  copyright notice and this permission notice appear in all copies.
 
7
 
 
8
  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 
9
  WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 
10
  MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 
11
  ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 
12
  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 
13
  ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 
14
  OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 
15
*/
 
16
 
 
17
/**
 
18
 * \file eis-suffixerator-interface.h
 
19
 * \brief Methods to call suffixerator functions through one object,
 
20
 * but have the same data available to multiple listeners.
 
21
 * \author Thomas Jahns <Thomas.Jahns@gmx.net>
 
22
 */
 
23
#ifndef EIS_SA_COMMON_H
 
24
#define EIS_SA_COMMON_H
 
25
 
 
26
#include <stdlib.h>
 
27
#include "core/defined-types.h"
 
28
#include "core/encseq.h"
 
29
#include "core/types_api.h"
 
30
#include "match/eis-mrangealphabet.h"
 
31
#include "match/eis-random-seqaccess.h"
 
32
#include "match/eis-seqdatasrc.h"
 
33
#include "match/sfx-suffixgetset.h"
 
34
 
 
35
/**
 
36
 * Describes what kind of information will be read by a requestor:
 
37
 */
 
38
enum sfxDataRequest {
 
39
  SFX_REQUEST_NONE = 0,         /**< empty request, used for special purposes */
 
40
  SFX_REQUEST_SUFTAB = 1<<0,    /**< request for suffix array entries */
 
41
  SFX_REQUEST_BWTTAB = 1<<1,    /**< request for bwt table */
 
42
  SFX_REQUEST_ALL = SFX_REQUEST_SUFTAB |
 
43
                    SFX_REQUEST_BWTTAB, /**< used as bitmask  */
 
44
  SFX_REQUEST_ANY = SFX_REQUEST_ALL,             /**< used as bitmask  */
 
45
};
 
46
 
 
47
/**
 
48
 * @return Symbol at position sufIdx or UNDEFBWTCHAR i.e. the terminator
 
49
 */
 
50
static inline GtUchar
 
51
sfxIdx2BWTSym(unsigned long sufIdx, const GtEncseq *encseq,
 
52
              GtReadmode readmode);
 
53
 
 
54
static inline size_t
 
55
EncSeqGetSubSeq(const GtEncseq *encseq, GtReadmode readmode,
 
56
                unsigned long pos, size_t len, GtUchar *subStr);
 
57
 
 
58
struct encSeqTrState
 
59
{
 
60
  const GtEncseq *encseq;
 
61
  GtReadmode readmode;
 
62
};
 
63
 
 
64
/**
 
65
 * @brief Produce given length of symbols from the BWT by translating
 
66
 * an array of suffix indices, this version uses the values of
 
67
 * suffix array and encoded sequence instead of reading the BWT file.
 
68
 * @param state reference of a SuffixarrayFileInterface
 
69
 * @param dest write symbols here
 
70
 * @param src read suffix indices from here
 
71
 * @param len length of string to read
 
72
 */
 
73
 
 
74
size_t gt_translateSuftab2BWT(void *data,
 
75
                              void *voiddest,
 
76
                              const unsigned long *src,
 
77
                              size_t len);
 
78
 
 
79
size_t gt_translateSuftab2BWTSuffixsortspace(
 
80
                                       void *translator,
 
81
                                       void *voiddest,
 
82
                                       const GtSuffixsortspace *suffixsortspace,
 
83
                                       unsigned long offset,
 
84
                                       size_t len);
 
85
 
 
86
struct saTaggedXltorState
 
87
{
 
88
  enum sfxDataRequest typeTag;
 
89
  struct encSeqTrState state;
 
90
};
 
91
 
 
92
struct saTaggedXltorStateList
 
93
{
 
94
  size_t numXltors;
 
95
  struct saTaggedXltorStateLE *stateList;
 
96
};
 
97
 
 
98
void
 
99
gt_initSATaggedXltorStateList(struct saTaggedXltorStateList *saXltorStateList);
 
100
 
 
101
void
 
102
gt_destructSATaggedXltorStateList(
 
103
  struct saTaggedXltorStateList *saXltorStateList);
 
104
 
 
105
struct saTaggedXltorState *
 
106
gt_addSuffixarrayXltor(struct saTaggedXltorStateList *saXltorStateList,
 
107
                    enum sfxDataRequest request,
 
108
                    struct encSeqTrState state);
 
109
 
 
110
typedef struct SASeqSrc SASeqSrc;
 
111
 
 
112
static inline SeqDataReader
 
113
SASSCreateReader(SASeqSrc *src, enum sfxDataRequest request);
 
114
 
 
115
static inline Definedunsignedlong
 
116
SASSGetRot0Pos(const SASeqSrc *src);
 
117
 
 
118
static inline unsigned long
 
119
SASSGetLength(const SASeqSrc *src);
 
120
 
 
121
static inline MRAEnc *
 
122
SASSNewMRAEnc(const SASeqSrc *src);
 
123
 
 
124
static inline const MRAEnc *
 
125
SASSGetMRAEnc(SASeqSrc *src);
 
126
 
 
127
static inline const struct seqStats *
 
128
SASSGetSeqStats(const SASeqSrc *src);
 
129
 
 
130
static inline size_t
 
131
SASSAccessSequence(const SASeqSrc *src,
 
132
                   Symbol *dest,
 
133
                   unsigned long pos,
 
134
                   size_t len);
 
135
 
 
136
static inline RandomSeqAccessor
 
137
SASSGetOrigSeqAccessor(const SASeqSrc *src);
 
138
 
 
139
static inline void
 
140
SASSDelete(SASeqSrc *src);
 
141
 
 
142
#include "match/eis-sa-common-siop.h"
 
143
 
 
144
#endif