SHORE API
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
coor.hpp
Go to the documentation of this file.
1 
2 /*
3  * Copyright 2008,2009,2010,2011,2012 Stephan Ossowski, Korbinian Schneeberger,
4  * Felix Ott, Joerg Hagmann, Alf Scotland, Sebastian Bender
5  *
6  * This file is part of SHORE.
7  *
8  * SHORE is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation, either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * SHORE is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with SHORE. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
25 
26 #ifndef SHORE_GENOME_COOR_HPP__
27 #define SHORE_GENOME_COOR_HPP__
28 
29 #include <string>
30 #include <utility>
31 
32 namespace shore {
33 
36 {
37  typedef int chr_t;
38  typedef long pos_t;
39  typedef long diff_t;
40 
42  chr_t chromosome;
44  pos_t position;
45 
47  refseq_coor();
49  refseq_coor(chr_t c,pos_t p);
50 
52  static refseq_coor max();
55  static refseq_coor min();
56 
57  refseq_coor &operator++();
58  refseq_coor &operator--();
59  refseq_coor operator++(int);
60  refseq_coor operator--(int);
61  refseq_coor &operator+=(const diff_t d);
62  refseq_coor &operator-=(const diff_t d);
63 };
64 
65 refseq_coor operator+(const refseq_coor& c0,const refseq_coor::diff_t d);
66 refseq_coor operator-(const refseq_coor& c0,const refseq_coor::diff_t d);
67 refseq_coor::diff_t operator-(const refseq_coor& c0,const refseq_coor& c1);
68 
69 bool operator<(const refseq_coor& gc1,const refseq_coor& gc2);
70 bool operator>(const refseq_coor& gc1,const refseq_coor& gc2);
71 bool operator<=(const refseq_coor& gc1,const refseq_coor& gc2);
72 bool operator>=(const refseq_coor& gc1,const refseq_coor& gc2);
73 
74 bool operator==(const refseq_coor& gc1,const refseq_coor& gc2);
75 bool operator!=(const refseq_coor& gc1,const refseq_coor& gc2);
76 
77 std::ostream &operator<<(std::ostream &os,const refseq_coor &gc);
78 std::istream &operator>>(std::istream &is,refseq_coor &gc);
79 
83 {
84  refseq_coor coor;
85  size_t size;
86 
87  refseq_region();
88  refseq_region(const refseq_coor &c,const size_t s);
89 
90  refseq_region &operator=(const refseq_coor &c);
91 };
92 
93 bool operator==(const refseq_region& gc1,const refseq_region& gc2);
94 bool operator!=(const refseq_region& gc1,const refseq_region& gc2);
95 
99 {
104 
105  refseq_range();
106  refseq_range(const refseq_coor &s,const refseq_coor &e);
107  refseq_range(const refseq_region &region);
108 
109  refseq_range &operator=(const refseq_coor &c);
110  refseq_range &operator=(const refseq_region &region);
111 };
112 
113 bool operator==(const refseq_range& gc1,const refseq_range& gc2);
114 bool operator!=(const refseq_range& gc1,const refseq_range& gc2);
115 
116 std::ostream &operator<<(std::ostream &os,const refseq_range &gr);
117 std::istream &operator>>(std::istream &is,refseq_range &gr);
118 
124 {
125  std::string sequence;
126  long position;
127 
128 
129  genomic_coor();
130  genomic_coor(const std::string &seq,const long pos);
131 };
132 
136 {
137  genomic_coor coor;
138  size_t size;
139 
140 
141  genomic_region();
142 };
143 
147 {
152 
153  genomic_range();
155  const std::string& startseq,const long startpos,
156  const std::string& endseq,const long endpos);
158  const std::string& startseq,const long startpos,const long endpos);
159 
160  static std::string esc(const std::string& seqstr);
161 };
162 
164 enum Strand
165 {
166  STR_FWD=1,STR_REV=2
167 };
168 
170 std::istream& operator>>(std::istream& in,Strand& s);
172 std::ostream& operator<<(std::ostream& out,const Strand& s);
174 Strand other_strand(const Strand strand);
175 
178 {
179  STR_NA_OPT=0,STR_FWD_OPT=STR_FWD,STR_REV_OPT=STR_REV
180 };
181 
183 std::istream& operator>>(std::istream& in,OptionalStrand& s);
185 std::ostream& operator<<(std::ostream& out,const OptionalStrand& s);
188 
194 {
195  STR_NA_EXT=STR_NA_OPT,STR_FWD_EXT=STR_FWD,STR_REV_EXT=STR_REV,STR_UNKNOWN_EXT=3
196 };
197 
199 std::istream& operator>>(std::istream& in,ExtendedStrand& s);
201 std::ostream& operator<<(std::ostream& out,const ExtendedStrand& s);
204 
214 std::istream& operator>>(std::istream& is,genomic_range& gr);
215 
225 std::ostream& operator<<(std::ostream& os,const genomic_range& gr);
226 
227 } // namespace
228 
229 #endif // SHORE_GENOME_COOR_HPP__
230