~ubuntu-branches/ubuntu/intrepid/ncbi-tools6/intrepid

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
/*   ingengraph.h
* ===========================================================================
*
*                            PUBLIC DOMAIN NOTICE
*            National Center for Biotechnology Information (NCBI)
*
*  This software/database is a "United States Government Work" under the
*  terms of the United States Copyright Act.  It was written as part of
*  the author's official duties as a United States Government employee and
*  thus cannot be copyrighted.  This software/database is freely available
*  to the public for use. The National Library of Medicine and the U.S.
*  Government do not place any restriction on its use or reproduction.
*  We would, however, appreciate having the NCBI and the author cited in
*  any work or product based on this material
*
*  Although all reasonable efforts have been taken to ensure the accuracy
*  and reliability of the software and data, the NLM and the U.S.
*  Government do not and cannot warrant the performance or results that
*  may be obtained by using this software or data. The NLM and the U.S.
*  Government disclaim all warranties, express or implied, including
*  warranties of performance, merchantability or fitness for any particular
*  purpose.
*
* ===========================================================================
*
* File Name:  ingengraph.h
*
* Author:  Fasika Aklilu
*
* Version Creation Date:   4/26/01
*
* $Revision: 6.6 $
*
* File Description: 
*
* Modifications:  
* --------------------------------------------------------------------------
* Date     Name        Description of modification
* -------  ----------  -----------------------------------------------------
*
*
* ==========================================================================
*/

#ifndef _INGENGRAPH_
#define _INGENGRAPH_

#ifdef __cplusplus
extern "C" {
#endif

#include <seqmgr.h>
#include <ncbi.h>
#include <vibrant.h> 
#include <picture.h> 
#include <viewer.h> 
#include <objmgr.h> 
#include <sequtil.h>
#include <explore.h>
#include <gather.h>
#include <seqport.h>
#include <sqnutils.h>
#include <alignmgr2.h>
#include <jsavlt.h>

/******************************************************
 *
 *  defines for the Genome Viewer of UDV
 *
******************************************************/
#define FEATURE_SEGMENT_MAXSIZE 500 /*a segment contains a max of 500 features*/
#define Ing_FEAT_LINEDECAL 20/* was 8 */ /*on the Feature Viewer, the line height is 8 pixels*/
#define Ing_FEAT_HEIGHT 2 /*on the Feature Viewer the height of a Feature is 3 pixels*/
#define LEVEL1_MAXNUM  20 /* top level segment contains max of 20 level 2 segments */
#define LEVEL2_MAXNUM  20 /* second level segment contains max of 20 level 3 segments */
#define COMPRESS_SCALE 500

#define Ing_black       121
#define Ing_red         122
#define Ing_blue        123
#define Ing_green       124
#define Ing_cyan        125
#define Ing_magenta     126
#define Ing_purple      127
#define Ing_yellow      128
#define Ing_grey        129
#define Ing_MAX         130

#define Ing_GENSCAN   110
#define ALIGN_ANNOT    111 /* alignment from running blast vs. db */
#define Ing_SPIDEY    112
#define ALIGN_FILE     113/* alignment from asn file */
#define ALIGN_BLAST    114/* alignment annotated on sequence */
#define ALIGN_BLAST2SEQ    115 /* alignment from running blast2seq */
#define Ing_ORF       116
#define Ing_SUMMARY   117
#define Ing_FEAT_TABLE 118
#define Ing_TBDL    119
#define Ing_SEQIDLISTFORSPIDEY 120
#define Ing_SEQIDLISTFORBLAST 121
#define Ing_DOTMATRIX 122

/******************************************************
 *
 *  data structures for the Genome Viewer 
 *
******************************************************/


typedef struct gvpopfeat{/*data structure used to populate features viewer*/
  SegmenT   pictRuler;
  SegmenT   pictMain;
  SegmenT   CurrentSeg;
  SegmenT   seg1;
  SegmenT   seg2;
  Uint1Ptr  PNTR pClr;
  Boolean    showLabels;
  Boolean    bSaved;
  Boolean    bTrim;
  Uint4      nSegs; /* number of subsegments below Current segment */
  Uint4      nPrims;  /* prim counter */
  Uint4      nLevel3; /* level 3 segments counter */
  Uint4      nLevel2; /* level 2 segments counter */
  Uint4      nLevel1; /* level 1 segments counter */
  ValNodePtr  PopRowsList;
  ValNodePtr  vnp_top10; /* used to trim linked list */
  ValNodePtr  vnp_last;
  ValNodePtr  group1;
  ValNodePtr  group1_last;
  ValNodePtr  group2;
  ValNodePtr  group2_last;
  ValNodePtr  group3;
  ValNodePtr  group3_last;
  Int4      nPopRows;      /* feature row counter */
  Int4      yBase;
  Int4      scaleX;         
  Int4      max_label;      /* width of largest label */
  SeqLocPtr  slp;
  Int4       left;
  Int4       right;
} IngPopFeat, PNTR IngPopFeatPtr;


typedef struct gvgraphdata{
	/*font size*/
	Int2 cxChar;
	Int2 cyChar;
  FonT hFnt;
	/*values used to draw the rulers*/
	Int2 SegBoxHeight;
	Int2 SegRulerTick;
	Int2 SegRulerIn;
	Int4 DecalSegRuler;
	Int4 DecalZoomRuler;
   Uint1Ptr PNTR pClr;
} IngGraphData, PNTR IngGraphDataPtr;


typedef struct gvpopnames{/*used to populate the Segments in Viewer*/
  VieweR          viewer;
	SegmenT        seg;
  Uint1Ptr        seqbuf;
  Int4            scaleX;
  Uint1           comp;
  Boolean         bRegister;
  Uint2           procID;
  Uint2           userKey;
  OMMessageFunc   messagefunc;
  Pointer         data;
  SeqLocPtr       slp;
  BioseqPtr       bsp;
  ValNodePtr      slp_list;
  Boolean         bPopSlp;
  Boolean         bShowGC;
  Boolean         bLabels;
  Boolean         bTop;
  Int4            idx;
  Int4            left, right;
  IngGraphDataPtr GrData;
} IngExploreSegs, PNTR IngExploreSegsPtr;


  typedef struct ing_trackaligns{
    ValNodePtr  hidelist;
    ValNodePtr  showlist;
    CharPtr PNTR namelist;
    CharPtr PNTR hnamelist;
    Boolean      update;
    Int4         showindex;
    Int4         hideindex;
  } IngTrackAligns, PNTR IngTrackAlignsPtr;


  typedef struct ingseqannotdata{
    Int4         sindex;
    Int4         hindex;
    ValNodePtr   aln_hidelist;
    ValNodePtr   aln_showlist;
    CharPtr PNTR aln_namelist;
    CharPtr PNTR aln_hnamelist;
    IngTrackAlignsPtr tap;
  }IngSeqAnnotData;
  


  
  typedef struct ing_entitylist{
    ValNode *Sips;               /* list of sips in SeqEntry */
    Uint2    entityID;
    Uint4    itemID;
    Int4     bspcount;
    struct   ing_entitylist PNTR next;
  } IngEntity, PNTR IngEntityPtr;
  

  typedef struct win_data{
    MenU      Edit;
    MenU      Run;
    MenU      Options;
    MenU      Analysis;
    MenU      Annotate;
    MenU      Feat;
    GrouP     Goto;
    IteM      labels;
    IteM      mrnaorexons;
    IteM      GC;
  } IngWinData, PNTR IngWinDataPtr;

typedef struct ing_genomeviewer{
  WindoW      hMain;
  WindoW      hReport;
  GrouP       gMain;
  /*graphic elements*/
  VieweR      vRuler1;
  VieweR      vTop;
  VieweR      vRuler2;
  VieweR      vBottom;
  SegmenT     pictRuler1;
  SegmenT     pictTop;
  SegmenT     pictRuler2;
  SegmenT     pictBottom;
  VieweR      vZoom;
  SegmenT     pictZoom;
  PrompT      featInfo[4];
  CharPtr     defline;
  CharPtr     defline2;
  GrouP       deflineg;
  PopuP       pageControl;
  Uint2       sel_entityID;
  Uint4       sel_itemID;
  GrouP       Buttons;
  IteM        item_usenetwork;
  Boolean     update;
  Boolean     bOverviewSelected;
  /*data to display*/
  Uint2       procID;
  Uint2       userKey;
  Uint2       entityID;
  Uint4       itemID;
  Uint2       itemType;
  BioseqPtr   bsp;
  Boolean     bspIsLocked;
  Int4        from;
  Int4        to;
  Int4        SeqLength;/* length of user specified region*/
  Int4        bspLength; /* total sequence length */
  Int4        scale_index;
  Int4Ptr     scale_array;
  Int4        scaleX;
  Int4        maxScaleX;
  Boolean     bMaxScale;
  IngEntityPtr entity_list;
  Int4        numseqs;
  Int4        ZoomedVal;
  Int4        last_feat_position_top;
  Int4        last_feat_position_bottom;
  Int2        TopHeight;
  Int4        xposition;
  Char        title[50];
  Boolean     bLabels;
  Boolean     isExons;
  Boolean     user_defined;
  SeqLocPtr   slp;  
  IngGraphData GrData;
  IngTrackAligns talign;
  IngWinDataPtr d_Win;
  /* variables for imported features -- from sequence analysis */
  Boolean     bDustExists;
  Boolean     bOrfExists;
  Boolean     bShowGC;
  Pointer     data;
  Uint1Ptr    seqbuf;
  Uint1       comp; 
  LisT bsp_list;          /* listbox of bsps */
  SeqIdPtr    cur_sip;
  Int2        cur_target;
  IteM        imemory;
  /* data info */
  Int4        filetype; /* reading in output files */
  Int2        nAnnotFeats;
  /* zoom */
  PrimitivE   zoomFbar;
	/*internal use only*/
  Int4       idx;
  Boolean bSegmented;
  /* progress notice vars */
  CharPtr    progress_string;
  Boolean    progress_running;
  Int4       progress_timer;
  PrompT     progress_prompt;
  Char       progress_counter[20];
} IngGenomeViewer , * IngGenomeViewerPtr;



extern Boolean IngfeatDefFilter[FEATDEF_MAX];/* filter parameter for SeqMgrExploreFeatures() */

extern Boolean IngfeatDefTrack2[FEATDEF_MAX];/* used by Ing_AddToOverviewPage()  when scale is greater than COMPRESS_SCALE */

extern Uint1   IngfeatDefTrack[FEATDEF_MAX];/* track features 1=exists 2=exists and is visible */

/*******************************************************************************

	Static Function Declarations

*******************************************************************************/
extern void Ing_AddGCRect(SegmenT seg, SeqIdPtr sip, Uint2 entityID, Uint4 itemID, Uint2 itemtype, Uint1Ptr seq, Int4 left, Int4 top, Int4 right, Int4 bottom, Int4 scaleX,  Uint1 strand, Boolean needs_label, Boolean clickable, Int4 idx, Boolean bShowGC);

extern SegmenT Ing_PopulateSequinGraphic(SegmenT seg, BioseqPtr bsp, Uint2 entityID, Uint4 itemID, Int4 scaleX);

extern void Ing_AddRuler(SegmenT seg, Int4 height, Int4 xstart,Int4 xstop, Int4 scaleX, Int4 scaleY, Boolean add_whitespace);

extern void Ing_InitGrData(IngGraphDataPtr gdp);

extern Uint4 Ing_PopDetailedPage(BioseqPtr bsp, SegmenT pictBottom, Int4 left, Int4 right, Uint1Ptr PNTR pClr, Int4 scaleX, Int4 start_row, Boolean Labels, Boolean isExons, IngTrackAlignsPtr tap);
extern Uint4 Ing_PopOverviewPage(BioseqPtr bsp, SegmenT pictTop, Int4 left, Int4 right, Uint1Ptr PNTR pClr, Int4 maxScaleX, IngTrackAlignsPtr tap);

extern Uint1Ptr PNTR Ing_BuildColorTable(void);
  extern Uint1Ptr PNTR Ing_FreeColorTable(Uint1Ptr PNTR pClr);

extern Uint1Ptr  Ing_PutColor(Uint1 r, Uint1 g, Uint1 b);

extern Boolean LIBCALLBACK Ing_ExploreSegments(SeqLocPtr slp, SeqMgrSegmentContextPtr context);

extern void Ing_InitfeatDefFilter(void);
extern void Ing_SearchAli(SeqEntryPtr sep, Pointer mydata, Int4 index, Int2 indent);  
extern Uint8 Ing_BigEncodeIdxFeat (Uint4 val1,Uint4 val2);
extern void  Ing_BigDecodeIdxFeat (Uint8 index_g, Uint4Ptr val1, Uint4Ptr val2);
extern Boolean Ing_PopOverviewRuler(VieweR vRuler1, SegmenT pictRuler1, BioseqPtr bsp, IngGraphData GrData, Int4 from, Int4 to, Uint1Ptr seqbuf, Int4 scaleX);
extern Int4 Ing_GetValue (TexT t);



#ifdef __cplusplus
}
#endif

#endif /* ndef _INGENGRAPH_ */