-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMotifSite.hpp
84 lines (70 loc) · 2.56 KB
/
MotifSite.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/*
* Copyright (C) 2006 Cold Spring Harbor Laboratory
* Authors: Andrew D. Smith, Pavel Sumazin and Michael Q. Zhang
*
* This file is part of CREAD.
*
* CREAD is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* CREAD is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with CREAD; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef MOTIFSITE_HPP
#define MOTIFSITE_HPP
#include "Pattern.hpp"
class MotifSite {
private:
// static const char* valid_orientations = "pn";
// static const size_t n_valid_orientations = 2;
std::string site;
std::string seq_name;
int start;
size_t length;
std::string gaps;
char orientation;
float score;
bool is_valid_orientation(char c);
public:
MotifSite(std::string s, std::string sn, int st,
size_t l, std::string g, char o, float sc) :
site(s), seq_name(sn), start(st), length(l), gaps(g),
orientation(o), score(sc) {}
MotifSite(std::string s, std::string sn, std::string st,
std::string l, std::string g, std::string o, std::string sc);
MotifSite(std::string);
std::string tostring() const;
friend std::ostream& operator<<(std::ostream &s, const MotifSite &bs) {
return s << bs.tostring();
}
std::string get_site() const {return site;}
std::string get_seq_name() const {return seq_name;}
std::string get_gaps() const {return gaps;}
char get_orientation() const {return orientation;}
bool negstrand() const {return orientation == 'n';}
bool posstrand() const {return orientation == 'p';}
float get_score() const{return score;}
int get_start() const {return start;}
size_t get_length() const {return length;}
void set_score(float s) {score = s;}
bool operator<(const MotifSite& ms) const;
bool operator==(const MotifSite& ms) const;
};
/*!
\class InvalidMotifSiteException
\brief Exception class for handling invalid motif site exceptions
*/
class InvalidMotifSiteException : public PatternSiteException {
public:
//! Constructor that initializes the message
InvalidMotifSiteException(const std::string m) : PatternSiteException(m) {}
};
#endif