SHORE API
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
serialization.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 
26 
27 #ifndef SHORE_SERIALIZATION_HPP__
28 #define SHORE_SERIALIZATION_HPP__
29 
30 #include "shore/datatype/coor.hpp"
32 #include "shore/algo/align.hpp"
33 
34 namespace shore {
35 
38 {
39  private:
40 
42 
43  public:
44 
45  template<typename Archive>
46  static void serialize(Archive &ar,shore::alignment_statistic &c,
47  const unsigned int version)
48  {
49  ar&c.m_stats;
50  }
51 };
52 
54 template<typename Archive>
55 void serialize(Archive &ar,shore::refseq_coor &c,const unsigned int version)
56 {
57  ar&c.chromosome;
58  ar&c.position;
59 }
60 
62 template<typename Archive>
63 void serialize(Archive &ar,shore::refseq_region &c,const unsigned int version)
64 {
65  ar&c.coor;
66  ar&c.size;
67 }
68 
70 template<typename Archive>
71 void serialize(Archive &ar,shore::refseq_range &c,const unsigned int version)
72 {
73  ar&c.start;
74  ar&c.end;
75 }
76 
78 template<typename Archive>
79 void serialize(Archive &ar,shore::genomic_coor &c,const unsigned int version)
80 {
81  ar&c.sequence;
82  ar&c.position;
83 }
84 
86 template<typename Archive>
87 void serialize(Archive &ar,shore::genomic_region &c,const unsigned int version)
88 {
89  ar&c.coor;
90  ar&c.size;
91 }
92 
94 template<typename Archive>
95 void serialize(Archive &ar,shore::genomic_range &c,const unsigned int version)
96 {
97  ar&c.start;
98  ar&c.end;
99 }
100 
101 template<typename Archive>
102 void serialize(Archive & ar,shore::read::accessory & r,
103  const unsigned int version)
104 {
105  ar&r.badqual_flags;
106  ar&r.edit_distance_hint;
107  ar&r.clip_left;
108  ar&r.clip_right;
109  ar&r.barcode;
110  ar&r.readgroup;
111  ar&r.num_reads;
112  ar&r.ori;
113 }
114 
115 template<typename Archive>
116 void serialize(Archive & ar,shore::read & r,const unsigned int version)
117 {
118  ar&r.id;
119  ar&r.sequence;
120  ar&r.qual_std;
121  ar&r.index;
122  ar&r.pe_state;
123  ar&r.qual_aux;
124  ar&r.tags;
125 }
126 
127 template<typename Archive>
128 void serialize(Archive & ar,shore::alignment::accessory & a,
129  const unsigned int version)
130 {
131  ar&a.map_qual;
132  ar&a.readgroup;
133  ar&a.num_reads;
134  ar&a.ori;
135  ar&a.ori_readlength;
136  ar&a.nextread_coor;
137  ar&a.nextread_strand;
138 }
139 
140 template<typename Archive>
141 void serialize(Archive & ar,shore::alignment & a,const unsigned int version)
142 {
143  ar&a.id;
144  ar&a.coor;
145  ar&a.readlength;
146  ar&a.strand;
147  ar&a.hits;
148  ar&a.alignment_string;
149  ar&a.mismatches;
150  ar&a.offset;
151  ar&a.index;
152  ar&a.pe_state;
153  ar&a.qual_std;
154  ar&a.qual_aux;
155  ar&a.qual_raw;
156  ar&a.tags;
157 }
158 
159 template<typename Archive>
160 void serialize(Archive & ar,shore::dp_trace & t,const unsigned int version)
161 {
162  ar&t.alignment_id;
163  ar&t.left_ends;
164  ar&t.right_ends;
165  ar&t.alignment_string;
166  ar&t.score;
167  ar&t.ref_id;
168  ar&t.ref_hits;
169  ar&t.ref_totalsize;
170  ar&t.qry_totalsize;
171  ar&t.ref_pos;
172  ar&t.ref_end;
173  ar&t.qry_pos;
174  ar&t.qry_end;
175  ar&t.soft_clipped;
176  ar&t.unique_alignment;
177  ar&t.unique_mapping;
178 }
179 
180 template<typename Archive>
181 void serialize(Archive & ar,shore::dp_mapping & m,const unsigned int version)
182 {
183  ar&const_cast<shore::read * &>(m.read);
184  ar&const_cast<shore::dp_trace * &>(m.trace);
185 }
186 
188 template<typename Archive>
190  const unsigned int version)
191 {
192  serialization_core_access::serialize(ar,c,version);
193 }
194 
195 } // namespace
196 
197 #endif // SHORE_SERIALIZATION_HPP__
198