17 #ifndef AISC_GEN_SERVER_INCLUDED
18 #include <PT_server.h>
27 #define PT_SERVER_MAGIC 0x32108765 // pt server identifier
28 #define PT_SERVER_VERSION 3 // version of pt server database (no versioning till 2009/05/13)
32 # define PTM_DEBUG_STAGE_ASSERTIONS
36 #define CALCULATE_STATS_ON_QUERY
38 #if defined(PTM_DEBUG_STAGE_ASSERTIONS)
39 #define pt_assert_stage(s) pt_assert(psg.get_stage() == (s))
40 #else // !defined(PTM_DEBUG_STAGE_ASSERTIONS)
41 #define pt_assert_stage(s)
44 #if defined(PTM_DEBUG_VALIDATE_CHAINS)
45 #define pt_assert_valid_chain_stage1(node) pt_assert(PT_chain_has_valid_entries<ChainIteratorStage1>(node))
46 #else // !defined(PTM_DEBUG_VALIDATE_CHAINS)
47 #define pt_assert_valid_chain_stage1(node)
54 #define PT_MAX_PARTITION_DEPTH 4
56 #define PT_POS_TREE_HEIGHT 20
57 #define PT_MIN_TREE_HEIGHT PT_MAX_PARTITION_DEPTH
59 #define MIN_PROBE_LENGTH 2
69 #define MATCHANSWER 50 // private msg type: match result answer
70 #define CREATEANSWER 51 // private msg type: create result answer
71 #define FINDANSWER 52 // private msg type: find result answer
106 for (
int i = 0; i<len; ++i) {
116 while (i<j)
std::swap(seq[i++], seq[j--]);
132 typedef SmartArrayPtr(
int) SmartIntPtr;
140 SmartCharPtr loadSeq()
const {
155 rel2abs.
release(rel2abs_cache);
159 seq_cache.
resize(seq_cache_size);
160 rel2abs_cache.
resize(abs_cache_size);
167 return seq.
access(seq_cache);
214 return rel_pos >= 0 && rel_pos<
get_size();
238 int *r2a =
new int[size];
241 for (
int rel = 0; rel<size; ++rel) {
246 rel2abs.
assign(r2a, rel2abs_cache);
251 return (&*rel2abs.
access(rel2abs_cache))[rel_pos];
256 SmartIntPtr rel2abs_ptr = rel2abs.
access(rel2abs_cache);
257 const int *r2a = &*rel2abs_ptr;
262 if (r2a[l] == abs_pos)
return l;
263 if (r2a[h] == abs_pos)
return h;
267 if (r2a[m]<abs_pos) {
270 else if (r2a[m]>abs_pos) {
329 if (p == pos) used++;
333 if (next->used>used) swapWith(next);
397 const char *arb_species_name;
398 const char *arb_gene_name;
400 void init(
const char *gene_name_,
const char *arb_species_name_,
const char *arb_gene_name_) {
401 int gene_name_len = strlen(gene_name_);
402 int arb_species_name_len = strlen(arb_species_name_);
403 int arb_gene_name_len = strlen(arb_gene_name_);
405 int fulllen = gene_name_len+1+arb_species_name_len+1+arb_gene_name_len+1;
406 gene_name =
new char[fulllen];
407 strcpy(gene_name, gene_name_);
408 arb_species_name = gene_name+(gene_name_len+1);
409 strcpy((
char*)arb_species_name, arb_species_name_);
410 arb_gene_name = arb_species_name+(arb_species_name_len+1);
411 strcpy((
char*)arb_gene_name, arb_gene_name_);
415 gene_struct(
const char *gene_name_,
const char *arb_species_name_,
const char *arb_gene_name_) {
416 init(gene_name_, arb_species_name_, arb_gene_name_);
419 if (&other !=
this) {
424 if (&other !=
this) {
462 #error probe.h included twice
struct probe_input_data * data
bool operator()(const gene_struct *gs1, const gene_struct *gs2) const
gene_struct(const gene_struct &other)
long GB_read_int(GBDATA *gbd)
POS_TREE1 *& TREE_ROOT1()
CONSTEXPR_INLINE unsigned char safeCharIndex(char c)
SMARTPTR access(Cache< SMARTPTR > &cache)
std::set< const gene_struct *, ltByInternalName > gene_struct_index_internal
std::list< gene_struct > gene_struct_list
void resize(size_t new_size)
probe_statistic_struct stat
gene_struct_index_internal gene_struct_internal2arb
char * GB_read_bytes(GBDATA *gbd)
CONSTEXPR_INLINE bool is_valid_base(char b)
void reverse_probe(char *seq, int len)
void enter_stage(Stage stage_)
gene_struct_index_arb gene_struct_arb2internal
std::set< const gene_struct *, ltByArbName > gene_struct_index_arb
const char * get_arb_gene_name() const
int get_most_used() const
CONSTEXPR_INLINE bool is_std_base(char b)
void assign(SMARTPTR data, Cache< SMARTPTR > &cache)
CONSTEXPR_INLINE_Cxx14 void swap(unsigned char &c1, unsigned char &c2)
CONSTEXPR_INLINE bool is_std_base_or_N(char b)
const char * get_arb_species_name() const
GB_CUINT4 * GB_read_ints_pntr(GBDATA *gbd)
gene_struct & operator=(const gene_struct &other)
CONSTEXPR_INLINE char base_2_readable(char base)
gene_struct(const char *gene_name_, const char *arb_species_name_, const char *arb_gene_name_)
const char * get_internal_gene_name() const
POS_TREE2 *& TREE_ROOT2()
char * probe_2_readable(char *id_string, int len)
void release(Cache< SMARTPTR > &cache)
GB_transaction ta(gb_var)
GB_CSTR GB_read_char_pntr(GBDATA *gbd)
bool operator()(const gene_struct *gs1, const gene_struct *gs2) const
const unsigned int GB_CUINT4
CONSTEXPR_INLINE bool is_ambig_base(char b)
GBDATA * GB_entry(GBDATA *father, const char *key)