NCBI C Toolkit Cross Reference

C/api/blocks.h


  1 /*   $Id: blocks.h,v 6.3 2006/07/13 17:06:38 bollin Exp $
  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:  blocks.h
 27 *
 28 * Author:  Sarah Wheelan
 29 *
 30 * Version Creation Date:   
 31 *
 32 * $Revision: 6.3 $
 33 *
 34 * File Description: Creating an editable version of a seqalign
 35 *
 36 * Modifications:
 37 * --------------------------------------------------------------------------
 38 * $Log: blocks.h,v $
 39 * Revision 6.3  2006/07/13 17:06:38  bollin
 40 * use Uint4 instead of Uint2 for itemID values
 41 * removed unused variables
 42 * resolved compiler warnings
 43 *
 44 * Revision 6.2  1999/11/26 15:42:24  vakatov
 45 * Fixed for the C++ and/or MSVC DLL compilation
 46 *
 47 * Revision 6.1  1999/07/06 19:49:14  kans
 48 * initial public checkin
 49 *
 50 * Revision 1.19  1999/07/01 20:58:34  wheelan
 51 * added include salpedit.h, added FlipSequence, CalcMinusBounds, PropagateStrandInfo, and Patrick Durand`s SABlock printing function
 52 *
 53 * Revision 1.18  1999/06/25 20:56:39  wheelan
 54 * took out unnecessary includes
 55 *
 56 * Revision 1.17  1999/06/24 20:44:45  wheelan
 57 * added IndexNewBlocks to correctly index SABlocks made from DenseDiags
 58 *
 59 * Revision 1.16  1999/06/21 12:07:28  wheelan
 60 * added SeqAlignListMergeAll function
 61 *
 62 * Revision 1.15  1999/06/11 17:02:54  wheelan
 63 * Added DeBlockify and GetSeqIdList functions
 64 *
 65 * Revision 1.13  1999/06/07 20:59:30  lewisg
 66 * fix typo in traverser fcn typedefs
 67 *
 68 * Revision 1.12  1999/05/29 00:09:15  lewisg
 69 * new editing functions
 70 *
 71 * Revision 1.11  1999/05/24 23:10:50  lewisg
 72 * more initialization for AddEmptyBlocks
 73 *
 74 * Revision 1.9  1999/05/24 15:33:20  lewisg
 75 * make Segment.gap hold gap count
 76 *
 77 * Revision 1.8  1999/05/21 14:53:59  lewisg
 78 * added functions, removed ssp
 79 *
 80 *
 81 * ==========================================================================
 82 */
 83 
 84 
 85 #ifndef _NCBI_DDV_BLOCKS_
 86 #define _NCBI_DDV_BLOCKS_
 87 
 88 #include <ncbi.h>
 89 #include <salsap.h>
 90 #include <salutil.h>
 91 #include <objseq.h>
 92 #include <salpedit.h>
 93 
 94 #undef NLM_EXTERN
 95 #ifdef NLM_IMPORT
 96 #define NLM_EXTERN NLM_IMPORT
 97 #else
 98 #define NLM_EXTERN extern
 99 #endif
100 
101 #ifdef __cplusplus
102 extern "C" {
103 #endif
104 
105 
106 /*
107   Gapless segment for the Display SeqAlign
108  */
109 typedef struct _segment {
110     Int4       from;
111     Int4       to;
112     Int4       gap;
113     /* lyg: we should delete sip.  this is kept elsewhere */
114     SeqIdPtr   sip;
115     /* lyg: deleted pointer to standard seg */
116     Int4       BspID;
117     struct _segment* next;
118     struct _segment* prev;
119     struct _segment* bsp_next;
120     struct _segment* bsp_prev;
121     Uint1      strand;
122     /* lyg: visible should be deleted also */
123     Uint1      visible;
124     Boolean    link;
125     Boolean    move;   /* lyg: does this Segment have a pending edit? */
126 } Segment, PNTR SegmentPtr;
127 
128 /*
129   Head of Linked List for Each Segment
130   */
131 typedef struct _seqalignblock {
132     Int4        from;
133     Int4        to;
134     SegmentPtr  segp_head;
135     Int4        SegID;
136     Int4        AlignID;
137     Int4        RegionID;
138     struct _seqalignblock* next;
139     struct _seqalignblock* prev;
140     Boolean     aligned;  /* lyg: indicates that the column is aligned */
141     /* lyg: visible and highlighted should be kept elsewhere */
142     Uint1       visible;
143     Boolean     highlighted;
144 } SABlock, PNTR SABlockPtr;
145 
146 /*
147   Anciliary Information for each "row" Bioseq : Not Part of SeqAlign 
148  */
149 typedef struct _ddv_seginfo {
150     Int4 BspID;
151     SeqPortPtr spp;
152     SeqIdPtr sip;
153     BioseqPtr bsp;              /* Optional, Only if locked */
154     struct _ddv_segInfo * next;
155     Uint2 entityID;
156     Uint4 itemID;
157 } DDV_SegInfo, * DDV_SegInfoPtr;
158 
159 /* Transform an N-dim Multiple SeqAlign into the Block SeqAlign (dsp only) */
160 NLM_EXTERN SABlockPtr Blockify(SeqAlignPtr sap);
161 
162 NLM_EXTERN SABlockPtr IndexBlocks(SABlockPtr sabp);
163 NLM_EXTERN SABlockPtr IndexNewBlocks(SABlockPtr sabp);
164 NLM_EXTERN void GetBlockInfo(SABlockPtr sabp, Int4Ptr length, Int4Ptr numbioseqs, Int4Ptr numblocks, Int4Ptr validate);
165 NLM_EXTERN void CleanupBlocks(SABlockPtr sabp);
166 NLM_EXTERN SABlockPtr SAMergeBlocks(SABlockPtr sabp1, SABlockPtr sabp2);
167 NLM_EXTERN Int4 GetBlockOrientation(Int4Ptr shift, SegmentPtr segp1, SegmentPtr segp2, Int4 index1, Int4 index2);
168 NLM_EXTERN SABlockPtr SquishBlocks(SABlockPtr sabp);
169 NLM_EXTERN SABlockPtr SARemoveSequence(Int4 BspID, SeqIdPtr sip, SABlockPtr sabp);
170 NLM_EXTERN SABlockPtr RearrangeSegments(Int4 BspID, SABlockPtr sabp, Int4 position);
171 NLM_EXTERN SABlockPtr TeenyBlock(SABlockPtr sabp, Int4 from, Int4 to);
172 NLM_EXTERN SABlockPtr SASplitBlock(SABlockPtr sabp, Int4 from);
173 NLM_EXTERN SABlockPtr AddEmptyBlocks(SABlockPtr sabp, Int4 n, Boolean beginning, Boolean end);
174 NLM_EXTERN SABlockPtr AddEmptySegments(SABlockPtr sabp);
175 NLM_EXTERN SABlockPtr FillInUnaligned(SABlockPtr sabp);
176 NLM_EXTERN SeqAlignPtr DeBlockify(SABlockPtr sabp);
177 NLM_EXTERN SeqIdPtr GetSeqIdList(SABlockPtr sabp);
178 NLM_EXTERN SeqAlignPtr SeqAlignListMergeAll(SeqAnnotPtr sap);
179 NLM_EXTERN SegmentPtr PropagateStrandInfo(SegmentPtr segp);
180 
181 
182 /*******************************************************************************
183 
184   Function : blk_PrintSABP()
185   
186   Purpose : display an indexed seqalign as a matrix (debug purpose only)
187   
188   Parameters :  sabp;header of the indexed seqalign
189                                 
190   Return value : -
191 
192 *******************************************************************************/
193 NLM_EXTERN void blk_PrintSABP(SABlockPtr sabp);
194 
195 /*****************************************************************************
196 *
197 *   Notes on changes by lyg:
198 *   - removed ssp in Segment
199 *   - initialized RegionID in Blockify
200 *   - added SAReturnBlock() and SAReturnSegment()
201 *   - added traversal routine
202 *   - set SABlock.gap equal to the length of the gap
203 *   - preserve RegionID in AddEmptyBlocks(), initialize more members
204 *
205 *****************************************************************************/
206 
207 
208 /*****************************************************************************
209 *
210 *   For a given column, return a pointer to the block that contains the
211 *   position.  Returns NULL if a containing block is not found. 
212 *
213 *****************************************************************************/
214 
215 NLM_EXTERN SABlock * SAReturnBlock(SABlock *sabpHead, Int4 lColumn);
216 
217 /*****************************************************************************
218 *
219 *   For a given position, return a pointer to the Segment that contains the
220 *   position.  Returns NULL if a containing Segment is not found. Note that
221 *   the lRow argument is position, not BspID.
222 *
223 *****************************************************************************/
224 
225 NLM_EXTERN Segment * SAReturnSegment(SABlock *sabpHead, Int4 lColumn, Int4 lRow);
226 
227 /*****************************************************************************
228 *
229 *   Generic Segment traversal function with callback
230 *
231 *****************************************************************************/
232 
233 typedef void (*pfnSAFunction)(Segment *pSegment, void *pData);
234 
235 NLM_EXTERN Int4 SATraverse(SABlock *sabpHead, pfnSAFunction pFunction, void *pData);
236 
237 /*****************************************************************************
238 *
239 *   Traverser to clear the move bit
240 *
241 *****************************************************************************/
242 
243 NLM_EXTERN void SAClearMove(Segment *pSegment, void *pData);
244 
245 /*****************************************************************************
246 *
247 *   Generic SABlock traversal function with callback
248 *
249 *****************************************************************************/
250 
251 typedef void (*pfnSABlockFunction)(SABlock *sabp, void *pData);
252 
253 NLM_EXTERN Int4 SATraverseBlock
254 (SABlock *sabpHead, pfnSABlockFunction pFunction, void *pData);
255 
256 /*****************************************************************************
257 *
258 *   Traverser to find the highest valued RegionID
259 *
260 *****************************************************************************/
261 
262 NLM_EXTERN void SARegionBounds(SABlock *sabp, void *pData);
263 
264 
265 #ifdef __cplusplus
266 }
267 #endif
268 
269 #undef NLM_EXTERN
270 #ifdef NLM_EXPORT
271 #define NLM_EXTERN NLM_EXPORT
272 #else
273 #define NLM_EXTERN
274 #endif
275 
276 #endif
277 
278 

source navigation ]   [ diff markup ]   [ identifier search ]   [ freetext search ]   [ file search ]  

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.