|
NCBI Home IEB Home C Toolkit docs C++ Toolkit source browser C Toolkit source browser (2) |
NCBI C Toolkit Cross ReferenceC/desktop/drawseq.h |
source navigation diff markup identifier search freetext search file search |
1
2 #ifndef _DRAWSEQ_
3 #define _DRAWSEQ_
4
5 /*local include files*/
6 #include <jzcoll.h>
7 #include <fstyle.h>
8 #include <layout.h>
9
10 /* #include <viewer.h> */
11 #include <picture.h>
12 #include <objmgr.h>
13
14
15 /**************************************************************************
16 *
17 * DrawSequinMap(slp_list, sep, scale)
18 * return a picture with the interface defined by Jonathan K.
19 * slp_list: a ValNode list of Seq-loc
20 * sep: the Seq-entry pointer
21 * scale: the scale of the picture
22 *
23 **************************************************************************/
24 SegmenT DrawSequinMap PROTO((ValNodePtr slp_list, SeqEntryPtr sep, Int4 scale, GeneDataPtr gdata, ValNodePtr PNTR ftype_list));
25
26 SegmenT DrawSequinMapEx PROTO((ValNodePtr slp_list, SeqEntryPtr sep, Int4 scale, GeneDataPtr gdata, ValNodePtr PNTR ftype_list,
27 Boolean forceSeglevelsTo1, ValNodePtr extraEntityList));
28
29
30 /*######################################################################
31 #
32 # functions for setting up the color for different object
33 #
34 ######################################################################*/
35
36 /************************************************************************
37 *
38 * get_seg_color(order)
39 * set up the color for a segmented sequence
40 *
41 *************************************************************************/
42 extern Uint1 MUSK_COLOR[3];
43 Uint1Ptr get_seg_color PROTO((Int2 order));
44
45
46
47 /**********************************************************************
48 *
49 * get the color for different enzymes
50 * used in drawing the restriction map
51 *
52 **********************************************************************/
53 Uint1Ptr get_enz_color PROTO((Int2 enzID));
54
55
56 void add_attribute_pen PROTO((SegmenT seg, Int2 p_class, Int2 sub_class));
57
58
59 /*####################################################################
60 #
61 # functions related to the drawing of FeatNode and AlignNode
62 #
63 #####################################################################*/
64
65 /**********************************************************************
66 *
67 * DrawFlatNode(vnp, seg, label_pos, downward)
68 * Draw a list of FeatNode as a stacked gene view
69 * vnp: a list of FeatNode
70 * seg: the Segment for drawing each item
71 * label_pos: if(TURE), label the position of each cluster
72 * downward: if(TRUE), label the cluster underneath the tickmark
73 *
74 ***********************************************************************/
75 Boolean DrawFlatNode PROTO((ValNodePtr vnp, SegmenT seg, Uint1 label_type, Int4 scale, GeneDataPtr gdata));
76
77 /*************************************************************************
78 *
79 * DrawFeatNode(vnp, type, rec_width, maxScale, seg, label_type, fill)
80 * Draw a list of featnode, return TRUE for success
81 * vnp: a list of featnode
82 * rec_width: width for drawing a rectangle. if <2, draw a line
83 * maxScale: max scale
84 * seg: drawing segment
85 * label_type: Add label on the segment
86 * fill: fill the rectangle?
87 *
88 *************************************************************************/
89 Boolean DrawFeatNode PROTO((ValNodePtr fnp_node, SegmenT seg, Uint1 label_type, Boolean show_arrow, Int4 scale, GeneDataPtr gdata));
90 /***********************************************************************
91 *
92 * DrawFeatures(features, mpp, pic, flat, simple, compact, f_order,
93 * maxScale)
94 *
95 * Draw the features in the a sequence
96 * features: the FeatNdoe contains the features
97 * mpp: the graphic position of the current sequence
98 * pic: the drawing segment
99 * flat: if TRUE, stack features on top
100 * simple: if TRUE, draw the feature intervals as line
101 * compact: if TRUE, does not distinguish subtype of different features
102 * f_order: the order for drawing different features
103 * maxScale: the maximum scale for drawing
104 * image_list: the list of AlignRect to store the image information
105 *
106 *********************************************************************/
107 Boolean DrawFeatures PROTO((ValNodePtr features, MapPosPtr mpp, SegmenT pic, Boolean flat, Uint1Ptr featureOrder, Uint1Ptr groupOrder, Int4 scale, GeneDataPtr gdata, ValNodePtr PNTR image_list));
108
109
110 /**********************************************************************
111 *
112 * DrawAlignNode(vnp, scale, seg)
113 * Draw a list of AlignNode.
114 * 1) It always labels the sequences
115 * 2) the label is always on top of the sequence
116 * 3) right now, it does NOT show the truncation
117 *
118 **********************************************************************/
119 Boolean DrawAlignNode PROTO((ValNodePtr vnp, Int4 scale, SegmenT seg));
120 Boolean DrawFlatAlign PROTO((SegmenT seg, ValNodePtr anp_list));
121
122
123
124 /*####################################################################
125 #
126 # functions used in chromoscope to draw the sequences, maps
127 #
128 ####################################################################*/
129 /*************************************************************************
130 *
131 * DrawGeneticMap(features, mpp, pic, maxScale)
132 * draw the genetic map from featnode
133 * features: the list of FeatNode, will be resorted
134 * mpp: the current map position. The drawing will recalculate
135 * mpp->seq_top and mpp->bottom
136 * pic: the drawing picture
137 * maxScale: the maximum scale in drawing. Will be used in the layout
138 * image_list: the list of AlignRect to store the image information
139 *
140 *************************************************************************/
141 Boolean DrawGeneticMap PROTO((ValNodePtr PNTR features, MapPosPtr mpp, SegmenT pic, Int4 maxScale, GeneDataPtr gdata, ValNodePtr PNTR image_list));
142
143
144 /*************************************************************************
145 *
146 * DrawPhysicalMap(features, mpp, pic, maxScale)
147 * draw the physical map from featnode
148 * features: the list of FeatNode, will be resorted
149 * mpp: the current map position. The drawing will recalculate
150 * mpp->seq_top and mpp->bottom
151 * pic: the drawing picture
152 * maxScale: the maximum scale in drawing. Will be used in the layout
153 * image_list: the list of AlignRect to store the image information
154 *
155 *************************************************************************/
156 Boolean DrawPhysicalMap PROTO((ValNodePtr PNTR features, MapPosPtr mpp, SegmenT pic, Int4 maxScale, ValNodePtr PNTR image_list));
157
158
159 /***********************************************************************
160 *
161 * DrawRestrictionMap(features, mpp, pic, rsite_flat, strand)
162 * draw the restriction map
163 * features: the FeatNode contains the info for restriction map
164 * mpp: the map position
165 * pic: picture
166 * rsite_flat: if(TRUE), all the enzymes are shown in one line.
167 * strand: the orientation of the map
168 *
169 ***********************************************************************/
170 Boolean DrawRestrictionMap PROTO((ValNodePtr PNTR features, MapPosPtr mpp, SegmenT pic, Boolean rsite_flat, Uint1 strand, Int4 maxScale));
171
172
173
174 /***********************************************************************
175 *
176 * DrawCytoMap(features, mpp, maxScale, pic)
177 * draw the cytogenetic map
178 * features: the FeatNode for cytogenetic map
179 * maxScale: maximum scale, used in layout
180 * pic: the drawing segment
181 *
182 ***********************************************************************/
183 Boolean DrawCytoMap PROTO((ValNodePtr PNTR features, MapPosPtr mpp, Int4 maxScale, SegmenT pic));
184
185
186 /*********************************************************************
187 *
188 * DrawSeqMap(features, mpp, pic, flat, maxScale, is_raw_seq)
189 * Draw the real sequence map
190 * features: FeatNode from which the Bioseqs can be extracted
191 * mpp: the MapPos that contains the current map position
192 * pic: the picture
193 * flat: if TRUE, draw the map with features stacked on top
194 * maxScale: maximum scale of the sequence
195 * is_raw_seq: if TRUE, it is a raw DNA sequence. (This is
196 * used to distinguish raw sequence from virtual sequence
197 *
198 *********************************************************************/
199 Boolean DrawSeqMap PROTO((ValNodePtr PNTR features, MapPosPtr mpp, SegmenT pic, Int4 scale, Boolean is_raw_seq, Boolean show_segment, ValNodePtr PNTR image_list));
200
201
202 /***********************************************************************
203 *
204 * DrawSeqScale(seg, slp, left, ypos, scaleX)
205 * draw a scale for the Seq-loc. It can be a list of Seq-loc
206 * seg: the drawing segment
207 * slp: the Seq-loc
208 * left: the left offset
209 * ypos: the top position
210 * scaleX: the current scale of the picture
211 *
212 ************************************************************************/
213 void DrawSeqScale PROTO((SegmenT seg, SeqLocPtr slp, Int4 left, Int4 ypos, Int4 scaleX, Boolean add_x_line));
214
215
216
217 /*************************************************************************
218 *
219 * DrawVerticalAlign (align, pic, mlp)
220 * draw alignment among the sequences. (connecting aligned seg by line)
221 * align: the Seq-align which contains the alignment among sequence
222 * It is assumed to be a Std-seg
223 * pic: the drawing segment
224 * mlp: the list of the layout of the sequences
225 *
226 *************************************************************************/
227 Boolean DrawVerticalAlign PROTO((SeqAlignPtr align, SegmenT pic, MapLayoutPtr mlp));
228
229 /************************************************************
230 *
231 * collect_alignnode_from_alp(m_loc)
232 * collect all the alignment stored as the history of the
233 * master sequence
234 * m_loc: the selected location of the master sequence
235 * return a list of AlignNode
236 *
237 ************************************************************/
238 ValNodePtr collect_alignnode_from_slp PROTO((SeqLocPtr m_loc, Uint2Ptr t_entityID, Boolean flat_insert));
239
240 SegmenT DrawSeqHistoryAlignment PROTO((SeqLocPtr m_loc, Int4 scale, ValNodePtr PNTR anp_list, Uint2Ptr entityID, Boolean flat_insert));
241
242 Boolean load_align_option_for_graphic PROTO((CollectAlignOptionPtr caop, CollectSeqOptionPtr csop, Int4 style, Boolean flat_insert));
243
244 Boolean DrawMPAlignment PROTO((ValNodePtr anp_node, Int4 left, Int4 right, SeqLocPtr m_loc, Uint2 entityID, Int4 scale, Int4Ptr cur_pos, Uint1 style, Boolean compress, SegmenT pic));
245
246 Boolean DrawHistory PROTO((ValNodePtr aligns, MapPosPtr mpp, Int4 seq_label_len, SegmenT pic, Int4 scale, ValNodePtr PNTR image_list));
247
248
249
250 /*********************************************************************
251 *
252 * DrawGenomeMap(slp_list, e_align_list, scale, mlp)
253 *
254 * draw all the SeqLocs in the list and show their alignment (if any)
255 * slp_list: the list of Seq-locs
256 * e_align_list: the list of alignment among the Seq-locs
257 * scale: the scale for the picture
258 * mlp: store the layout of the current picture
259 * return the picture of the genome map
260 * ftype_list: return a list of type of features for the current
261 * Seq-loc. This is going to be used for drawing the legend
262 * image_list: the list to store the image mapping information
263
264 *
265 *********************************************************************/
266 SegmenT DrawGenomeMap PROTO((ValNodePtr slp_list, ValNodePtr e_align_list, Int4
267 scale, GeneDataPtr gdata, MapLayoutPtr PNTR mlp, ValNodePtr PNTR ftyle_list, ValNodePtr PNTR image_list));
268
269 SegmenT DrawGenomeMapEx PROTO((ValNodePtr slp_list, ValNodePtr e_align_list, Int4
270 scale, GeneDataPtr gdata, MapLayoutPtr PNTR mlp, ValNodePtr PNTR ftyle_list, ValNodePtr PNTR image_list,
271 Boolean forceSeglevelsTo1, ValNodePtr extraEntityList));
272
273 /*************************************************************************
274 *
275 * Label_GData(): Label the gene_data node specified by the user
276 *
277 *************************************************************************/
278 Boolean Label_GData PROTO((GeneDataPtr gdata, SeqLocPtr slp, Int4 left, Int4 top, SegmenT seg));
279
280 #define MAX_SCALE 5000
281 Int4 FigureMaxScale PROTO((ValNodePtr slp_list, Int2 view_width, Int4 max_width));
282 Int4 FigureMinScale PROTO((ValNodePtr slp_list, Int4 max_label));
283
284 Int4 CountMaxSeqLabel PROTO((ValNodePtr slp_list));
285
286 /*************************************************************************
287 *
288 * Find_segment_IDs(): Returns identifier triplet given a mouse point
289 *
290 *************************************************************************/
291 /* extern Boolean Find_segment_IDs PROTO((VieweR viewer, PoinT pt, Uint2Ptr entityID, Uint2Ptr itemID, Uint2Ptr itemType)); */
292
293 void draw_one_align PROTO((AlignPos ap, Int2 num, Int2 order, SegmenT seg));
294
295
296 #define UNKNOWN_DB 0
297 #define ENTREZ_DB 1 /*entrez is the database*/
298 #define THC_DB 2 /*db is the THC tigr database*/
299 #define ENTREZ_KLUDGE_ID 3 /*for kludge id in Entrez */
300 #define ENTREZ_DB_P 4 /*entrez proteins is the database*/
301 typedef struct alignlabelrect {
302 Uint1 link_db; /*database for the gi*/
303 Int4 gi;
304 Int4 left;
305 Int4 top;
306 Int4 right;
307 Int4 bottom;
308 Uint2 itemType;
309 Uint4 itemID;
310 CharPtr label;
311 Int4 from, to; /*the interval on the sequence. For showing partial Seq-loc*/
312 }AlignLabelRect, PNTR AlignLabelRectPtr;
313
314 /************************************************************************
315 *
316 * load the information for image mapping
317 *
318 ************************************************************************/
319 Boolean load_align_label_rectangle PROTO((ValNodePtr data_list, ValNodePtr PNTR arect_list, Int4 scale, Boolean flat));
320 /*
321 * for the contig maps, the real contig length may not correspond
322 * with the mapped interval on the graphics. Need a way to find the
323 * store the interval mapped in proportion to what is in the graphic
324 * the intervals are mapped by the function: FindContigList
325 */
326 void AddIntervalForImage PROTO((ValNodePtr contig_list, ValNodePtr image_list));
327
328
329 SegmenT PicForAlignNode PROTO((ValNodePtr anp_list, SeqLocPtr m_loc, Int4 width, Int4Ptr p_scale, Int4Ptr p_maxwidth, ValNodePtr PNTR arect_list));
330
331
332 /***********************************************************************
333 *
334 * functions to draw a compressed alignment viewer
335 *
336 ************************************************************************/
337 SegmenT DrawCompressAlignment PROTO((ValNodePtr anp_list, SeqLocPtr m_loc, Int4 width,
338 Int4Ptr p_scale, Int4Ptr p_maxwidth, Uint2 entityID, ValNodePtr PNTR arect_list));
339
340 ValNodePtr MakeCompressAlignList PROTO((BioseqPtr query_bsp, SeqAnnotPtr annot, Uint2Ptr p_entityID));
341
342 /*produce a picture which shows the contigs that align to the
343 * cytogenetic band. It will expand left to the half band size and
344 * right to the half band size. pic_width is the width of the picture
345 */
346 SegmenT DrawCytoContigMap PROTO((ValNodePtr slp_list, BioseqPtr cyto_bsp,
347 Int4 pic_width, Int4Ptr pscale, ValNodePtr PNTR image_list));
348 #endif
349 |
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more information. |