libsequence  1.9.5
SeqRegexes.hpp
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 2003-2009 Kevin Thornton, krthornt[]@[]uci.edu
4 
5 Remove the brackets to email me.
6 
7 This file is part of libsequence.
8 
9 libsequence is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
13 
14 libsequence is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18 
19 You should have received a copy of the GNU General Public License
20 long with libsequence. If not, see <http://www.gnu.org/licenses/>.
21 
22 */
23 
24 #ifndef __SEQ_REGEXES_H__
25 #define __SEQ_REGEXES_H__
26 
27 #include <regex>
28 #include <type_traits>
35 namespace Sequence
36 {
40  const char *basic_dna_alphabet = "[^AGTCN\\-]";
41 
45  const char *full_dna_alphabet = "[^AGCTNXMRWSKVHDB\\-]";
46 
50  const char *pep_alphabet = "[^ARNDBCQEZGHILKMFPSTWYV\\-]";
51 
52 
54  template<typename Iter>
55  bool validSeq(Iter beg, Iter end, const char *_pattern = Sequence::basic_dna_alphabet, const bool icase = true)
68  {
69  for( ; beg != end ; ++beg )
70  {
71  char ch = std::toupper(*beg);
72  if( ch != 'A' && ch != 'C' && ch != 'G' && ch != 'T' && ch != 'N' && ch != '-' )
73  {
74  return false;
75  }
76  }
77  return true;
78  }
79 }
80 
81 #endif
const char * basic_dna_alphabet
Definition: SeqRegexes.hpp:40
The namespace in which this library resides.
bool validSeq(Iter beg, Iter end, const char *_pattern=Sequence::basic_dna_alphabet, const bool icase=true)
Definition: SeqRegexes.hpp:55
const char * full_dna_alphabet
Definition: SeqRegexes.hpp:45
const char * pep_alphabet
Definition: SeqRegexes.hpp:50