ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/PrimerMatch/shift_and_inexact.h
Revision: 1.2
Committed: Wed May 4 18:03:45 2005 UTC (11 years, 3 months ago) by nje01
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +4 -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_SHIFT_AND_INEXACT_H
23 #define _IBPEP_SHIFT_AND_INEXACT_H
24
25 #include <iostream>
26 #include "char_io.h"
27 #include "keyword_tree.h"
28 #include "types.h"
29
30 #if !defined(NO_STD_NAMESPACE)
31 using namespace std;
32 #endif
33
34 class shift_and_inexact : public PatternMatch {
35 struct patbit {
36 unsigned int bit;
37 pattern_list::const_iterator it;
38 };
39 bigword **m_;
40 bigword **u_;
41 bigword *mask_;
42 bigword *s_;
43 unsigned int k_;
44 char eos_;
45 bool _wc;
46 bool _textn;
47 bool _indels;
48 bool _dna_mut;
49 std::vector<std::pair<int,int> > _eb;
50 unsigned int _wordcount;
51 bigword _highbit;
52 patbit *_patbits;
53 unsigned long int *_patbitind;
54 void computeu(CharacterProducer & cp);
55 void clearu();
56 public:
57 shift_and_inexact(unsigned int k=0, unsigned char eos='\n',
58 bool wc=false, bool tn=false, bool id=true, bool dna_mut=false);
59 ~shift_and_inexact();
60 long unsigned int add_pattern(std::string const & pat, unsigned long id=0,
61 int esb=0, int eeb=0);
62 void write(ostream & os) const;
63 bool find_patterns(CharacterProducer & cp,
64 pattern_hit_vector & kas,
65 long unsigned minka=1);
66 void init(CharacterProducer & cp) { computeu(cp); }
67 void reset();
68 unsigned int mismatches() const;
69 void mismatches(unsigned int k);
70 bool wildcards() const;
71 void wildcards(bool wc);
72 bool wildcard_text_N() const;
73 void wildcard_text_N(bool tn);
74 bool indels() const;
75 void indels(bool id);
76 bool dna_mut() const;
77 void dna_mut(bool dm);
78 char eos_char() const;
79 void eos_char(char c);
80 };
81
82 #endif