Changeset 7199 for branches/stable_5.0

Show
Ignore:
Timestamp:
24/02/11 21:39:48 (15 months ago)
Author:
westram
Message:
Location:
branches/stable_5.0/PROBE
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • branches/stable_5.0/PROBE/PT_new_design.cxx

    r5918 r7199  
    198198    int operator()(int name, int apos, int rpos) { 
    199199        char *probe = psg.probe; 
    200         if (apos>psg.apos) psg.apos = apos; 
     200        psg.abs_pos.announce(apos); 
    201201        if (psg.data[name].is_group) return 0;              /* dont count group or neverminds */ 
    202202        if (probe) { 
     
    225225        name = PT_read_name(psg.ptmain,pt); 
    226226        int apos = PT_read_apos(psg.ptmain,pt); 
    227         if (apos>psg.apos) psg.apos = apos; 
     227        psg.abs_pos.announce(apos); 
    228228        if (!psg.data[name].is_group)   return 1; 
    229229        return 0; 
     
    406406                tprobe = tprobe_next ) { 
    407407        tprobe_next = tprobe->next; 
    408         psg.apos = 0; 
     408        psg.abs_pos.clear(); 
    409409        tprobe->mishit = ptnd_count_mishits(tprobe->sequence,psg.pt,0); 
    410         tprobe->apos = psg.apos; 
     410        tprobe->apos = psg.abs_pos.get_most_used(); 
    411411        if (tprobe->mishit > pdc->mishit) { 
    412412            destroy_PT_tprobes(tprobe); 
    413413        } 
    414414    } 
     415    psg.abs_pos.clear(); 
    415416} 
    416417/*********************************************************************** 
  • branches/stable_5.0/PROBE/probe.h

    r5919 r7199  
    172172class BI_ecoli_ref; 
    173173 
     174class 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 
     185public: 
     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 
    174210extern struct probe_struct_global   { 
    175211    GBDATA  *gb_main;           /* ARBDB interface */ 
     
    201237    int height; 
    202238    int length; 
    203     int apos; 
     239     
     240    MostUsedPos abs_pos; 
    204241 
    205242    int sort_by;