ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/PrimerMatch/hash_table.h
Revision: 1.2
Committed: Wed May 4 18:03:45 2005 UTC (11 years ago) by nje01
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +2 -1 lines
Log Message:
Small bug fixes, plus codon based edit distance for peptide searching.

Line File contents
1 /**************************************************************************
2 * This code is part of the supporting infrastructure for ATA Mapper.
3 * Copyright (C) 2002,2003,2004 Applera Corporation. All rights reserved.
4 * Author: Nathan Edwards
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received (LICENSE.txt) a copy of the GNU General Public
17 * License along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 *************************************************************************/
20
21
22 #ifndef _IBPEP_HASH_TABLE_H
23 #define _IBPEP_HASH_TABLE_H
24
25 #include "types.h"
26 #include "pattern_match.h"
27
28 #if !defined(NO_STD_NAMESPACE)
29 using namespace std;
30 #endif
31
32 class htele {
33 private:
34 pattern_list::const_iterator patid_;
35 unsigned int position_;
36 public:
37 htele(pattern_list::const_iterator const & it,
38 unsigned int p=0) : patid_(it), position_(p) {};
39 ~htele() {};
40 pattern_list::const_iterator const & pattern_list_it() const {
41 return patid_;
42 }
43 void position(unsigned int p) {
44 position_ = p;
45 }
46 unsigned int position() const {
47 return position_;
48 }
49 };
50
51 class hash_table_elt {
52 public:
53 hash_table_elt();
54 ~hash_table_elt();
55 tinylist<htele> * const & patids() const;
56 void add_patid(pattern_list::const_iterator const & it,
57 unsigned int p=0);
58 private:
59 tinylist<htele> *patid_;
60 };
61
62 class hash_table : public PatternMatch {
63 unsigned int ws_;
64 unsigned int alphasize_;
65 unsigned int alphalog_;
66 int p_;
67 bigword h_;
68 bigword wsmask_;
69 bool *relchars_;
70 unsigned char *relcharmap_;
71 std::vector<hash_table_elt> table_;
72 std::vector<FILE_POSITION_TYPE> lastpos_;
73 long unsigned int num_patterns_;
74 unsigned int k_;
75 unsigned char eos_;
76 bool _wc;
77 bool _textn;
78 bool _indels;
79 bool _dna_mut;
80 long unsigned int _mpl;
81 public:
82 hash_table(unsigned int ws=0, unsigned int k=0, unsigned char eos='\n',
83 bool wc=false, bool tn=false, bool indels=true, bool dna_mut=false);
84 ~hash_table();
85 long unsigned int add_pattern(std::string const & pat, unsigned long id=0,
86 int esb=0, int eeb=0);
87 bool find_patterns(CharacterProducer & cp,
88 pattern_hit_vector & pas,
89 long unsigned minka=1);
90 void init(CharacterProducer & cp);
91 void reset();
92 };
93
94 #endif