libsequence  1.9.5
PolyTableFunctions.cc
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 
26 #include <Sequence/PolyTable.hpp>
27 #include <algorithm>
28 #include <set>
29 #include <cctype>
30 
31 namespace Sequence
32 {
33  bool containsCharacter(const PolyTable * t,
34  const char ch)
35  {
36  for( PolyTable::const_data_iterator itr = t->begin() ;
37  itr < t->end() ;
38  ++itr )
39  {
40  if ( itr->find(ch) != std::string::npos )
41  {
42  return true;
43  }
44  }
45  return false;
46  }
47 
48  bool polyTableValid(const PolyTable * table)
49  {
50  for ( PolyTable::const_data_iterator itr = table->begin() ;
51  itr < table->end() ;
52  ++itr )
53  {
54  if ( (std::find_if(itr->begin(),itr->end(),invalidPolyChar()) != itr->end())
55  || ( itr->length() != table->numsites() ) )
56  {
57  return false;
58  }
59  }
60  return true;
61  }
62 }
The base class for polymorphism tables.
bool polyTableValid(const PolyTable *t) __attribute__((deprecated))
Sequence::PolyTable, a virtual base class for polymorphism tables.
The namespace in which this library resides.
This functor can be used to determine if a range contains characters that the SNP analysis routines i...
bool containsCharacter(const PolyTable *t, const char ch) __attribute__((deprecated))
Operations on non-const Sequence::PolyTable objects.