1 // $Id: gc_structure_maps.cpp,v 1.17 2011/12/01 22:32:42 jmcgill Exp $
2 
3 /*
4   Copyright 2002  Mary Kuhner, Jon Yamato, and Joseph Felsenstein
5 
6   This software is distributed free of charge for non-commercial use
7   and is copyrighted.  Of course, we do not guarantee that the software
8   works, and are not responsible for any damage you may cause or have.
9 */
10 
11 #include "gc_data.h"
12 #include "gc_default.h"
13 #include "gc_region.h"
14 #include "gc_population.h"
15 #include "gc_locus.h"
16 #include "gc_panel.h"
17 #include "gc_strings.h"
18 #include "gc_structure_maps.h"
19 #include "gc_trait.h"
20 #include "wx/log.h"
21 #include "wx/string.h"
22 
23 //------------------------------------------------------------------------------------
24 
gcDisplayOrder()25 gcDisplayOrder::gcDisplayOrder()
26 {
27 }
28 
~gcDisplayOrder()29 gcDisplayOrder::~gcDisplayOrder()
30 {
31 }
32 
33 wxString
AsString() const34 gcDisplayOrder::AsString() const
35 {
36     wxString ids="";
37     for(const_iterator i=begin(); i != end(); i++)
38     {
39         size_t blockId = *i;
40         ids += wxString::Format("%d ",(int)blockId);
41     }
42     return ids;
43 }
44 
45 void
DebugDump(wxString prefix) const46 gcDisplayOrder::DebugDump(wxString prefix) const
47 {
48     wxLogDebug("%s%s", prefix.c_str(), AsString().c_str()); // EWDUMPOK
49 }
50 
51 //------------------------------------------------------------------------------------
52 
gcPopLocusIdPair()53 gcPopLocusIdPair::gcPopLocusIdPair()
54 {
55 }
56 
gcPopLocusIdPair(size_t popId,size_t locId)57 gcPopLocusIdPair::gcPopLocusIdPair(size_t popId, size_t locId)
58     : std::pair<size_t,size_t>(popId,locId)
59 {
60 }
61 
~gcPopLocusIdPair()62 gcPopLocusIdPair::~gcPopLocusIdPair()
63 {
64 }
65 
66 void
DebugDump(wxString prefix) const67 gcPopLocusIdPair::DebugDump(wxString prefix) const
68 {
69     wxLogDebug("%s<%d,%d>", // EWDUMPOK
70                prefix.c_str(),
71                (int)first,
72                (int)second);
73 }
74 
75 //------------------------------------------------------------------------------------
76 
gcBlockSetMap()77 gcBlockSetMap::gcBlockSetMap()
78 {
79 }
80 
~gcBlockSetMap()81 gcBlockSetMap::~gcBlockSetMap()
82 {
83 }
84 
85 void
DebugDump(wxString prefix) const86 gcBlockSetMap::DebugDump(wxString prefix) const
87 {
88     wxLogDebug("%sblock from:",prefix.c_str()); // EWDUMPOK
89     for(const_iterator i=begin(); i != end(); i++)
90     {
91         gcPopLocusIdPair idP = (*i).first;
92         gcIdSet set = (*i).second;
93         wxLogDebug("%s<%d,%d> -> %s",   // EWDUMPOK
94                    (prefix+gcstr::indent).c_str(),
95                    (int)(idP.first),
96                    (int)(idP.second),
97                    set.AsString().c_str());
98     }
99 }
100 
101 //------------------------------------------------------------------------------------
102 
gcRegionMap()103 gcRegionMap::gcRegionMap()
104 {
105 }
106 
~gcRegionMap()107 gcRegionMap::~gcRegionMap()
108 {
109 }
110 
111 void
DebugDump(wxString prefix) const112 gcRegionMap::DebugDump(wxString prefix) const
113 {
114     wxLogDebug("%sregions:",prefix.c_str()); // EWDUMPOK
115     for(const_iterator i=begin(); i != end(); i++)
116     {
117         const gcRegion & region = (*i).second;
118         region.DebugDump(prefix+gcstr::indent);
119     }
120 }
121 
122 //------------------------------------------------------------------------------------
123 
gcLocusMap()124 gcLocusMap::gcLocusMap()
125 {
126 }
127 
~gcLocusMap()128 gcLocusMap::~gcLocusMap()
129 {
130 }
131 
132 void
DebugDump(wxString prefix) const133 gcLocusMap::DebugDump(wxString prefix) const
134 {
135     wxLogDebug("%ssegments:",prefix.c_str());   // EWDUMPOK
136     for(const_iterator i=begin(); i != end(); i++)
137     {
138         const gcLocus & locus = (*i).second;
139         locus.DebugDump(prefix+gcstr::indent);
140     }
141 }
142 
143 //------------------------------------------------------------------------------------
144 
145 
gcRegionPopIdPair()146 gcRegionPopIdPair::gcRegionPopIdPair()
147 {
148 }
149 
gcRegionPopIdPair(size_t regionId,size_t popId)150 gcRegionPopIdPair::gcRegionPopIdPair(size_t regionId, size_t popId)
151     : std::pair<size_t,size_t>(regionId,popId)
152 {
153 }
154 
~gcRegionPopIdPair()155 gcRegionPopIdPair::~gcRegionPopIdPair()
156 {
157 }
158 
159 void
DebugDump(wxString prefix) const160 gcRegionPopIdPair::DebugDump(wxString prefix) const
161 {
162     wxLogDebug("%s<%d,%d>", // JMDUMPOK
163                prefix.c_str(),
164                (int)first,
165                (int)second);
166 }
167 
168 //------------------------------------------------------------------------------------
169 
gcPanelMap()170 gcPanelMap::gcPanelMap()
171 {
172 }
173 
~gcPanelMap()174 gcPanelMap::~gcPanelMap()
175 {
176 }
177 
178 void
DebugDump(wxString prefix) const179 gcPanelMap::DebugDump(wxString prefix) const
180 {
181     wxLogDebug("%ssegments:",prefix.c_str());   // JMDUMPOK
182     for(const_iterator i=begin(); i != end(); i++)
183     {
184         const gcPanel & panel = (*i).second;
185         panel.DebugDump(prefix+gcstr::indent);
186     }
187 }
188 
189 //------------------------------------------------------------------------------------
190 
gcParentMap()191 gcParentMap::gcParentMap()
192 {
193 }
194 
~gcParentMap()195 gcParentMap::~gcParentMap()
196 {
197 }
198 
199 void
DebugDump(wxString prefix) const200 gcParentMap::DebugDump(wxString prefix) const
201 {
202     wxLogDebug("%ssegments:",prefix.c_str());   // JMDUMPOK
203     for(const_iterator i=begin(); i != end(); i++)
204     {
205         const gcParent & parent = (*i).second;
206         parent.DebugDump(prefix+gcstr::indent);
207     }
208 }
209 
210 //------------------------------------------------------------------------------------
211 
gcPopMap()212 gcPopMap::gcPopMap()
213 {
214 }
215 
~gcPopMap()216 gcPopMap::~gcPopMap()
217 {
218 }
219 
220 void
DebugDump(wxString prefix) const221 gcPopMap::DebugDump(wxString prefix) const
222 {
223     wxLogDebug("%spopulations:",prefix.c_str());    // EWDUMPOK
224     for(const_iterator i=begin(); i != end(); i++)
225     {
226         const gcPopulation & pop = (*i).second;
227         pop.DebugDump(prefix+gcstr::indent);
228     }
229 }
230 
231 //------------------------------------------------------------------------------------
232 
gcPopMultiMap()233 gcPopMultiMap::gcPopMultiMap()
234 {
235 }
236 
~gcPopMultiMap()237 gcPopMultiMap::~gcPopMultiMap()
238 {
239 }
240 
241 void
DebugDump(wxString prefix) const242 gcPopMultiMap::DebugDump(wxString prefix) const
243 {
244     wxLogDebug("%spop correspondence:",prefix.c_str()); // EWDUMPOK
245     for(const_iterator i=begin(); i != end(); i++)
246     {
247         wxLogDebug("%spop %d file %d parsePop %d",  // EWDUMPOK
248                    (prefix+gcstr::indent).c_str(),(int)((*i).first),(int)((*i).second.first),(int)((*i).second.second));
249     }
250 }
251 
252 //------------------------------------------------------------------------------------
253 
gcTraitMap()254 gcTraitMap::gcTraitMap()
255 {
256 }
257 
~gcTraitMap()258 gcTraitMap::~gcTraitMap()
259 {
260 }
261 
262 void
DebugDump(wxString prefix) const263 gcTraitMap::DebugDump(wxString prefix) const
264 {
265     wxLogDebug("%strait classes:",prefix.c_str());  // EWDUMPOK
266     for(const_iterator i=begin(); i != end(); i++)
267     {
268         const gcTraitInfo & trait = (*i).second;
269         trait.DebugDump(prefix+gcstr::indent);
270     }
271 }
272 
273 //------------------------------------------------------------------------------------
274 
gcAlleleMap()275 gcAlleleMap::gcAlleleMap()
276 {
277 }
278 
~gcAlleleMap()279 gcAlleleMap::~gcAlleleMap()
280 {
281 }
282 
283 void
DebugDump(wxString prefix) const284 gcAlleleMap::DebugDump(wxString prefix) const
285 {
286     wxLogDebug("%salleles:",prefix.c_str());  // EWDUMPOK
287     for(const_iterator i=begin(); i != end(); i++)
288     {
289         const gcTraitAllele & allele = (*i).second;
290         allele.DebugDump(prefix+gcstr::indent);
291     }
292 }
293 
294 //------------------------------------------------------------------------------------
295 
gcPhenoMap()296 gcPhenoMap::gcPhenoMap()
297 {
298 }
299 
~gcPhenoMap()300 gcPhenoMap::~gcPhenoMap()
301 {
302 }
303 
304 void
DebugDump(wxString prefix) const305 gcPhenoMap::DebugDump(wxString prefix) const
306 {
307     wxLogDebug("%sphenotypes:",prefix.c_str());  // EWDUMPOK
308     for(const_iterator i=begin(); i != end(); i++)
309     {
310         const gcPhenotype & pheno = (*i).second;
311         pheno.DebugDump(prefix+gcstr::indent);
312     }
313 }
314 
315 //------------------------------------------------------------------------------------
316 
gcStringMap()317 gcStringMap::gcStringMap()
318 {
319 }
320 
~gcStringMap()321 gcStringMap::~gcStringMap()
322 {
323 }
324 
325 void
DebugDump(wxString prefix) const326 gcStringMap::DebugDump(wxString prefix) const
327 {
328     wxLogDebug("%sstring map:",prefix.c_str()); // EWDUMPOK
329     for(const_iterator i=begin(); i != end(); i++)
330     {
331         wxLogDebug("%s%d:%s",   // EWDUMPOK
332                    (prefix+gcstr::indent).c_str(),
333                    (int)((*i).first),
334                    (*i).second.c_str());
335     }
336 }
337 //------------------------------------------------------------------------------------
338 
339 
gcMigrationPair()340 gcMigrationPair::gcMigrationPair()
341 {
342 }
343 
gcMigrationPair(size_t fromId,size_t toId)344 gcMigrationPair::gcMigrationPair(size_t fromId, size_t toId)
345     : std::pair<size_t,size_t>(fromId,toId)
346 {
347 }
348 
~gcMigrationPair()349 gcMigrationPair::~gcMigrationPair()
350 {
351 }
352 
353 void
DebugDump(wxString prefix) const354 gcMigrationPair::DebugDump(wxString prefix) const
355 {
356     wxLogDebug("%s<%d,%d>", // JMDUMPOK
357                prefix.c_str(),
358                (int)first,
359                (int)second);
360 }
361 
362 //------------------------------------------------------------------------------------
363 
gcMigrationMap()364 gcMigrationMap::gcMigrationMap()
365 {
366 }
367 
~gcMigrationMap()368 gcMigrationMap::~gcMigrationMap()
369 {
370 }
371 
372 void
DebugDump(wxString prefix) const373 gcMigrationMap::DebugDump(wxString prefix) const
374 {
375     wxLogDebug("%ssegments:",prefix.c_str());   // JMDUMPOK
376     for(const_iterator i=begin(); i != end(); i++)
377     {
378         const gcMigration & mig = (*i).second;
379         mig.DebugDump(prefix+gcstr::indent);
380     }
381 }
382 
383 //------------------------------------------------------------------------------------
384 
constBlockVector()385 constBlockVector::constBlockVector()
386 {
387 }
388 
~constBlockVector()389 constBlockVector::~constBlockVector()
390 {
391 }
392 
393 //------------------------------------------------------------------------------------
394 
popVector()395 popVector::popVector()
396 {
397 }
398 
~popVector()399 popVector::~popVector()
400 {
401 }
402 
403 //------------------------------------------------------------------------------------
404 
locVector()405 locVector::locVector()
406 {
407 }
408 
~locVector()409 locVector::~locVector()
410 {
411 }
412 
413 //____________________________________________________________________________________
414