1 /*   salsa.h
2 * ===========================================================================
3 *
4 *                            PUBLIC DOMAIN NOTICE
5 *            National Center for Biotechnology Information (NCBI)
6 *
7 *  This software/database is a "United States Government Work" under the
8 *  terms of the United States Copyright Act.  It was written as part of
9 *  the author's official duties as a United States Government employee and
10 *  thus cannot be copyrighted.  This software/database is freely available
11 *  to the public for use. The National Library of Medicine and the U.S.
12 *  Government do not place any restriction on its use or reproduction.
13 *  We would, however, appreciate having the NCBI and the author cited in
14 *  any work or product based on this material
15 *
16 *  Although all reasonable efforts have been taken to ensure the accuracy
17 *  and reliability of the software and data, the NLM and the U.S.
18 *  Government do not and cannot warrant the performance or results that
19 *  may be obtained by using this software or data. The NLM and the U.S.
20 *  Government disclaim all warranties, express or implied, including
21 *  warranties of performance, merchantability or fitness for any particular
22 *  purpose.
23 *
24 * ===========================================================================
25 *
26 * File Name:  salsa.h
27 *
28 * Author:  Colombe Chappey
29 *
30 * Version Creation Date:   1/27/96
31 *
32 * $Revision: 6.6 $
33 *
34 * File Description:
35 *
36 * Modifications:
37 * --------------------------------------------------------------------------
38 * Date     Name        Description of modification
39 * -------  ----------  -----------------------------------------------------
40 *
41 *
42 * ==========================================================================
43 */
44 
45 #ifndef _SALSA_
46 #define _SALSA_
47 
48 #include <ncbi.h>
49 #include <objseq.h>
50 #include <objfdef.h>
51 #include <objmgr.h>
52 #include <gather.h>
53 
54 #define COMPSEG           6
55 
56 #define TypeEmpty         0
57 #define TypeSeqInt        1
58 #define TypeSeqId         2
59 #define TypeSeqLoc        3
60 #define TypeSelStruct     4
61 #define TypeSelEdStruct   5
62 
63 #define NO_RESIDUE       -9
64 #define GAP_RESIDUE      -1
65 
66 #define SEQ_VIEW          0
67 #define SEQ_EDIT          1
68 #define ALIGN_EDIT        2
69 #define BLOCK_EDIT        3
70 #define PRETTY_EDIT       4
71 
72 #define TMP_BUFFERLENGTH  6000
73 #define TMP_EDITBUFFER    200
74 
75 #define WINPERBUF         3
76 #define MAXCharLine     200
77 #define MAXLineWindow   150
78 #define LENGTHMAX     10000
79 #define SALSALENLIMIT 50000
80 
81 #define HRZ_BORDER_WIDTH  4
82 #define VER_BORDER_WIDTH  4
83 #define EDIT_MARGIN_RIGHT 10
84 #define EDIT_MARGIN_BOT   5
85 
86 #define SEQ_SHOW1         1
87 #define SEQ_SHOWALG       2
88 #define SEQ_FEAT0         0
89 #define SEQ_FEAT1         1
90 #define SEQ_FEATALL       2
91 #define SEQ_NUM0          0
92 #define SEQ_NUM1          1
93 #define SEQ_NUM2          2
94 
95 #define SALSA_ND          0
96 #define SALSA_FASTA       1
97 #define SALSA_ASN1        2
98 #define SALSA_CONTIGUOUS  3
99 #define SALSA_FASTGAP     4
100 #define SALSA_PAUP        5
101 #define SALSA_MACAW       6
102 #define SALSA_INTERLEAVE  7
103 #define SALSA_NEXUS       8
104 #define SALSA_PHYLIP      9
105 #define SALSA_CLUSTALV   10
106 #define SALSA_SHWTXT     11
107 #define SALSAA_FASTA     12
108 #define SALSAA_CONTIGUOUS 13
109 #define SALSAA_FASTGAP   14
110 #define SALSAA_INTERLEAVE 15
111 #define SALSAA_PHYLIP    16
112 #define SALSAA_NEXUS     17
113 #define SALSAA_GCG       18
114 
115 #define PRG_ANYALIGN      0
116 #define PRG_FASTA_IMPORT  1
117 #define PRGALIGNBANDBL    6
118 #define PRG_BLAST         7
119 #define PRGALIGNALL       8
120 #define PRGALIGNDEFAULT  10
121 
122 #define PROPAG_SETSTOP 1
123 #define PROPAG_GETSTOP 2
124 
125 #define LINE0             0
126 
127 #define COLOR_STAR        0
128 #define COLOR_SCALE       1
129 #define COLOR_ID          2
130 #define COLOR_GAP         3
131 #define COLOR_ID_MASTER   4
132 #define COLOR_CDS         5
133 #define COLOR_SELECT      6
134 
135 #define ALLPROTAA         1
136 #define MPROTAA           2
137 #define PUTPROT           3
138 
139 #define EDITDEF_SCA   101
140 #define EDITDEF_SCB   102
141 #define EDITDEF_CPL   103
142 #define EDITDEF_RF1   104
143 #define EDITDEF_RF2   105
144 #define EDITDEF_RF3   106
145 #define EDITDEF_RF4   107
146 #define EDITDEF_RF5   108
147 #define EDITDEF_RF6   109
148 #define FEATDEF_TRSL  110
149 
150 #define LINE_NOGAP      1
151 #define LINE_WITHGAP    2
152 #define LINE_ONLYGAP    3
153 
154 #define PRINTID_GIcc   99
155 
156 /******************************
157 **  Types define
158 *******************************/
159 typedef struct seledstruct
160 {
161         Boolean    dirty;
162         Boolean    visible;
163         Uint2      entityID,
164                    itemtype,
165                    itemsubtype;
166         Uint4      itemID;
167         Uint4      bsp_itemID;
168         Pointer    region;
169         Uint1      regiontype;     /* 0 = not set
170                                  1 = SeqLocPtr of type SEQLOC_INT       */
171         Char       label[101];
172         ValNodePtr data;
173         Uint1      codonstart;
174         Int4       offset;
175         struct seledstruct PNTR prev,
176                            PNTR next;
177 } SelEdStruct, PNTR SelEdStructPtr;
178 
179 typedef struct seqparam {
180         Uint2    entityID;
181         Uint4    itemID;
182         Boolean  complement;
183         Boolean  rf[10];
184         Uint2    group;
185         SeqIdPtr sip_cons;
186 }
187 SeqParam, PNTR SeqParamPtr;
188 
189 typedef struct alignstyle {
190   Handle          font;
191   Int2            interline;        /* space between lines          */
192   Boolean         marginwithindex;  /* index in left margin    */
193   Boolean         marginwithIds;    /* Ids in left margin      */
194   Boolean         marginwithfeatid;
195   Boolean         marginwithpos;    /* position in left margin */
196   Boolean         marginwithgroup;
197   Int2            marginleft;       /* left margin (char)           */
198   Boolean         draw_scale;
199   Boolean         draw_bars;
200   Uint1           rowpcell;         /* rows per cell */
201   Uint1           columnpcell;      /* columns per cell */
202   Uint4           colorRefs[256];
203 
204 } AlignStyle, PNTR AlignStylePtr;
205 
206 
207 typedef  struct  rectc {
208   Int2  left;
209   Int2  top;
210   Int2  right;
211   Int2  bottom;
212 } RecTc, PNTR RectcPtr;
213 
214 typedef struct editaligndata {
215 
216   Boolean          Cn3D_On;
217 
218   Pointer         wdp;
219   Uint2           input_entityID,
220                   input_itemtype;
221   Uint4           input_itemID;
222   Int2            seqnumber;        /* number of sequences       */
223   Int4            length;           /* alignment length          */
224   Boolean         seg_bioseq;
225   Uint1           mol_type;         /* NA, DNA, RNA, AA        */
226 
227   ValNodePtr      anp_list;         /* list of AlignNode / sequence */
228   ValNodePtr      anp_graph;
229   SelEdStructPtr  seq_info;
230   ValNodePtr      sqloc_list;       /* SeqLocPtr list  on sequences*/
231   ValNodePtr      bsqloc_list;
232   Int2            size_labels;
233 
234   SelStruct       master;           /* entityID, item, SeqLoc of master seq*/
235   GatherRange     gr;
236 
237   SeqAnnotPtr     sap_align;        /* SeqAnnotPtr-SeqAlignPtr-CompSeg   */
238   SeqAnnotPtr     sap_original;     /* SeqAnnotPtr-SeqAlignPtr-DenSeg */
239   SeqAnnotPtr     sap1_original;    /* SeqAnnotPtr-SeqAlignPtr-DenDiag */
240   SeqAlignPtr     blocks;        /* list of DenDiag to be aligned     */
241 
242   Boolean         dirty;
243 
244   /*    Features   */
245 
246   Uint1          featOrder[FEATDEF_ANY];  /* features displayed  */
247   Uint1          groupOrder[FEATDEF_ANY]; /* ? */
248   Uint1          gap_choice;       /* used only for propagation features */
249                                    /* through the Dialog */
250   /*    PaneL   */
251 
252   Int4            x, xoff, y, yoff;
253   Int4            ybutt;
254   Boolean         vscrollbar_mode;
255   Int4            hoffset;          /* horizontal offset - align coordi. */
256   Int4            voffset;          /* vertical offset - align coordina. */
257   Int4            pnlLine;          /* number of visible lines     */
258   Int4            pnlWidth;         /* number of visible characters*/
259   Int4            vPage;            /* lines/page = pnlLine - 1    */
260   Int4            hPage;            /* car/page   = pnlWidth- 1    */
261   Int4            nlines;
262   Int4            curalignline;
263   SelStructPtr    firstssp;
264   SelEdStructPtr  lastses;
265   Int4            numberalignline;
266   Uint4Ptr        item_id;          /* array of itemID / line      */
267   Uint2Ptr        seqEntity_id;     /* array of entityID / line    */
268   Uint2Ptr        itemtype;         /* array of feattype / line    */
269   Uint2Ptr        itemsubtype;      /* array of feattype / line    */
270   Uint4Ptr        alignline;        /* array of alignment line index*/
271 
272   /*    text   */
273 
274   Handle          font;             /* font type                   */
275   Int2            ascent;
276   Int2            leading;
277   Int2            charw;
278   Int2            lineheight;
279   Uint4           colorRefs[256];
280   Int2            popcolor[10];
281   Int2            scaleheight;      /* scale height= 2 x lineheight */
282   Int2            interline;        /* space between lines          */
283   RecTc            margin;           /* margin (pix) around sequences*/
284   Int2            marginleft;       /* left margin (char)           */
285   Int2            intersalpwidth;
286 
287   /*   buffer of aligned char  - alignment coordinates */
288 
289   SelStructPtr    buffer;
290   SelStructPtr    buffertail;
291   ValNodePtr      linebuff;
292   Int4            minbufferlength;  /* MIN (2 screens or .length)   */
293   Int4            bufferlength;     /* varies with edit inser-del   */
294   Int4            bufferstart;      /* in alignment coordinates     */
295   Int4            editbuffer;       /* length of edit buffer        */
296   Int4Ptr         colonne;          /* seq position in the buffer   */
297 
298   /*   visible part of the buffer - buffer coordinates */
299 
300   Int4            visibleWidth;     /* alignt length per line in Panel*/
301   Int4            visibleLength;
302 
303   /*   options   */
304 
305   Int2            styleNum;
306   SelStruct       edit_item;
307   AlignStylePtr   newstyle;
308   Boolean         showfeat;
309   Boolean         drawrfp, drawrfm;
310   Boolean         drawcomplt;
311   Boolean         draw_scale;
312   Boolean         draw_bars;
313   Uint1           nscaleline;
314   Uint1           rowpcell;         /* rows per cell */
315   Uint1           columnpcell;      /* columns per cell */
316   Boolean         displaytype;
317   Boolean         charmode;         /* diff y/n >>> SetStatus ItemI */
318   Boolean         marginwithindex;  /* index in left margin    */
319   Boolean         marginwithIds;    /* Ids in left margin      */
320   Boolean         marginwithfeatid;
321   Boolean         marginwithpos;    /* position in left margin */
322   Boolean         marginwithgroup;
323   Int4            edit_pos;
324   Int4            feat_pos;
325   Int4            start_select;
326   Uint1           click_feat;
327   Uint1           clickwhat;
328   Uint1           mouse_mode;
329   DenseDiagPtr    select_block;
330   SelStruct       caret;            /* cursor within alignment */
331   Uint2           caret_line;
332   Uint2           feat_line;
333   Int4            caret_orig;
334   ValNodePtr      feat;
335   ValNodePtr      seqfeat;
336   ValNodePtr      allseqfeat;
337   Uint4           nfeat;
338   Uint1           prot_mode;
339   Uint1           printid;
340   Int4            stoptransl;
341   ValNodePtr      params;
342 
343   Boolean         spliteditmode;
344 
345   SelEdStructPtr  curfeat;
346   Uint1           align_format;     /* PHYLIP, MACAW, FASTA, ..*/
347   Uint2           ngroup;
348 
349   CharPtr         current_pattern;
350   SelStructPtr    match_pat;
351   SelStructPtr    cur_pat;
352 
353   /*   dialog   */
354 
355   VoidPtr         extra_data;
356   Int4            int4value2;       /* any value from dialog */
357   Int4            int4value;        /* any value from dialog */
358 
359   Uint1           display_panel;
360   Boolean         all_sequences;
361   Uint1           edit_mode;
362   Uint1           input_format;
363   Boolean         draw_emptyline;
364   Char            tmpfile [PATH_MAX];  /* path + filename         */
365 
366 } EditAlignData, PNTR EditAlignDataPtr;
367 
368 typedef struct compressseg {
369 
370   Int2            dim,
371                   numseg;
372   SeqIdPtr        ids;
373   Int4Ptr         from;
374   Int4Ptr         lens;
375   BoolPtr         starts;
376   Uint1Ptr        strands;
377   ScorePtr        scores;
378 
379 } CompSeg, PNTR CompSegPtr;
380 
381 typedef struct propastruct {
382 
383   SeqAnnotPtr  sap;
384   Uint2        source_entityID,
385                source_bspitemID,
386                target_entityID,
387                target_bsp_itemID;
388   SeqEntryPtr  target_sep,
389                source_sep;
390   ValNodePtr   source_seqfeat,
391                target_seqfeat;
392   Uint1        gap_choice;
393   Int4         stoptransl;
394   Boolean      keep_protID;
395 
396 } PropaStruct, PNTR PropaStructPtr;
397 
398 #endif
399