source: tags/svn.1.5.4/PROBE_COM/PT.aisc

Last change on this file was 7986, checked in by westram, 14 years ago
  • PT-SERVER
    • allow to specify amount+limit where N is accept
    • moved hardcoded PT_MAX_MATCHES into AISC interface as parameter (with same limit)
  • added links to information related to MAGIC_NUMBER
    • maintain a list of previously used MAGIC_NUMBERs
  • AISC parameters
    • removed unused parameter MATCH_MAX_SPECIES
    • added new parameters MATCH_MAX_HITS, MATCH_N_ACCEPT, MATCH_N_LIMIT
      • defaulted them to previously hardcoded limits
  • parametrized set_table_for_PT_N_mis() using MATCH_N_ACCEPT + MATCH_N_LIMIT
  • protect vs illegal index into psg.N_mismatches
  • arb_probe
    • fixed commandline parser (no longer modifies passed argv)
    • added new parameters matchacceptN, matchlimitN + matchmaxresults
    • added some unit tests
      • testing N-matches (in match-string and/or seqdata)
      • testing truncation of results
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 21.4 KB
Line 
1PROJECT         pb_com
2OBJECT_KEY      PT,             # MAIN PREFIX
3MAX_KEY         33,             # MAX NUMBER OF AN ATTRIBUTE
4MAX_OBJECT      12,             # MAX DIFFERENT USER STRUCTURES
5MAX_STRING_LEN  1024,
6MAX_PAR_CNT     16,
7MAGIC_NUMBER    0x615054,       # MAGIC_NUMBER 6 HEX DIGITS (see AISC/magic.lst@PTSERVER)
8
9SERVER_INCLUDES (~
10#include <stdio.h>
11#include "PT_server.h"
12#include "PT_com.h"~)
13INCLUDE_INCLUDES (~$$(#FILE aisc_include.header)~)
14
15DATA {
16
17# ********************************* USER DATA *******************************************
18
19@CONST,         @VALUE,         @DOCU;
20LIST_SIZE,      20,             (~Size of I_STR Buffer~);
21PERC_SIZE,      20,             (~How many centigrades to look~);
22ALPHA_SIZE,     52,             (~26 BIG, 26 small letters~);
23DOMAIN_MIN_LENGTH, 8,           (~Minimum length of a domain~);
24PT_PART_DEEP,   2,              (~The Deep of the Partitions~);
25
26
27# ******************************* PRIVAT STRUCTURES: DO NOT CHANGE *********************************
28
29@STRUCT, @SKEY, @SKEYC, @SDOCU;
30
31dll_public,     ,       ,       (~parent of dll (=DoubledLinkedList)~), {
32    @TYPE,          @IDENT, @REF,   @ACC,   @SAVE,  @KEY,   @KEYC,  @INIT,  @DOCU;
33    t_key,          key,    t,      r,      ,       ,       ,       ,       (~The key~);
34    int,            cnt,    t,      r,      ,       CNT,    0,      ,       (~Number of elements~);
35    long,           hash,   t,      ,       ,       ,       ,       ,       (~Hash Table~);
36    dllheader_ext,  parent, flt,    r,      ,       PARENT, 1,      ,       (~My Owner~);
37    dllheader_ext,  last,   flt,    r,      ,       LAST,   2,      ,       (~Pointer to the last element~);
38};
39
40
41dll_header,     COMMON, 0,      (~link header (should be head of each function)~), {
42    @TYPE,          @IDENT,             @REF,   @ACC,   @SAVE,  @KEY,           @KEYC,  @INIT,  @DOCU;
43    t_key,          key,                t,      r,      ,       KEY,            0,      ,       (~The Key~);
44    aisc_string,    aisc_get_keystring, %,      r,      ,       KEYSTRING,      1,      ,       (~THE STRING of the KEY~);
45    dll_public,     parent,             ls,     r,      ,       (~~),           2,      ,       (~Pointer to dll_public~);
46    aisc_string,    ident,              t,      ,       1,      IDENT,          5,      ,       (~The ident [not necessary]~);
47};
48
49
50# ********************************* USER STRUCTURES *******************************************
51
52# new probe design/match:
53
54PT_probeparts, TPROBEPARTS,     11,      (~a part of a probe to search in the prefix tree~), {
55    @TYPE,      @IDENT,   @REF, @ACC,   @KEY,  @KEYC,  @INIT, @DOCU;
56    dllh,       mh,       t,    ,       (~~),  0,      ,      (~Header~);
57    aisc_string,sequence, t,    ,       ,      ,       ,      (~The Sequence to check~);
58    PT_tprobes, source,   fl,   ,       ,      ,       ,      (~A pointer to the source~);
59    int,        start,    t,    ,       ,      ,       ,      (~The number of characters cut off at the start of the tprobe~);
60    double,     dt,       t,    ,       ,      ,       ,      (~Add this temperature to the result~);
61    double,     sum_bonds,t,    ,       ,      ,       ,      (~The sum of bonds of the longest non mismatch string~);
62};
63
64PT_pdc_specials, SPECIALS,      10,     (~non standard substrings of a probe~), {
65    @TYPE,  @IDENT, @REF,   @ACC,   @KEY,           @KEYC,  @INIT,          @DOCU;
66    dllh,   mh,     t,      ,       (~~),           0,      ,               (~Header~);
67    int,    mode,   t,      ,       MODE,           8,      ,               (~==1 -> split domains; ==0 -> don't split domains~);
68    double, ll,     t,      ,       LLEFT,          9,      ,               (~the bond value of the character left of the left~);
69    double, l,      t,      ,       LEFT,           10,     ,               (~The bond value left character~);
70    double, c,      t,      ,       CENTER,         11,     ,               (~The center character~);
71    double, r,      t,      ,       RIGHT,          12,     ,               (~...~);
72    double, rr,     t,      ,       RRIGHT,         13,     ,               (~...~);
73};
74
75PT_tprobes, TPROBE,     9,     (~the probe we want to test~), {
76    @TYPE,      @IDENT,          @REF, @ACC, @KEY,        @KEYC, @INIT, @DOCU;
77    dllh,       mh,              t,    ,     (~~),        0,     ,      (~Header~);
78    aisc_string,sequence,        t,    r,    SEQUENCE,    8,     ,      (~The Sequence to check~);
79    int,        seq_len,         t,    ,     ,            ,      ,      (~The len of the sequence~);
80    double,     sum_bonds,       t,    ,     ,            ,      ,      (~The sum of all bonds~);
81    double,     quality,         t,    r,    QUALITY,     9,     ,      (~The quality of the probe = GROUPSIZE*dT~);
82    int,        groupsize,       t,    r,    GROUPSIZE,   10,    ,      (~The Size of the group~);
83    int,        hairpin,         t,    r,    HAIRPIN,     11,    ,      (~How many hairpin bonds~);
84    double,     whairpin,        t,    r,    WHAIRPIN,    12,    ,      (~Weighted Hairpins~);
85    int,        perc,            vt,   r,    PERC,        13,    ,      (~Result: How many non group hits per centigrade~), SIZE PERC_SIZE;
86    double,     temp,            t,    r,    TEMPERATURE, 14,    ,      (~The temperature of the probe~);
87    int,        mishit,          t,    r,    MISHIT,      15,    ,      (~How many non group members hit~);
88    int,        apos,            t,    ,     APOS,        16,    ,      (~The absolute position of probe~);
89    int,        get_r_pos,       t,    ,     ECOLI_POS,   17,    ,      (~The ecoli based position of probe~);
90    aisc_string,get_design_hinfo,%,    r,    INFO_HEADER, 18,    ,      (~the combined info text of a probe design~);
91    aisc_string,get_design_info, %,    r,    INFO,        19,    ,      (~the combined info text of a probe design~);
92};
93
94PT_bond,   ,    ,       (~the definition of a bond~), {
95    @TYPE,  @IDENT, @REF,   @ACC,   @KEY,           @KEYC,  @INIT,          @DOCU;
96    double, val,    t,      ,       VAL,            0,      0.0,            (~how strong is that bond~);
97};
98
99PT_sequence, SEQUENCE,  8,     (~the additional sequences~), {
100    @TYPE,     @IDENT, @REF,   @ACC,   @KEY,           @KEYC,  @INIT,          @DOCU;
101    dllh,      mh,     t,      ,       (~~),           0,      ,               (~Header~);
102    bytestring,seq,    t,      ,       SEQUENCE,       8,      ,               (~The Sequence~);
103};
104
105PT_pdc, PDC,    7,     (~probe design~), {
106    @TYPE,          @IDENT,         @REF,   @ACC,   @KEY,           @KEYC,  @INIT,                  @DOCU;
107    dllh,           mh,             t,      ,       (~~),           0,      ,                       (~Header~);
108    PT_probeparts,  parts,          d,      ,       ,               ,       ,                       (~The parts of the probes~);
109    PT_probeparts,  dparts,         d,      ,       ,               ,       ,                       (~The duplicated parts of the probes~);
110    PT_bond,        bond,           siv,    ,       BOND,           8,      ,                       (~The bond matrix~), SIZE (4*4);
111    int,            dummy,          t,      ,       ,               ,       init_bond_matrix(THIS), (~init bond matrix~);
112    double,         dte,            t,      ,       DTEDGE,         9,      50.0,                   (~The Temperature drop per percent mismatch on the edge of the probe~);
113    double,         dt,             t,      ,       DT,             10,     50.0,                   (~The temperature drop per percent mismatch~);
114    double,         split,          t,      ,       SPLIT,          11,     .5,                     (~Split the domains if bond value is less the average bond value - split~);
115    PT_pdc_specials,specials,       d,      ,       SPECIALS,       12,     ,                       (~Exceptions of splitting domains~);
116    int,            looplen,        t,      ,       LOOPLEN,        14,     4,                      (~The Loop Length of a probe~);
117    int,            probelen,       t,      ,       PROBELENGTH,    15,     18,                     (~the length of the probe~);
118    double,         mintemp,        t,      ,       MINTEMP,        16,     30.0,                   (~minimum temperature~);
119    double,         maxtemp,        t,      ,       MAXTEMP,        17,     100.0,                  (~maximum temperature~);
120    double,         min_gc,         t,      ,       MINGC,          18,     .3,                     (~the minimum GC content~);
121    double,         max_gc,         t,      ,       MAXGC,          19,     1.0,                    (~the maximum GC content~);
122    double,         maxbonds,       t,      ,       MAXBOND,        20,     4.0,                    (~The maximum of hairpin bonds~);
123    int,            min_ecolipos,   t,      ,       MIN_ECOLIPOS,   21,     -1,                     (~the minimum ecoli position [1..N]. -1 means 'no restriction'~);
124    int,            max_ecolipos,   t,      ,       MAX_ECOLIPOS,   22,     -1,                     (~the maximum ecoli position [1..N]. -1 means 'no restriction'~);
125    double,         mintarget,      t,      ,       MINTARGETS,     23,     .7,                     (~the minimum targets for a group of species~);
126    int,            mishit,         t,      ,       MISHIT,         24,     0,                      (~the maximum mis hits~);
127    int,            clipresult,     t,      ,       CLIPRESULT,     25,     40,                     (~Clip the Result list~);
128    int,            pos_groups,     vt,     ,       ,               ,       ,                       (~Position of Groups~), SIZE ALPHA_SIZE;
129    bytestring,     checksums,      t,      w,      CHECKSUMS,      26,     ,                       (~a list of sequence checksums separated by '#' is optional~);
130    bytestring,     names,          t,      w,      NAMES,          27,     ,                       (~a list of names separated by '#' is expected~);
131    bytestring,     PT_unknown_names,%,     r,      UNKNOWN_NAMES,  28,     ,                       (~List of unknown names~);
132    PT_sequence,    sequences,      d,      ,       SEQUENCE,       29,     ,                       (~Additional Sequences~);
133    int,            PT_start_design,%,      w,      GO,             31,     ,                       (~Start the design procedure~);
134    PT_tprobes,     tprobes,        d,      r,      TPROBE,         32,     ,                       (~The result~);
135};
136
137# function to iterate through all probes existing in PT-Server
138
139PT_exProb, PEP, 6, (~iterate all existing probes~), {
140    @TYPE,          @IDENT,         @REF,   @ACC,   @KEY,       @KEYC,  @INIT, @DOCU;
141    dllh,           mh,             t,      ,       (~~),       0,      ,      (~Header~);
142    int,            plength,        t,      ,       PLENGTH,    8,      20,    (~Length of searched probes~);
143    int,            numget,         t,      ,       NUMGET,     9,      200,   (~Number of searched probes~);
144    int,            restart,        t,      ,       RESTART,    10,     1,     (~1 => start from beginning~);
145    bytestring,     next_probe,     t,      ,       NEXT_PROBE, 11,     ,      (~next probe to look for (internal)~);
146    int,            PT_find_exProb, %,      w,      FIND_PROBES,12,     ,      (~search probes (result=separated by ','s )~);
147    aisc_string,    result,         t,      r,      RESULT,     13,     ,      (~The result~);
148};
149
150# get next relatives (used by AWTC and NALIGNER)
151
152PT_family_list, FAMILYLIST,     5,      (~the family list~), {
153    @TYPE,       @IDENT,      @REF,   @ACC,   @SAVE,  @KEY,           @KEYC,  @INIT,          @DOCU;
154    dllh,        mh,          t,      ,       ,       (~~),           0,      ,               (~Header~);
155    aisc_string, name,        t,      r,      ,       NAME,           8,      ,               (~name of species~);
156    int,         matches,     t,      r,      ,       MATCHES,        9,      ,               (~number of matches~);
157    double,      rel_matches, t,      r,      ,       REL_MATCHES,    10,     ,               (~MATCHES / (SEQ_LEN - PROBE_LEN + 1)~);
158};
159
160PT_family, FAMILYFINDER, 12, (~next relative search~), {
161    @TYPE,          @IDENT,               @REF, @ACC,   @SAVE,  @KEY,              @KEYC,  @INIT,                @DOCU;
162    dllh,           mh,                   t,    ,       ,       (~~),              0,      ,                     (~Header~);
163    bytestring,     find_family,          %,    w,      ,       FIND_FAMILY,       8,      ,                     (~Searches the family~);
164    int,            pr_len,               t,    rw,     ,       PROBE_LEN,         9,      12,                   (~Length of probes~);
165    int,            mis_nr,               t,    rw,     ,       MISMATCH_NUMBER,   10,     0,                    (~Number of mismatches~);
166    int,            find_type,            t,    rw,     ,       FIND_TYPE,         11,     0,                    (~Type of find 0 = search all, 1 = a*~);
167    int,            complement,           t,    rw,     ,       COMPLEMENT,        12,     1,                    (~Search for complement? (combination of: fwd=1, rev=2, rev.compl=4, compl=8)~);
168    PT_family_list, fl,                   d,    r,      ,       FAMILY_LIST,       13,     ,                     (~Sorted List of family~);     # note: This uses 80 AND 81!
169    int,            list_size,            t,    r,      ,       FAMILY_LIST_SIZE,  15,     ,                     (~size of result list~);
170    int,            sort_type,            t,    rw,     ,       SORT_TYPE,         16,     0,                    (~Type of sorting 0 = MATCHES, 1 = REL_MATCHES~);
171    int,            sort_max,             t,    rw,     ,       SORT_MAX,          17,     0,                    (~Sort only best FF_SORT_MAX sequences~);
172    int,            range_start,          t,    rw,     ,       RANGE_STARTPOS,    18,     -1,                   (~if != -1 -> ignore matches starting left of that position [0..N-1]~);
173    int,            range_end,            t,    rw,     ,       RANGE_ENDPOS,      19,     -1,                   (~if != -1 -> ignore matches ending right  of that position [0..N-1]~);
174};
175
176# used below in LOCS/MATCH_STRING
177
178PT_probematch, MATCHLIST,       4,      (~the probe match list~), {
179    @TYPE,       @IDENT,            @REF, @ACC, @SAVE,  @KEY,           @KEYC,  @INIT, @DOCU;
180    dllh,        mh,                t,    ,     ,       (~~),           0,      ,      (~Header~);
181    int,         name,              t,    r,    ,       ID,             8,      ,      (~id of species~);
182    aisc_string, virt_name,         %,    r,    ,       NAME,           9,      ,      (~name of species~);
183    int,         b_pos,             t,    r,    ,       POS,            10,     ,      (~pos of probe~);
184    int,         g_pos,             t,    r,    ,       GPOS,           11,     ,      (~pos of probe (gene relative)~);
185    int,         rpos,              t,    r,    ,       ,               ,       ,      (~relative pos of probe~);
186    int,         mismatches,        t,    r,    ,       MISMATCHES,     12,     ,      (~number of mismatches~);
187    aisc_string, virt_fullname,     %,    r,    ,       FULLNAME,       13,     ,      (~fullname of species (or genename if it's a gene pt server)~);
188    double,      wmismatches,       t,    r,    ,       WMISMATCHES,    14,     ,      (~number of weighted mismatches~);
189    int,         N_mismatches,      t,    r,    ,       N_MISMATCHES,   15,     ,      (~number of 'N' mismatches~);
190    double,      dt,                t,    r,    ,       DT,             16,     ,      (~the dt of a probe~);
191    char,        sequence,          l,    r,    ,       SEQUENCE,       17,     ,      (~path of probe~);
192    int,         reversed,          t,    r,    ,       REVERSED,       18,     ,      (~reversed probe matches~);
193    aisc_string, get_match_overlay, %,    r,    ,       OVERLAY,        19,     ,      (~ascii visualization of match~);
194};
195
196# used below in MAIN/SPECIESLIST
197
198PT_species_list, SPECIESLIST,   3,      (~the species list~), {
199    @TYPE,  @IDENT, @REF,   @ACC,   @SAVE,  @KEY,           @KEYC,  @INIT,          @DOCU;
200    dllh,   mh,     t,      ,       ,       (~~),           0,      ,               (~Header~);
201    int,    member, t,      rw,     ,       MEMBER,         8,      ,               (~species member of group~);
202};
203
204# global interface
205
206PT_local, LOCS,         2,      (~local communication buffer~), {
207    @TYPE,          @IDENT,               @REF, @ACC,   @SAVE,  @KEY,                 @KEYC,  @INIT,                @DOCU;
208    dllh,           mh,                   t,    ,       ,       (~~),                 0,      ,                     (~Header~);
209    int,            socket,               t,    ,       ,       ,                     ,       pt_init_socket(THIS), (~the callback~), DESTROY pt_destroy_socket(THIS);
210
211    aisc_string,    probe_match,          %,    w,      ,       SEARCHMATCH,          8,      ,                     (~Searches all species where probe matches~);
212    aisc_string,    pm_sequence,          t,    ,       ,       ,                     ,       ,                     (~the sequence~);
213    aisc_string,    pm_csequence,         t,    ,       ,       ,                     ,       ,                     (~the complement sequence~);
214    int,            pm_reversed,          t,    rw,     ,       MATCH_REVERSED,       9,      1,                    (~reverse probe~);
215    int,            pm_complement,        t,    rw,     ,       MATCH_COMPLEMENT,     10,     ,                     (~complement probe~);
216    int,            pm_max,               t,    rw,     ,       MATCH_MAX_MISMATCHES, 11,     ,                     (~max mismatches~);
217    int,            pm_max_hits,          t,    rw,     ,       MATCH_MAX_HITS,       12,     1000000,              (~max number of hits reported (0=unlimited)~);
218    int,            sort_by,              t,    rw,     ,       MATCH_SORT_BY,        13,     ,                     (~0 == mismatches  1 == weighted mismatches 2 == weighted mismatches with pos and strength~);
219    int,            pm_nmatches_ignored,  t,    rw,     ,       MATCH_N_ACCEPT,       14,     1,                    (~max. of accepted matches vs N~);
220    int,            pm_nmatches_limit,    t,    rw,     ,       MATCH_N_LIMIT,        33,     4,                    (~N-matches are only accepted, if less than NMATCHES_LIMIT occur, otherwise no N-matches are accepted ~);
221    PT_probematch,  pm,                   d,    r,      ,       MATCH_LIST,           15,     ,                     (~result: List of species where probe matches~);
222    int,            matches_truncated,    t,    r,      ,       MATCHES_TRUNCATED,    17,     ,                     (~result: whether MATCH_LIST was truncated~);
223    bytestring,     match_string,         %,    r,      ,       MATCH_STRING,         18,     ,                     (~result: List of species where probe matches~);
224
225    bytestring,     MP_match_string,      %,    r,      ,       MP_MATCH_STRING,      19,     ,                     (~result: List of species where probe matches and #mismatches~);
226    bytestring,     MP_all_species_string,%,    r,      ,       MP_ALL_SPECIES_STRING,20,     ,                     (~result: List of all species in Database~);
227    int,            MP_count_all_species, %,    r,      ,       MP_COUNT_ALL_SPECIES, 21,     ,                     (~result: Number of all species in Database~);
228
229    aisc_string,    ls_error,             t,    r,      ,       ERROR,                22,     "",                   (~the error text~);
230                   
231    int,            group_count,          t,    r,      ,       PROBE_NGROUP,         23,     ,                     (~result: Number of selected species~);
232                   
233    PT_pdc,         pdc,                  d,    ,       ,       PROBE_DESIGN_CONFIG,  24,     ,                     (~The new probe design~);
234    PT_exProb,      ep,                   d,    ,       ,       PROBE_FIND_CONFIG,    26,     ,                     (~Find all existing probes~);
235
236    PT_family,      ffinder,              d,    ,       ,       FFINDER,              28,     ,                     (~next relative search~);
237
238    aisc_string,    user,                 t,    rw,     ,       USER,                 30,     "unknown",            (~the username~);
239    aisc_string,    address,              t,    rw,     ,       ADDRESS,              31,     "unknown",            (~the useraddress~);
240    aisc_string,    login,                t,    rw,     ,       LOGINTIME,            32,     "notime",             (~the date the user logged in~);
241};
242
243PT_main, MAIN, 1, (~global data~), {
244    @TYPE,          @IDENT,         @REF,   @ACC,   @SAVE,  @KEY,               @KEYC,      @INIT,          @DOCU;
245    t_key,          key,            t,      n,      ,       ,                   ,           ,               (~the KEY~);
246    PT_local,       loc_st,         d,      ,       ,       LOCS,               1,          ,               (~the parameters~);
247    aisc_string,    server_shutdown,%,      w,      ,       SHUTDOWN,           3,          ,               (~shut down~);
248    int,            who,            t,      rw,     ,       STARTER,            4,          ,               (~who started this server~);
249    int,            m_type,         t,      ,       ,       MESSAGE_TYPE,       5,          0,              (~the message type~);
250    aisc_string,    m_text,         t,      ,       ,       MESSAGE,            6,          "NO_MSG",       (~the message text~);
251    int,            broadcast,      %,      w,      ,       BROADCAST,          7,          ,               (~broadcast func~);
252    PT_species_list,sl,             d,      r,      ,       SPECIESLIST,        8,          ,               (~list of species~);
253};
254
255};
Note: See TracBrowser for help on using the repository browser.