1 /* $Id: jzcoll.h,v 6.8 2006/07/13 17:06:38 bollin Exp $
2 * ===========================================================================
3 *
4 *                            PUBLIC DOMAIN NOTICE
5 *               National Center for Biotechnology Information
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 have not placed any restriction on its use or reproduction.
13 *
14 *  Although all reasonable efforts have been taken to ensure the accuracy
15 *  and reliability of the software and data, the NLM and the U.S.
16 *  Government do not and cannot warrant the performance or results that
17 *  may be obtained by using this software or data. The NLM and the U.S.
18 *  Government disclaim all warranties, express or implied, including
19 *  warranties of performance, merchantability or fitness for any particular
20 *  purpose.
21 *
22 *  Please cite the author in any work or product based on this material.
23 *
24 * ===========================================================================
25 *
26 * File Name:  $RCSfile: jzcoll.h,v $
27 *
28 * Author:  Jinghui Zhang
29 *
30 * Initial Version Creation Date: 03/24/97
31 *
32 * $Revision: 6.8 $
33 *
34 * File Description:
35 *         File for various alignments
36 *
37 * $Log: jzcoll.h,v $
38 * Revision 6.8  2006/07/13 17:06:38  bollin
39 * use Uint4 instead of Uint2 for itemID values
40 * removed unused variables
41 * resolved compiler warnings
42 *
43 * Revision 6.7  2000/11/16 22:10:38  shavirin
44 * Moved many functions from txalign.c - due to move of txalign.c to
45 * distrib/tools directory and libncbitool.a library.
46 *
47 * Revision 6.6  2000/11/01 14:43:12  madden
48 * Changes from Futamura for psitblastn
49 *
50 * Revision 6.5  1999/08/06 17:58:22  egorov
51 * Print correct GI in formated output when user has specified list of gi's in blast search
52 *
53 * Revision 6.4  1998/07/22 18:57:34  kans
54 * reconciled in new functions from JZ
55 *
56 * Revision 6.3  1997/12/30 19:31:48  kans
57 * added CollectItemForSeqLocEx to restore propagation of features from parts to segmented bioseq
58 *
59 * Revision 6.2  1997/11/14 22:13:37  vakatov
60 * [WIN32,DLL]  Added NLM_EXTERN's
61 *
62 * Revision 6.1  1997/09/16 20:03:17  zjing
63 * new functions
64 *
65 * Revision 6.0  1997/08/25 18:06:17  madden
66 * Revision changed to 6.0
67 *
68 * Revision 5.13  1997/08/13 18:45:33  zjing
69 * add support for tblastx
70 *
71 * $Revision: 6.8 $
72 *
73 * File Description:
74 *         File for various alignments
75 *
76 * $Log: jzcoll.h,v $
77 * Revision 6.8  2006/07/13 17:06:38  bollin
78 * use Uint4 instead of Uint2 for itemID values
79 * removed unused variables
80 * resolved compiler warnings
81 *
82 * Revision 6.7  2000/11/16 22:10:38  shavirin
83 * Moved many functions from txalign.c - due to move of txalign.c to
84 * distrib/tools directory and libncbitool.a library.
85 *
86 * Revision 6.6  2000/11/01 14:43:12  madden
87 * Changes from Futamura for psitblastn
88 *
89 * Revision 6.5  1999/08/06 17:58:22  egorov
90 * Print correct GI in formated output when user has specified list of gi's in blast search
91 *
92 * Revision 6.4  1998/07/22 18:57:34  kans
93 * reconciled in new functions from JZ
94 *
95 * Revision 6.3  1997/12/30 19:31:48  kans
96 * added CollectItemForSeqLocEx to restore propagation of features from parts to segmented bioseq
97 *
98 * Revision 6.2  1997/11/14 22:13:37  vakatov
99 * [WIN32,DLL]  Added NLM_EXTERN's
100 *
101 * Revision 6.1  1997/09/16 20:03:17  zjing
102 * new functions
103 *
104 * Revision 5.10  1997/06/19 18:38:08  vakatov
105 * [WIN32,MSVC++]  Adopted for the "NCBIOBJ.LIB" DLL'ization
106 *
107 * Revision 5.9  1997/05/12 19:53:54  zjing
108 * change the maximum number of sequences in an alignment to 150.
109 *
110  * Revision 5.8  1997/03/24  20:50:45  shavirin
111  * Added protection for usage with C++ compiler. Added NCBI header
112  * started logging.
113  *
114 *
115 * ==========================================================================
116 */
117 
118 #ifndef _JZCOLL_
119 
120 #define _JZCOLL_
121 
122 /*local include file*/
123 #include <maputil.h>
124 #include <gather.h>
125 #include <seqport.h>
126 
127 
128 #undef NLM_EXTERN
129 #ifdef NLM_IMPORT
130 #define NLM_EXTERN NLM_IMPORT
131 #else
132 #define NLM_EXTERN extern
133 #endif
134 
135 #ifdef __cplusplus
136 extern "C" {
137 #endif
138 
139 /*******************************************************************
140 *
141 *       ck_seqfeat_extra: check if there is  extra data, such as
142 *       Genbank accessions assocated with a GeneRef or Medlines
143 *       associated with a Seq-feat
144 *
145 *******************************************************************/
146 #define NO_EXTRA_DATA	((Uint4)0)
147 #define EXTRA_MEDLINE	((Uint4)1)
148 #define EXTRA_GENBANK	((Uint4)2)
149 
150 /*the different types of markers*/
151 #define MARK_TYPE_NUM		7
152 #define NO_TYPE			0
153 #define FRAME_WORK		1
154 #define RECMIN			2
155 #define LIKELY			3
156 #define MDUP			4
157 #define DUP			5
158 #define CONTIG_STS		6
159 
160 /*corresponding type in extra field*/
161 #define EXTRA_FRAME_WORK	((Uint4)4)	/*it is  a frame work marker*/
162 #define EXTRA_RECMIN		((Uint4)8)	/*it is a recmin marker, for CHLC*/
163 #define EXTRA_LIKELY		((Uint4)16)	/*it is a likely loci marker, for CHLC*/
164 #define EXTRA_MDUP		((Uint4)32)
165 #define EXTRA_DUP		((Uint4)64)
166 #define EXTRA_CONTIG_STS	((Uint4)128)
167 #define EXTRA_LOD_SCORE		((Uint4)256)
168 
169 
170 /*the different types for a marker in its genetic context, EG for Eric Green*/
171 #define EG_YAC_END	1
172 #define EG_RANDOME	2
173 #define EG_GENETIC	3
174 #define EG_GENE		4
175 #define EG_EST		5
176 #define EG_MISC		6
177 
178 #define EXTRA_YAC_END	((Uint4)256)
179 #define EXTRA_RANDOM	((Uint4)512)
180 #define EXTRA_GENETIC	((Uint4)1024)
181 #define EXTRA_GENE	((Uint4)2048)
182 #define EXTRA_EST	((Uint4)4096)
183 #define EXTRA_MISC	((Uint4)8192)
184 
185 NLM_EXTERN Uint4 ck_seqfeat_extra PROTO((SeqFeatPtr sfp));
186 NLM_EXTERN Uint1 get_map_type PROTO((Uint4 extra));
187 
188 
189 #define ALL_LABEL       1
190 #define STR_LABEL       2
191 #define NUM_LABEL       3
192 
193 #define NO_LABEL	255
194 #define UPPER_LABEL	1
195 #define LOWER_LABEL	2
196 
197 
198 #define NO_FILTER	0
199 typedef struct collectseqoption {	/*option for drawing the sequence+feature*/
200 	Boolean nointerval;	/*do not collect the intervals, only the two ends*/
201 	Uint1 slabel_format;		/*styles for label the sequence*/
202 	Uint1 flabel_format[FEATDEF_ANY];	/*the format for labels*/
203 	Uint1 seglevels;	/*level of segmentation to go down*/
204 	Int2 label_size;
205 	Int2 filter_level;	/*the level to be filtered out*/
206 	Boolean features[FEATDEF_ANY];	/*for filtering unwanted features*/
207 	Uint1 bsp_type;		/*type of Bioseq. This is to decide
208 				 if the features need to be collected on
209 				 the cytogenetic map*/
210 }CollectSeqOption, PNTR CollectSeqOptionPtr;
211 
212 
213 #define COLLECT_HISTORY 1	/*as a history*/
214 #define COLLECT_MP		2	/*multiple pairwise*/
215 #define COLLECT_MD		3	/*multi-dimension*/
216 #define COLLECT_FIXED	4	/*for the fixed format*/
217 #define COLLECT_MP_FLAT	5	/*flat out the mulitple pairwise alignment*/
218 
219 
220 #define DEFAULT_ALIGN_NUM 150        /*maximum number of alignment to be displayed*/
221 typedef struct collectalignoption {	/*option for drawing the sequence+feature*/
222 	Uint1 slabel_format;		/*format for label a sequence in the alignment*/
223 	Boolean nointerval;	/*do not collect the intervals, only the two ends*/
224 	Boolean only_history;	/*skip the Seq-annot?*/
225 	Boolean map_insert;	/*map the insertions*/
226 	Boolean flat_insert;	/*to flatout the insertions*/
227 	Boolean map_graphic;	/*map the coordinate to the graphic?*/
228 
229 	Boolean show_mismatch;
230 
231 	Boolean show_feature;		/*show any feature?*/
232 	Int4 	align_num;	/*the maximun number of alignment to collect*/
233 	Int4 curr_align_num;	/*the current number of the alignments*/
234 	SeqLocPtr segloc;			/*for marking the regions used in a segmented sequence*/
235 	Int2 label_size;
236 	Int4 graphic_offset;
237 	Boolean no_sort;		/*if TRUE, do NOT sort the AlignNode*/
238 	CollectSeqOptionPtr csop;	/*for collecting feature-related information*/
239 
240 }CollectAlignOption, PNTR CollectAlignOptionPtr;
241 
242 
243 NLM_EXTERN Boolean set_option_for_collect_align PROTO((CollectAlignOptionPtr caop, Int2 label_size, Uint1 style));
244 /*######################################################################
245 #
246 #	collect functions
247 #
248 ######################################################################*/
249 
250 /***********************************************************************
251 *
252 *	CollectItemForSeqLoc(slp, entityID, left, is_aa, csop)
253 *	Collect sequences, features for a Seq-loc
254 *	slp: the target Seq-loc
255 *	entityID: the top level entityID for the current sequence
256 *	left: the left offset on the graph
257 *	is_aa: if TRUE, set get_feats_product flag to TRUE
258 *	csop: the collection option
259 *
260 *
261 ***********************************************************************/
262 NLM_EXTERN ValNodePtr CollectItemForSeqLoc PROTO((SeqLocPtr slp, Uint2 entityID, Int4 left, Boolean is_aa, SeqIdPtr maybe_mapid, CollectSeqOptionPtr csop, GeneDataPtr gdata, Uint2 priority));
263 NLM_EXTERN ValNodePtr CollectItemForSeqLocEx PROTO((SeqLocPtr slp, Uint2 entityID, Int4 left, Boolean is_aa, SeqIdPtr maybe_mapid, CollectSeqOptionPtr csop, GeneDataPtr gdata, Uint2 priority, Boolean forceSeglevelsTo1));
264 
265 
266 
267 /*****************************************************************************
268 *
269 *	cllect_master_align_node(m_loc, featureOrder, groupOrder)
270 *	in the master-slave alignment, a fake Seq-align is created for the
271 *	master sequence where the master is aligned to itself. The AlignNode
272 *	can be computed for this faked alignment. When this is done, the fake
273 *	Seq-align will be freed
274 *
275 *	m_loc: the Seq-loc for the master sequence
276 *	featureOrder: the selected features
277 *
278 ******************************************************************************/
279 NLM_EXTERN ValNodePtr collect_master_align_node PROTO((CollectAlignOptionPtr caop, SeqLocPtr m_loc, Uint1 obj_type, Uint2 entityID));
280 
281 
282 NLM_EXTERN ValNodePtr CollectItemForAlignment PROTO((SeqLocPtr slp, Uint2 entityID, Int4 left, CollectAlignOptionPtr caop, Boolean take_all_annot));
283 
284 NLM_EXTERN ValNodePtr collect_anpnode_with_option PROTO((CollectAlignOptionPtr caop, SeqLocPtr m_loc, Uint2 entityID, Int4 style, Uint1 itemType, Uint1Ptr f_order, Uint1Ptr g_order, Boolean take_all_annot));
285 
286 typedef struct featnode {       /*for collecting the features*/
287   Uint4       itemID;
288   Uint2       entityID;
289   Uint1       feattype;         /*type for Seq-feat*/
290   Uint1	      subtype;		/*subtype for Seq-feat*/
291   Int2            band;         /*band type for CytoGenetic Map, defined in maputil.h*/
292   GatherRange extremes;
293   ValNodePtr  interval; /*the intervals, data->ptrvalue is GatherRange*/
294   CharPtr     label;
295   CharPtr     pos_label;        /*label the position of a map */
296   Int4        line;
297   Int4	      top;		/*the top of the box*/
298   Int4	      bottom;		/*the bottom of the box*/
299   Int4        labelHeight;	/*the height of a label*/
300   Int4        label_len;	/*the PIXEL length of the label*/
301   Boolean     draw_tick;	/*draw the tick mark in a map*/
302   Boolean     has_product;
303   Boolean     follower;		/*is it a follower?*/
304   Uint4       extra_data;	/*flags for extra data such as medline*/
305   Boolean     landmark;		/*is it a landmark?*/
306   Uint2       bin_order;	/*order for the 1000:1 bin data*/
307   Char        annotDB[21];		/*the descriptor for the parent*/
308   Int4	      ef_left;		/*extreme left, with the label font offset*/
309   Int4        ef_right;
310   ValNodePtr  supress_node;	/*the FeatNode uppressed to avoid stacking*/
311 } FeatNode, PNTR FeatNodePtr;
312 
313 typedef struct ivalnode {	/*intervals in a feature*/
314   GatherRange gr;
315   Int4 line;
316 } IvalNode, PNTR IvalNodePtr;
317 
318 /***********************************************************************
319 *
320 *       FreeFeatureList(list)
321 *       free a list of FeatNode
322 *
323 ***********************************************************************/
324 NLM_EXTERN ValNodePtr FreeFeatureList  PROTO((ValNodePtr list));
325 
326 /*********************************************************************
327 *
328 *	extract_node_list(head, itemType, entityID, feattype, subtype,
329 *	label_type)
330 *	extract a list of featnode from head which will have the
331 *	selected itemType, entityID, feattye, subtype, label_type.
332 *	set values to 0 if it is not considered in the selection
333 *
334 *********************************************************************/
335 NLM_EXTERN ValNodePtr extract_node_list PROTO((ValNodePtr PNTR head, Uint1 itemType, Uint2 entityID, Uint1 feattype, Uint1 label_type));
336 
337 NLM_EXTERN ValNodePtr extract_lollipop_feature PROTO((ValNodePtr PNTR head, Int4 scale, BoolPtr lolli_feature));
338 
339 /***********************************************************************
340 *
341 *	SortFeatNode(list)
342 *	sort a list of FeatNode to the ascending order of (extremes.left,
343 *	extremes.right)
344 *
345 **********************************************************************/
346 NLM_EXTERN ValNodePtr SortFeatNode PROTO((ValNodePtr list, Uint1Ptr featureOrder, Uint1Ptr groupOrder));
347 
348 
349 /**********************************************************************
350 *
351 *	merge_same_itemID(head, itemID)
352 *	search in the list of FeatNode to link all the FeatNode that has
353 *	the same itemID.
354 *	head: the list of FeatNode
355 *	itemID: the itemID in search
356 *	return the list of FeatNode with the same itemID
357 *
358 **********************************************************************/
359 NLM_EXTERN ValNodePtr merge_same_itemID PROTO((ValNodePtr PNTR head, Uint4 itemID));
360 
361 
362 typedef struct alignblock{
363   GatherRange gr;
364   Uint2 order;
365   struct alignblock PNTR next;
366 }AlignBlock, PNTR AlignBlockPtr;
367 
368 #define MISMATCH_LINE	0	/* draw mismatch in alignment as a line*/
369 #define MISMATCH_OPEN	1	/*draw mismatch as an open circle*/
370 #define MISMATCH_CLOSE	2	/*draw mismatch as a closed circle*/
371 #define MISMATCH_SQUARE 3	/*draw mismatch as a square*/
372 /*value is reserved for Eric Greens Map only */
373 #define MISMATCH_AMB	4	/*for the ambiguous residue*/
374 
375 
376 /*the three values were used for the annotinfo.consistent values.
377   thouse were used to define the quality of the alignment between
378   the contigs and the chromosome in Eric Green's physical map. */
379 #define ALIGN_CONSISTENT	1
380 #define ALIGN_INCONSISTENT	2
381 #define ALIGN_UNKNOWN		3
382 #define ALIGN_FISH		4
383 
384 #define ALIGN_BLASTN    1
385 #define ALIGN_BLASTP    2
386 #define ALIGN_BLASTX    3
387 #define ALIGN_TBLASTN   4
388 #define ALIGN_TBLASTX	5
389 #define ALIGN_PSITBLASTN   6
390 
391 typedef struct annotinfo {	/*information stored in Seq-annot*/
392 	Uint1 displayOrder;
393 	Uint1 consistent;	/*the type of the consistency*/
394 	Char annotDB[21];
395 	Uint2 entityID;
396 	Uint4 itemID;
397 	Uint1 annot_type;	/*is it a BLAST/Consist/FISH alignment */
398 	Uint1 blast_type;	/*if it is alignment from BLAST, what is the type*/
399 	Boolean is_fish_align;	/*is it the alignment for the FISH map */
400 }AnnotInfo, PNTR AnnotInfoPtr;
401 
402 /*******************************************************************
403 *
404 *	structure used to draw Sequence alignment
405 *	if follower is set to TRUE, it will be grouped together
406 *	with the previous non-follower vnp. That enables the display
407 *	of the same sequences in multiple alignments
408 *
409 ********************************************************************/
410 typedef struct alignseg {
411   Uint1 type;			/*type of alignment. GAP? Insertion? Diag?*/
412   GatherRange gr;
413   Int2 featnum;			/*number of collected features*/
414   ValNodePtr mismatch;		/*the position of mismatched residues*/
415   Int4 ins_pos;			/*position of insertion*/
416   Int4 top;
417   Int4 bottom;
418   Int4 line;
419   ValNodePtr cnp;		/*list of FeatNode associated with the seg*/
420   struct alignseg PNTR next;
421 } AlignSeg, PNTR AlignSegPtr;
422 
423 /*values for the sequence index map*/
424 
425 /*
426 *       the four mapping status
427 *
428 */
429 #define MAP_STATUS_Mapping      1	/*magenta color*/
430 #define MAP_STATUS_Mapped       2	/*red color*/
431 #define MAP_STATUS_Paused       3	/*blue color*/
432 #define MAP_STATUS_None         4	/*black color*/
433 
434 /*
435 *       the five sequencing status
436 *
437 */
438 #define SEQ_STATUS_Plan         1	/*cyan color*/
439 #define SEQ_STATUS_Sequencing   2	/*magenta color*/
440 #define SEQ_STATUS_Sequenced    3	/*red color*/
441 #define SEQ_STATUS_Paused       4	/*blue color*/
442 #define SEQ_STATUS_None         5	/*black color*/
443 
444 
445 #define ALIGN_NON_INDEX		0
446 #define ALING_MAP_INDEX		1
447 #define ALIGN_SEQ_INDEX		2
448 
449 
450 typedef struct alignnode {      /*for collecting the alignment*/
451   Uint1			index;	/*0, 1, 2 to indicate if it is a sequence/map index or
452 				  a normal alignment */
453   CharPtr		label;		/*label for the aligned sequence*/
454   Boolean		keep_label;	/* says if a function can change the 'label' field */
455   Uint1			m_frame;		/*mapped to the frame of translation in the master DNA sequence*/
456   Boolean		is_master;	/*is it a master AlignNode*/
457   GatherRange	extremes;
458   AlignSegPtr	segs;		/*individual segment in alignment*/
459   Int4			line;
460   Int4			top;		/*the top of the box*/
461   Int4			bottom;		/*the bottom of the box*/
462 
463   Int4			seqpos;			/*the position of the sequence*/
464   SeqIdPtr		sip;			/*the SeqId of the aligned sequence*/
465   Uint4			itemID;
466   Uint2			entityID;
467   Uint4			seq_entityID;		/*entity id for the sequence*/
468   Uint4			bsp_itemID;		/*itemID for the current Bioseq*/
469   Uint2			seqOrder;
470   Uint2			chain;
471   Boolean		seq_has_align;	/*is the aligned segment itself contains alignment*/
472   AlignBlockPtr blocks;
473   SeqAnnotPtr	pop_sap;		/*a list of Seq-feat propagated from Seq-align*/
474   Boolean		use_seq_ids;		/*use the seq_entityID, bsp_itemID to do the segmentation in the graphic view*/
475   Boolean		follower;	/*TRUE, it follows the
476 					  previous non-follower*/
477  Int2			num_follower;	/*number of sequences follow this node*/
478   CharPtr		clone_id;	/*id of the clones*/
479   Int4			align_num;	/*number of alignments. for recording the stop position*/
480 }AlignNode, PNTR AlignNodePtr;
481 /*********************************************************************
482 *
483 *       FreeAlignNode(list)
484 *       free a list of AlignNodePtr
485 *
486 *********************************************************************/
487 NLM_EXTERN ValNodePtr FreeAlignNode PROTO((ValNodePtr list));
488 
489 /***********************************************************************
490 *
491 *	SortAlignNode(anp_list)
492 *	sort a list of AlignNode to the ascending order of (extremes.left,
493 *	extremes.right)
494 *
495 **********************************************************************/
496 NLM_EXTERN ValNodePtr SortAlignNode PROTO((ValNodePtr anp_list));
497 
498 
499 /***************************************************************
500 *
501 *	CollAlignFromSeqAnnot(annot, m_loc, featureOrder, groupOrder,
502 *	style,graphic)
503 *
504 *	collect the AlignNode for Seq-aligns stored in Seq-annot
505 *	annot: the Seq-annot
506 *	m_loc: the target sequence
507 *	left: the offset of the leftmost position
508 *	featureOrder, groupOrde: the features selected to be displayed together
509 *	with alignment
510 *	style: the style of the display. Only valid for multiple-pairwise
511 *	and multiple dimension for now
512 *	graphic: if TRUE, it is designed to show the display on graphic,
513 *	so the mismatch data will be collected. Otherwise, it will not
514 *	collect mismatch data
515 *	sort: if TRUE, sort the alignode, else no sorting
516 *	flat_insert: if TRUE, make the insertions in MP alignment flat
517 *
518 ****************************************************************/
519 NLM_EXTERN ValNodePtr CollAlignFromSeqAnnot PROTO((SeqAnnotPtr annot, SeqLocPtr m_loc, Uint1Ptr featureOrder, Uint1Ptr groupOrder, Uint1 style, Boolean graphic, Boolean sort, Boolean flat_insert));
520 
521 
522 
523 /*#####################################################################
524 #
525 #	functions related to the collection of the features of alignment
526 #
527 #####################################################################*/
528 
529 /******************************************************************
530 *
531 *	CollectFeatureForAlignNode(slp, anp, csop)
532 *	collect feature for the alignment
533 *	slp: the target Seq-loc
534 *	anp: the AlignNode belong to the target Seq-loc
535 *	csop: the option for gathering the features
536 *
537 ******************************************************************/
538 NLM_EXTERN Boolean CollectFeatureForAlignNode PROTO((SeqLocPtr slp, AlignNodePtr anp, CollectSeqOptionPtr csop));
539 
540 /******************************************************************
541 *
542 *	CollectFeatureForAlign(slp, anp, featureOrder, groupOrder)
543 *	collect feature for the alignment
544 *	slp: the target Seq-loc
545 *	anp: the AlignNode belong to the target Seq-loc
546 *	featureOrder: the order of features
547 *	groupOrder: the order of the groups
548 *
549 ******************************************************************/
550 NLM_EXTERN Boolean CollectFeatureForAlign PROTO((SeqLocPtr slp, AlignNodePtr anp, Uint1Ptr featureOrder, Uint1Ptr groupOrder));
551 
552 
553 /******************************************************************
554 *
555 *	SortAlignmentFeature(anp_node, featureOrder, groupOrder)
556 *	sort the list of FeatNode in aligned segment (asp->cnp) to the
557 *	proper order of featureOrder and groupOrder
558 *
559 *******************************************************************/
560 NLM_EXTERN void SortAlignmentFeature PROTO((ValNodePtr anp_node, Uint1Ptr featureOrder, Uint1Ptr groupOrder));
561 
562 
563 /*******************************************************************
564 *
565 *	void CollectSegMapSTSAlign( entityID, anp_list)
566 *	look for the sts alignment from segmap stored as Seq-annot in
567 *	in entityID. Add the alignment as the mismatch marker in the
568 *	AlignSeg of the anp_list
569 *
570 *******************************************************************/
571 NLM_EXTERN void CollectSegMapSTSAlign PROTO((Uint2 entityID, ValNodePtr anp_list, SeqLocPtr m_loc, Int4 left));
572 
573 /*****************************************************************
574 *
575 *	check if the AlignNode only contains Seq-annot or it
576 *	has real sequence alignment.
577 *	the empty Seq-annot may be the unaligned contigs in
578 *	Eric Green's map
579 ******************************************************************/
580 NLM_EXTERN Boolean alignode_has_alignments PROTO((ValNodePtr aligns));
581 
582 
583 /***********************************************************************
584 *
585 *       find_insert_ypos(left, seglen, ins, l_bound, r_bound, p_pos, space
586 *       num)
587 *       find the level for placing the insertions. Used in both the layout
588 *       for text and graphic
589 *       left: to store the left-most position calculated for an insertion
590 *       seglen: length of the insertion
591 *       ins: the position for insertions
592 *       l_bound: the leftmost position in the current line
593 *       r_bound: the rightmost position in the current line
594 *       p_pos: position for storing all the layout info
595 *       num: number of elements in p_pos
596 *       return the current level found for an insertion
597 *
598 ***********************************************************************/
599 NLM_EXTERN Int2 find_insert_ypos PROTO((Int4Ptr left, Int4 seglen, Int4 ins, Int4 l_bound, Int4 r_bound, Int4Ptr p_pos, Int4 space, Int2 num));
600 
601 
602 
603 
604 /*****************************************************************
605 *
606 *	given the bioseq and its entityID, figure out the
607 *	itemID for the Bioseq
608 *
609 *****************************************************************/
610 NLM_EXTERN Uint4 get_bioseq_itemID PROTO((BioseqPtr bsp, Uint2 entityID));
611 
612 
613 NLM_EXTERN ValNodePtr clean_annot_for_anp PROTO((ValNodePtr PNTR head));
614 
615 /************************************************************************
616 *
617 *       convert_gdata_for_featnode(gdata, cyto_loc, offset)
618 *       gdata: the GeneDataPtr
619 *       cyto_loc: the current location on the cytogenetic map
620 *       offset: the offset of cyto_loc to the graphic viewer1
621 *       for human cytogenetic map, the markers are not shown. But for
622 *       the markers that were queried, it will display the interval for
623 *       gene data
624 *
625 ************************************************************************/
626 
627 NLM_EXTERN ValNodePtr convert_gdata_to_featnode PROTO((GeneDataPtr gdata, SeqLocPtr cyto_loc, Int4 offset));
628 
629 
630 #define ALIGN_NORMAL    0
631 #define ALIGN_DNA_TO_PROT       1
632 #define ALIGN_PROT_TO_DNA       2
633 #define ALIGN_TDNA_TO_TDNA	3
634 #define ALIGN_MAX_TYPE  3
635 
636 NLM_EXTERN Uint1 get_alignment_type PROTO((AnnotInfoPtr annot_info));
637 
638 /**********************************************************************
639 *
640 *	for a multiple pairwise alignment, convert the insertions
641 *	into gaps on the master sequence
642 *
643 **********************************************************************/
644 NLM_EXTERN Boolean FlatAlignNode PROTO((ValNodePtr anp_list));
645 
646 NLM_EXTERN void AddOffsetToAlignNode PROTO((AlignNodePtr anp, Int4 offset));
647 /*
648 *       Delete all the bad YACs from the list
649 *       anything on the NHGRI map that is recorded inconsistent will
650 *       be considered inconsistent. For the Whitehead map, the
651 *       inconsistent+ambiguous is inconsistent. Inconsistent alone
652 *       is not considered inconsistent
653 *	if any alignment is the same as the chromosome id (the segmap
654 *	alignment includes the id mapped back to the chromosome), it
655 *	will be cleaned as well
656 */
657 NLM_EXTERN void CleanUpAmbiguousYAC PROTO((ValNodePtr PNTR anp_node, Uint1 db, SeqIdPtr chr_id));
658 
659 /***********************************************************************
660 *
661 *	ProcessTextAlignNode(anp, left, right, p_stop, m_buf, locus)
662 *	process an AlignNode to generate a list of text buffer
663 *
664 *	anp: the AlignNode
665 *	left, right: the range of alignment in process. mapped to
666 *	anp->extremes.left, and anp->extremes.right
667 *	p_stop: the previous stop position in the sequence. It is used
668 *	to label the position of line which is a gap
669 *	m_buf: the buffer of the master sequence. Can be used to compare
670 *	mismatches
671 *	locus: if TRUE, use the locus name for sequence
672 *
673 *
674 *
675 ************************************************************************/
676 NLM_EXTERN ValNodePtr ProcessTextAlignNode PROTO((
677                     AlignNodePtr anp, Int4 m_left,
678                     Int4 m_right, Int4Ptr p_stop,
679                     CharPtr m_buf, Int4 line_len,
680                     Int1 m_frame,
681                     Uint4 option, Int4Ptr PNTR matrix
682                     ));
683 NLM_EXTERN ValNodePtr ProcessTextAlignNode2 PROTO((
684                     AlignNodePtr anp, Int4 m_left,
685                     Int4 m_right, Int4Ptr p_stop,
686                     CharPtr m_buf, Int4 line_len,
687                     Int1 m_frame,
688                     Uint4 option, Int4Ptr PNTR matrix,
689                     Int4Ptr PNTR posMatrix, Int4 q_start
690                     ));
691 
692 NLM_EXTERN ValNodePtr FreeTextAlignList PROTO((ValNodePtr tdp_list));
693 
694 NLM_EXTERN SeqIdPtr LIBCALL GetUseThisGi PROTO((SeqAlignPtr seqalign));
695 NLM_EXTERN SeqIdPtr LIBCALL ScorePtrUseThisGi PROTO((ScorePtr sp));
696 
697 
698 /* setting up the matrix for the positive residue of the alignment */
699 
700 NLM_EXTERN Int4Ptr PNTR load_default_matrix PROTO((void));
701 NLM_EXTERN void free_default_matrix PROTO((Int4Ptr PNTR matrix));
702 
703 #ifdef __cplusplus
704 }
705 #endif
706 
707 #undef NLM_EXTERN
708 #ifdef NLM_EXPORT
709 #define NLM_EXTERN NLM_EXPORT
710 #else
711 #define NLM_EXTERN
712 #endif
713 
714 #endif
715 
716 
717 
718 
719