libsequence  1.9.5
shortestPath.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 __SHORTEST_PATH_HPP__
25 #define __SHORTEST_PATH_HPP__
26 
27 #include <vector>
28 #include <utility>
29 #include <memory>
30 #include <tuple>
31 #include <cstdint>
32 #include <Sequence/SeqEnums.hpp>
33 
53 namespace Sequence
54 {
55  class shortestPath
56  {
57  private:
58  class shortestPathImpl;
59  std::unique_ptr<shortestPathImpl> impl;
60  public:
69  enum class pathType : std::int8_t {S,N,SS,SN,NN,SSS,SSN,SNN,NNN,NONE,AMBIG};
70 
71  explicit shortestPath(const std::string &codon1,
72  const std::string &codon2,
73  const Sequence::GeneticCodes & code = GeneticCodes::UNIVERSAL);
74  ~shortestPath();
75  pathType type() const;
76  double path_distance() const;
77  typedef std::vector<std::string>::const_iterator const_iterator;
78  const_iterator begin() const;
79  const_iterator end() const;
80  };
81 
82  std::pair<unsigned,unsigned> mutsShortestPath(const std::string &codon1,
83  const std::string &codon2,
84  const Sequence::GeneticCodes & code = GeneticCodes::UNIVERSAL);
85 
86  std::pair<unsigned,shortestPath::pathType> diffType(const std::string &codon1,
87  const std::string &codon2,
88  const Sequence::GeneticCodes & code = GeneticCodes::UNIVERSAL);
89 
90  std::tuple<shortestPath::pathType,shortestPath::pathType,shortestPath::pathType>
91  diffTypeMulti(const std::string &codon1,
92  const std::string &codon2,
93  const Sequence::GeneticCodes & code = GeneticCodes::UNIVERSAL);
94 }
95 #endif
std::pair< unsigned, shortestPath::pathType > diffType(const std::string &codon1, const std::string &codon2, const Sequence::GeneticCodes &code=GeneticCodes::UNIVERSAL)
const_iterator begin() const
double path_distance() const
The namespace in which this library resides.
shortestPath(const std::string &codon1, const std::string &codon2, const Sequence::GeneticCodes &code=GeneticCodes::UNIVERSAL)
Calculate shortest path between 2 codons.
const_iterator end() const
std::pair< unsigned, unsigned > mutsShortestPath(const std::string &codon1, const std::string &codon2, const Sequence::GeneticCodes &code=GeneticCodes::UNIVERSAL)
std::tuple< shortestPath::pathType, shortestPath::pathType, shortestPath::pathType > diffTypeMulti(const std::string &codon1, const std::string &codon2, const Sequence::GeneticCodes &code=GeneticCodes::UNIVERSAL)
Definition of enumeration types.
pathType type() const