NCBI C Toolkit Cross Reference

C/desktop/asn2graphicp.h


  1 /*   asn2graphicp.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:  asn2graphicp.h
 27 *
 28 * Author:  Eric Northup
 29 *
 30 * Version Creation Date:   11/8/01
 31 *
 32 * $Revision: 6.40 $
 33 *
 34 * File Description: 
 35 *
 36 * Modifications:  
 37 * --------------------------------------------------------------------------
 38 *
 39 * ==========================================================================
 40 */
 41 
 42 #ifndef _ASN2GRAPHICP_
 43 #define _ASN2GRAPHICP_
 44 
 45 #include <asn2graphic.h>
 46 #include <objfdef.h>
 47 
 48 #undef NLM_EXTERN
 49 #ifdef NLM_IMPORT
 50 #define NLM_EXTERN NLM_IMPORT
 51 #else
 52 #define NLM_EXTERN extern
 53 #endif
 54 
 55 
 56 #ifdef __cplusplus
 57 extern "C" {
 58 #endif
 59 
 60 #define APPEARANCEITEM_Segment (FEATDEF_MAX + 1)
 61 #define APPEARANCEITEM_Alignment (FEATDEF_MAX + 2)
 62 #define APPEARANCEITEM_Graph (FEATDEF_MAX + 3)
 63 #define APPEARANCEITEM_MAX (FEATDEF_MAX + 4)
 64 
 65 typedef enum {
 66   Layout_Inherit = 0,           /* inherit layout from higher-level entity */
 67   Layout_Diagonal,
 68   /* Layout_DiagonalSawtooth, */
 69   Layout_FeatTypePerLine,
 70   Layout_FeatTypePerLineGroup,
 71   /*  Layout_AllInOneLine, */
 72   Layout_PackUpward,
 73   Layout_GroupCorrespondingFeats,
 74   Layout_GroupCorrespondingFeatsRepeat
 75 } LayoutAlgorithm;
 76 
 77 typedef enum {
 78   Do_Not_Render = 0,
 79   Render_Line,
 80   Render_CappedLine,            /* |---------| */
 81   Render_Box,
 82   Render_OutlineBox
 83 } RenderAlgorithm;
 84 
 85 typedef enum {
 86   LabelUnset = 0,
 87   LabelNone,
 88   LabelAboveClip, /* above, but not wider than the feature*/
 89   LabelAboveCull, /* above, but only displayed iff wider than the feature */
 90   LabelInside,
 91   LabelAbove,
 92   LabelBelow,
 93   LabelLeft,
 94   LabelRight
 95 } LabelLocEnum;
 96 
 97 typedef enum {
 98   NoGap = 0,
 99   LineGap,
100   AngleGap
101 } GapEnum;
102 
103 typedef struct appearanceItem {
104   Uint1           LabelColor [3];
105   Uint1           Color [3];
106   RenderAlgorithm RenderChoice;
107   Int1            VibLinestyle;         /* these are as in AddAttribute */
108   Uint1           Height;
109   Int1            VibShading;
110   Boolean         ShowArrow;
111   GapEnum         GapChoice;
112   Boolean         AddDescToLabel;
113   Boolean         AddTypeToLabel;
114   FonT            LabelFont;
115   LabelLocEnum    LabelLoc;
116   Uint1           format;         /* label format, currently only valid for alignments. */
117 } AppearanceItem, PNTR AppearanceItemPtr;
118   
119 typedef enum {
120   NoLabel = 0,
121   LabelOnTop,
122   LabelOnBottom,
123   LabelOnSide
124 } GroupLabelLocation;
125 
126 typedef struct bioseqAppearanceItem {
127   Boolean            drawScale;
128   Uint1              bioseqColor [3];
129   Uint1              labelColor [3];
130   Uint1              scaleColor [3];
131   FonT               labelFont;
132   FonT               scaleFont;
133   GroupLabelLocation labelLoc;
134   Uint1              height;
135   Uint1              scaleHeight;
136   Uint1              format;
137 } BioseqAppearanceItem, PNTR BioseqAppearanceItemPtr;
138 
139 typedef struct appearance {
140   ValNodePtr               AppearanceItemList;   /* data.ptrvalue == AppearanceItemPtr */
141   CharPtr                  name;
142   AppearanceItemPtr        FeaturesAppearanceItem [APPEARANCEITEM_MAX];
143   BioseqAppearanceItemPtr  bioseqAIP;
144   Boolean                  ShadeSmears; /* if FALSE, multi-feature smears (which can't be selected/edited like normal features) will be hollow instead of filled */
145   Uint2                    MaxScaleForArrow;
146   Uint2                    MinPixelsForArrow;
147   Uint1                    GroupLabelColor [3];
148   FonT                     GroupLabelFont;  
149   Uint1                    GroupBoxColor [3];
150   Uint1                    AnnotLabelColor [3];
151   FonT                     AnnotLabelFont;  
152   Uint1                    AnnotBoxColor [3];
153  
154 } Appearance, PNTR AppearancePtr;
155 
156 typedef enum {
157   InvalidFilter = 0,
158   BioseqFilter,
159   FeatureFilter,
160   GraphFilter,
161   AlignmentFilter
162 } FilterType;
163 
164 typedef enum {
165   InvalidStrand = 0,
166   MinusStrand,
167   PlusStrand,
168   BothStrands
169 } StrandChoice;
170 
171 typedef enum {
172   TristateUnset = 0,
173   TristateTrue,
174   TristateFalse
175 } Tristate;
176 
177 #define BOOL_TO_TRISTATE(aBool)   ((aBool) ? (TristateTrue) : (TristateFalse))
178   /* bool_from_SET_tristate means that the tristate has already been checked, and was not "TristateUnset" */
179 #define BOOL_FROM_SET_TRISTATE(aTri) ((aTri == TristateTrue) ? (TRUE) : (FALSE))
180 
181 
182 /* IncludeFeature[featdef_xxx] is either 0 (not included) or a number which indictes its order in this filter (1 = first, ..., APPEARANCEITEM_MAX = last) */
183 typedef struct filterItem {
184   FilterType         Type;
185   CharPtr            GroupLabel;
186   Uint1              GroupLabelColor [3];
187   Boolean            GroupLabelColorSet;
188   FonT               GroupLabelFont;  
189   Boolean            GroupLabelFontSet;
190   Uint1              GroupBoxColor [3];
191   Boolean            GroupBoxColorSet;
192   Uint1              IncludeFeature [APPEARANCEITEM_MAX];
193   Uint2              IntraRowPaddingPixels;       /* number of blank (pixel) rows after _each_ row in this group*/
194   Uint2              GroupPadding;               /* number of blank (pixel) rows after this group */
195   LayoutAlgorithm    LayoutChoice;
196   GroupLabelLocation GroupLabelLoc;
197   Boolean            DrawGroupBox;
198   Boolean            FillGroupBox;
199   StrandChoice       MatchStrand;
200   Tristate           AddDescToLabel;
201   Tristate           AddTypeToLabel;
202   LabelLocEnum       LabelLoc;
203   Tristate           DrawScale;
204 } FilterItem, PNTR FilterItemPtr;
205 
206 typedef struct filter {
207   ValNodePtr      FilterItemList;       /* data.ptrvalue == FilterItemPtr */
208   CharPtr         name;
209   Uint2           MaxScaleWithLabels;    /* turn off all labels if scale > MaxScaleWithLabels*/
210   Boolean             GroupByAnnot;         /* features or alignments in named annotations group separately? */
211   Boolean             DrawAnnotBox;         /* draw a box around such features. */
212   GroupLabelLocation  AnnotLabelLoc;
213   Uint1               AnnotBoxColor[3];
214   Boolean             AnnotBoxColorSet;
215   FonT                AnnotLabelFont;  
216   Boolean             AnnotLabelFontSet;
217   Uint1               AnnotLabelColor [3];
218   Boolean             AnnotLabelColorSet;
219   
220 } Filter, PNTR FilterPtr;
221 
222 typedef enum endPointType {
223   EndAbsolute = 0,
224   EndPartial,
225   EndClipped
226 } EndPointType;  
227 
228 typedef struct relevantFeatureItem {
229   Int4            Left, Right;
230   Uint1           featstrand;
231   EndPointType    LeftEnd;
232   EndPointType    RightEnd;
233   CharPtr         ContentLabel;
234   Uint1           featdeftype;
235   Int4Ptr         ivals;
236   Int2            numivals;
237   Uint2           entityID, itemType;
238   Uint4           itemID;
239   Uint1           circularSpanningOrigin;   /* on a bioseq w/ Circular topology, this feature crosses the origin */
240   SeqAnnotPtr     sap; /* was this feature found in a named SeqAnnot table?  0 if not, else a pointer to the SeqAnnot */
241 } RelevantFeatureItem, PNTR RelevantFeatureItemPtr;
242 
243 typedef struct relevantFeatures {
244   Uint4            featureCount;
245   ValNodePtr       featVNP;             /* data.ptrvalue == RelevantFeatureItem [RELEVANT_FEATS_PER_CHUNK] */
246   Uint1            sapCount;
247   SeqAnnotPtr PNTR sapList;
248 } RelevantFeatures, PNTR RelevantFeaturesPtr;
249 
250 typedef struct viewerConfigs {
251   Boolean            ArraysPopulated;
252 
253   Uint1              AppearanceCount;
254   AppearancePtr PNTR AppearanceArray;
255   CharPtr PNTR       AppearanceNameArray;
256 
257   Uint1              FilterCount;
258   FilterPtr PNTR     FilterArray;
259   CharPtr PNTR       FilterNameArray;
260 
261   /* the linked-lists are only used while this structure is being built. */
262 
263   ValNodePtr         AppearanceList;       /* data.ptrvalue == CharPtr */
264   ValNodePtr         AppearanceNameList;
265   ValNodePtr         FilterList; 
266   ValNodePtr         FilterNameList;
267   Uint2              DefaultMaxScaleWithLabels;
268   Uint2              DefaultMaxScaleForArrow;
269   Uint2              DefaultMinPixelsForArrow;
270   Uint2              DefaultGroupPadding;
271   Uint2              DefaultRowPadding;
272   Boolean            DefaultShadeSmears;  
273 } ViewerConfigs, PNTR ViewerConfigsPtr;
274 
275 /* Public Functions */
276 
277 NLM_EXTERN SegmenT CreateGraphicViewFromBsp (
278   BioseqPtr bsp,
279   SeqLocPtr location,
280   Int4 scale,
281   Int4Ptr ceiling,
282   SegmenT topLevel,
283   AppearancePtr AP,
284   FilterPtr FP,
285   LayoutAlgorithm overrideLayout,
286   GraphicViewExtrasPtr extras
287 );
288 
289 /* If the same Bioseq will be rendered multiple times, it will be more efficient to use these functions */
290 
291 NLM_EXTERN SegmenT CreateGraphicViewInternal (
292   BioseqPtr bsp,
293   Int4 from,
294   Int4 to,
295   Boolean allFeatures,
296   RelevantFeaturesPtr feats,
297   Int4 scale,
298   Int4Ptr ceiling,
299   SegmenT topLevel,
300   AppearancePtr AP,
301   FilterPtr FP,
302   LayoutAlgorithm overrideLayout,
303   GraphicViewExtrasPtr extras
304 );
305 
306 NLM_EXTERN RelevantFeaturesPtr CollectFeatures (BioseqPtr bsp);
307 NLM_EXTERN RelevantFeaturesPtr FreeCollectedFeatures (RelevantFeaturesPtr RFP);
308 
309 /* GetGraphicConfigParseResults() parses the configuration file the 1st time it is called, but returns a cached copy afterward */
310 NLM_EXTERN ViewerConfigsPtr GetGraphicConfigParseResults (void);
311 NLM_EXTERN FilterPtr FindFilterByName (CharPtr name, ViewerConfigsPtr VCP);
312 NLM_EXTERN AppearancePtr FindAppearanceByName (CharPtr name, ViewerConfigsPtr VCP);
313 NLM_EXTERN LayoutAlgorithm FindLayoutByName (CharPtr name);
314 
315 /* Functions for Manipulating Filter and Appearance Structures */
316 NLM_EXTERN Uint2 ParseConfigFile (ViewerConfigsPtr VCP);
317 NLM_EXTERN FilterPtr CreateFilter (CharPtr name, ViewerConfigsPtr VCP);
318 NLM_EXTERN AppearancePtr CreateAppearance (CharPtr newname, ViewerConfigsPtr VCP);
319 NLM_EXTERN void AddFeatureToFilterItem (FilterItemPtr FIP, Uint1 newFeatdef, ViewerConfigsPtr VCP);
320 NLM_EXTERN void RemoveFeatureFromFilterItem (FilterItemPtr FIP, Uint1 newFeatdef, ViewerConfigsPtr VCP);
321 NLM_EXTERN FilterItemPtr CreateNewFilterItemInFilter (CharPtr name, FilterPtr parent, ViewerConfigsPtr VCP);
322 NLM_EXTERN FilterPtr DestroyFilter (FilterPtr FP, ViewerConfigsPtr VCP);
323 NLM_EXTERN AppearancePtr DestroyAppearance (AppearancePtr AP, ViewerConfigsPtr VCP);
324 NLM_EXTERN void AddAppearanceItemToAppearance (AppearanceItemPtr AIP, AppearancePtr AP, Uint1 newFeatdef, ViewerConfigsPtr VCP);
325 NLM_EXTERN Uint2 GetAppearanceCount (void);
326 NLM_EXTERN Uint2 GetFilterCount (void);
327 NLM_EXTERN Uint2 GetLayoutCount (void);
328 NLM_EXTERN Uint2 GetAlnScoreCount (void);
329 NLM_EXTERN Uint2 GetAlnScoreCutoffCount (void);
330 
331 
332 #ifdef __cplusplus
333 }
334 #endif
335 
336 #undef NLM_EXTERN
337 #ifdef NLM_EXPORT
338 #define NLM_EXTERN NLM_EXPORT
339 #else
340 #define NLM_EXTERN
341 #endif
342 
343 #endif /* _ASN2GRAPHICP_ */
344 

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.