Changeset 6668 for trunk

Show
Ignore:
Timestamp:
26/05/10 19:01:23 (21 months ago)
Author:
westram
Message:
  • moved match visualization ("GUCACGGCU-=NN=====g=-CAGCAGCCC") from match_string() (aisc:MATCH_STRING) to get_match_overlay()
  • removed redundant calculation of wmis/wmismatches (MATCHLIST_WMISMATCHES)
  • added rpc hook for get_match_overlay() to PT.aisc (MATCHLIST_OVERLAY)
  • removed rpc hook for unused variable is_member (MATCHLIST_IS_MEMBER)

(thx to elmar)

Location:
trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/PROBE/PT_match.cxx

    r6659 r6668  
    354354    if (list_len <= 1) return; 
    355355    my_list = (PT_probematch **)calloc(sizeof(void *), list_len); 
    356     for (i=0, match = locs->pm; 
    357          match; 
    358          i++, match=match->next) 
    359     { 
     356    for (i=0, match = locs->pm; match; i++, match=match->next) { 
    360357        my_list[i] = match; 
    361358    } 
     
    364361        aisc_unlink((struct_dllheader_ext*)my_list[i]); 
    365362        aisc_link(&locs->ppm, my_list[i]); 
     363    //        printf("%i\t%i\t%s\n",my_list[i]->name,my_list[i]->b_pos,virt_name(my_list[i])); 
    366364    } 
    367365    free(my_list); 
     
    434432    locs->matches_truncated = 0; 
    435433 
    436 #if defined(DEBUG) 
     434#if defined(DEBUG) && 0 
    437435    PT_pdc *pdc = locs->pdc; 
    438     printf("Current bond values:\n"); 
    439     for (int y = 0; y<4; y++) { 
    440         for (int x = 0; x<4; x++) { 
    441             printf("%5.2f", pdc->bond[y*4+x].val); 
    442         } 
    443         printf("\n"); 
     436    if (pdc) { 
     437        printf("Current bond values:\n"); 
     438        for (int y = 0; y<4; y++) { 
     439            for (int x = 0; x<4; x++) { 
     440                printf("%5.2f", pdc->bond[y*4+x].val); 
     441            } 
     442            printf("\n"); 
     443        } 
    444444    } 
    445445#endif // DEBUG 
     
    587587inline void cat_dashed_right(GBS_strstruct *memfile, const char *text, int width) { cat_internal(memfile, strlen(text), text, width, '-', false); } 
    588588 
    589 static const char *get_match_info_formatted(PT_probematch  *ml, const format_props& format) 
     589extern "C" char *get_match_overlay(PT_probematch *ml) 
    590590{ 
    591     int    pr_pos, al_pos; 
    592591    int    pr_len = strlen(ml->sequence); 
    593     double wmis   = 0.0; 
    594     double h; 
    595     int    a, b; 
    596592 
    597593    PT_local *locs = (PT_local *)ml->mh.parent->parent; 
     
    600596    char *ref    = (char *)calloc(sizeof(char), 21+pr_len); 
    601597    memset(ref, '.', 10); 
    602     for (pr_pos  = 8, al_pos = ml->rpos-1; 
     598    for (int pr_pos  = 8, al_pos = ml->rpos-1; 
    603599         pr_pos >= 0 && al_pos >= 0; 
    604600         pr_pos--, al_pos--) 
     
    611607    pt_build_pos_to_weight((PT_MATCH_TYPE)locs->sort_by, ml->sequence); 
    612608 
    613     for (pr_pos = 0, al_pos = ml->rpos; 
     609    for (int pr_pos = 0, al_pos = ml->rpos; 
    614610         pr_pos < pr_len && al_pos < psg.data[ml->name].size; 
    615611         pr_pos++, al_pos++) 
    616612    { 
    617         if ((a=ml->sequence[pr_pos]) == (b=psg.data[ml->name].data[al_pos])) { 
     613        int a = ml->sequence[pr_pos]; 
     614        int b = psg.data[ml->name].data[al_pos]; 
     615        if (a == b) { 
    618616            ref[pr_pos+10] = '='; 
    619617        } 
     
    621619            ref[pr_pos+10] = b; 
    622620            if (pdc && a >= PT_A && a <= PT_T && b >= PT_A && b<=PT_T) { 
    623                 h = ptnd_check_split(pdc, ml->sequence, pr_pos, b); 
    624                 if (h<0.0) { 
    625                     h = -h; 
    626                 } 
    627                 else { 
     621                double h = ptnd_check_split(pdc, ml->sequence, pr_pos, b); 
     622                if (h>=0.0) { 
    628623                    ref[pr_pos+10] = " nacgu"[b]; 
    629624                } 
    630                 wmis += psg.pos_to_weight[pr_pos] * h; 
    631             } 
    632         } 
    633  
    634     } 
    635  
    636     for (pr_pos = 0, al_pos = ml->rpos+pr_len; 
     625            } 
     626        } 
     627 
     628    } 
     629 
     630    for (int pr_pos = 0, al_pos = ml->rpos+pr_len; 
    637631         pr_pos < 9 && al_pos < psg.data[ml->name].size; 
    638632         pr_pos++, al_pos++) 
     
    643637    PT_base_2_string(ref, 0); 
    644638 
     639    return ref; 
     640} 
     641 
     642static const char *get_match_info_formatted(PT_probematch  *ml, const format_props& format) { 
    645643    GBS_strstruct *memfile = GBS_stropen(256); 
    646644    GBS_strcat(memfile, "  "); 
     
    653651        cat_spaced_right(memfile, GBS_global_string("%i", ml->N_mismatches), format.N_mis_width()); 
    654652    } 
    655     cat_spaced_right(memfile, GBS_global_string("%.1f", wmis), format.wmis_width()); 
     653    cat_spaced_right(memfile, GBS_global_string("%.1f", ml->wmismatches), format.wmis_width()); 
    656654    cat_spaced_right(memfile, GBS_global_string("%i", ml->b_pos), format.pos_width); 
    657655    if (format.show_gpos) { 
     
    663661    cat_spaced_left(memfile, GBS_global_string("%i", ml->reversed), format.rev_width()); 
    664662 
     663    char *ref = get_match_overlay(ml); 
    665664    GBS_strcat(memfile, ref); 
    666  
    667665    free(ref); 
    668666 
  • trunk/PROBE_COM/PT.aisc

    r6375 r6668  
    172172    double,     wmismatches,    t,    r,    ,       WMISMATCHES,    16,     ,      (~number of weighted mismatches~); 
    173173    int,        N_mismatches,   t,    r,    ,       N_MISMATCHES,   17,     ,      (~number of 'N' mismatches~); 
    174     int,        is_member,      t,    r,    ,       IS_MEMBER,      18,     ,      (~member of group~); 
     174#    int,        is_member,      t,    r,    ,       IS_MEMBER,      18,     ,      (~member of group~); 
    175175    double,     dt,             t,    r,    ,       DT,             19,     ,      (~the dt of a probe~); 
    176176    char,       sequence,       l,    r,    ,       SEQUENCE,       22,     ,      (~path of probe~); 
     
    178178#    aisc_string,get_match_hinfo,%,    r,    ,       INFO_HEADER,    26,     ,      (~the combined info text of _one_ probe match (header)~); 
    179179#    aisc_string,get_match_info, %,    r,    ,       INFO,           27,     ,      (~the combined info text of _one_ probe match~); 
     180    aisc_string,get_match_overlay,%,  r,    ,       OVERLAY,        28,     ,      (~ascii visualization of match~); 
    180181}; 
    181182