Changeset 7199 for branches/stable_5.0
- Timestamp:
- 24/02/11 21:39:48 (15 months ago)
- Location:
- branches/stable_5.0/PROBE
- Files:
-
- 2 modified
-
PT_new_design.cxx (modified) (3 diffs)
-
probe.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/stable_5.0/PROBE/PT_new_design.cxx
r5918 r7199 198 198 int operator()(int name, int apos, int rpos) { 199 199 char *probe = psg.probe; 200 if (apos>psg.apos) psg.apos = apos;200 psg.abs_pos.announce(apos); 201 201 if (psg.data[name].is_group) return 0; /* dont count group or neverminds */ 202 202 if (probe) { … … 225 225 name = PT_read_name(psg.ptmain,pt); 226 226 int apos = PT_read_apos(psg.ptmain,pt); 227 if (apos>psg.apos) psg.apos = apos;227 psg.abs_pos.announce(apos); 228 228 if (!psg.data[name].is_group) return 1; 229 229 return 0; … … 406 406 tprobe = tprobe_next ) { 407 407 tprobe_next = tprobe->next; 408 psg.a pos = 0;408 psg.abs_pos.clear(); 409 409 tprobe->mishit = ptnd_count_mishits(tprobe->sequence,psg.pt,0); 410 tprobe->apos = psg.a pos;410 tprobe->apos = psg.abs_pos.get_most_used(); 411 411 if (tprobe->mishit > pdc->mishit) { 412 412 destroy_PT_tprobes(tprobe); 413 413 } 414 414 } 415 psg.abs_pos.clear(); 415 416 } 416 417 /*********************************************************************** -
branches/stable_5.0/PROBE/probe.h
r5919 r7199 172 172 class BI_ecoli_ref; 173 173 174 class MostUsedPos { 175 int pos; 176 int used; 177 178 MostUsedPos *next; 179 180 void swapWith(MostUsedPos *other) { 181 std::swap(pos, other->pos); 182 std::swap(used, other->used); 183 } 184 185 public: 186 MostUsedPos() : pos(0), used(0), next(NULL) { } 187 MostUsedPos(int p) : pos(p), used(1), next(NULL) { } 188 ~MostUsedPos() { delete next; } 189 190 void clear() { 191 pos = 0; 192 used = 0; 193 delete next; 194 next = NULL; 195 } 196 197 void announce(int p) { 198 if (p == pos) used++; 199 else { 200 if (next) next->announce(p); 201 else next = new MostUsedPos(p); 202 if (next->used>used) swapWith(next); 203 } 204 } 205 206 207 int get_most_used() const { return pos; } 208 }; 209 174 210 extern struct probe_struct_global { 175 211 GBDATA *gb_main; /* ARBDB interface */ … … 201 237 int height; 202 238 int length; 203 int apos; 239 240 MostUsedPos abs_pos; 204 241 205 242 int sort_by;
