1 /* udvseq.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: udvseq.h 27 * 28 * Author: Patrick Durand 29 * 30 * Version Creation Date: 5/3/99 31 * 32 * $Revision: 6.21 $ 33 * 34 * File Description: 35 * 36 * Modifications: 37 * -------------------------------------------------------------------------- 38 * $Log: udvseq.h,v $ 39 * Revision 6.21 2006/07/13 17:06:39 bollin 40 * use Uint4 instead of Uint2 for itemID values 41 * removed unused variables 42 * resolved compiler warnings 43 * 44 * Revision 6.20 2000/07/08 20:43:55 vakatov 45 * Get all "#include" out of the 'extern "C" { }' scope; other cleanup... 46 * 47 * Revision 6.19 2000/04/13 13:57:33 durand 48 * allowed udv to display reverse complement sequence 49 * 50 * Revision 6.18 2000/02/17 15:54:36 durand 51 * use ~ for an unaligned gap and - for an aligned gap 52 * 53 * Revision 6.17 2000/02/03 15:55:14 hurwitz 54 * added constructor and destructor for MsaTxtDisp 55 * 56 * Revision 6.16 2000/01/24 19:37:18 durand 57 * add field szEditSeq in ParaG 58 * 59 * Revision 6.15 1999/12/02 13:47:32 durand 60 * add new function for Entrez sequence viewer 61 * 62 * Revision 6.14 1999/11/03 13:46:15 durand 63 * add UDV_GetStrandinPGP, UDV_GetStrandinPGPList and UDV_GetBspRangeinPGPList for DDV 64 * 65 * Revision 6.13 1999/10/29 14:14:53 durand 66 * add text styles for DDV 67 * 68 * Revision 6.12 1999/10/20 13:13:54 durand 69 * add new fields in data structure for DDV 70 * 71 * Revision 6.11 1999/10/04 19:52:56 durand 72 * add new text MSA_TXT_STYLE_2 73 * 74 * Revision 6.9 1999/09/16 18:51:53 durand 75 * move MsaTxtDisp struct from pgppop.h to udvseq.h 76 * 77 * Revision 6.8 1999/09/07 19:39:18 durand 78 * don't display special features 79 * 80 * Revision 6.7 1999/07/30 20:08:28 durand 81 * updates for the new Entrez graphical viewer 82 * 83 * Revision 6.6 1999/06/08 21:21:16 durand 84 * update ParaG structure 85 * 86 * Revision 6.5 1999/06/08 17:02:54 durand 87 * add bspGeneticCode to bspinfo data structure 88 * 89 * Revision 6.4 1999/06/07 15:10:18 durand 90 * add LOG line to keep track of the history 91 * 92 * 93 * 94 * ========================================================================== 95 */ 96 97 #ifndef _UDVSEQ_ 98 #define _UDVSEQ_ 99 100 #include <explore.h> 101 #include <ncbi.h> 102 #include <objfdef.h> 103 #include <objloc.h> 104 #include <objseq.h> 105 #include <seqport.h> 106 #include <sequtil.h> 107 108 #ifdef __cplusplus 109 extern "C" { 110 #endif 111 112 /******************************************************************************* 113 114 The major element of this module is: paragraph (or ParaG) 115 116 This module is Vibrant free and can be used by non-vibrant software. 117 118 *******************************************************************************/ 119 120 /***************************************************************************** 121 122 Structure of a ParaG 123 124 10 20 30 Line 0 125 . | . | . | Line 1 126 1 GFDEDJSHHF DHGCJFDHCGNJFGJDHFGJ Line 3 127 |===>......===>.....===>| Line 4 128 /\/\/\/\ >------< ^ Line n 129 130 Line 0: numerical scale 131 Line 1: ticks (minor: . ; major: |) 132 Line 3: left scale (if needed) + the sequence 133 Line 4: features 134 Line n: features 135 *****************************************************************************/ 136 137 138 /******************************************************************************* 139 140 DEFINES 141 142 *******************************************************************************/ 143 144 /*Error value; if Feature Index failed*/ 145 #define INDEX_CREATION_ERROR FALSE 146 147 /***************************************************************************** 148 text styles 149 *****************************************************************************/ 150 #define MSA_TXT_STYLE_SEQ 1 /*sequence type */ 151 #define MSA_TXT_STYLE_GAP 2 /*gap type */ 152 #define MSA_TXT_STYLE_NONE 3 /*nothing */ 153 #define MSA_TXT_STYLE_1 4 /*style 1 = 5 "space" char. */ 154 #define MSA_TXT_STYLE_REG_ALIGN 5 /*aligned region */ 155 #define MSA_TXT_STYLE_REG_UNALIGN 6 /*unaligned region */ 156 #define MSA_TXT_STYLE_2 7 /*for a disc. ali, display unaligned seq.*/ 157 #define MSA_TXT_STYLE_UAGAP 8 /*gap type, unaligned regions */ 158 159 #define SPACER_TXT_BLANK 5 /*use with MSA_TXT_STYLE_1*/ 160 161 /*text justification for UnAligned region; used only by DDV */ 162 #define DISP_JUST_LEFT ((Uint1)1) 163 #define DISP_JUST_RIGHT ((Uint1)2) 164 #define DISP_JUST_CENTER ((Uint1)3) 165 #define DISP_JUST_SPLIT ((Uint1)4) 166 167 /******************************************************************************* 168 169 STRUCTURES 170 171 *******************************************************************************/ 172 173 /***************************************************************************** 174 text to display in a MSA_ParaG; line descriptor 175 *****************************************************************************/ 176 typedef struct msatxtdisp { 177 Int4 from; /*bioseq coord - zero-based */ 178 Int4 to; /*or used to compute if gap size */ 179 Int4 SegID; /*identifiers of the Indexed SeqAlign*/ 180 Int4 BspID; 181 Boolean IsGap; /*display a gap */ 182 Boolean IsUnAligned;/*unaligned region */ 183 Uint1 TextStyle; /*seqence/gap_text/gap/... */ 184 Uint1 strand; /*plus, minus, etc.*/ 185 } MsaTxtDisp, PNTR MsaTxtDispPtr; 186 187 typedef struct parag {/*Paragraph information*/ 188 Int4 NumOrder; 189 /*ParaG graphical values*/ 190 Int4 StartLine; /*this ParaG starts at this line*/ 191 Int4 nLines; /*and contains nLines (scale+seq+feat)*/ 192 Int4 StartLetter; /*first letter of the bioseq to show*/ 193 Int4 StopLetter; /*last letter of the bioseq to show*/ 194 ValNodePtr pFeatList; /*list of itemID,index (Feature Index 195 values)*/ 196 ValNodePtr ptxtList;/*text to draw - MSA*/ 197 SeqIdPtr sip;/*identification of the bioseq - MSA*/ 198 Char *szEditSeq; /*used by DDV only for editi*/ 199 Int4 OccupyTo; /*used to populate features; vertical disp*/ 200 Int2 MinLine; /*used to populate features;horz display*/ 201 Int2 nFeatLines; /*number of lines with features*/ 202 Int2 nFeat; /*number of features*/ 203 Int2 nTrans; /*number of translation*/ 204 205 Uint1 ScaleStyle;/*scale type (top/left/...)-MSA*/ 206 } ParaG, PNTR ParaGPtr; 207 208 /*structure used to initialize ParaG with features*/ 209 typedef struct paragfeaturesinloc{ 210 ValNodePtr ParaG_head; 211 ValNodePtr ParaG_next_head; 212 ValNodePtr ParaG_last_head; 213 Int4 OccupyTo[500]; 214 Int4 nTotLines_new; 215 /*Int2 rcP_top;*/ 216 Int4 nFeat; 217 Int2 LineH; 218 Boolean ShowFeatures; 219 Uint1 DispType; 220 Int4 cumOffset; 221 Int4 bsp_part_length; 222 } ParaGFeaturesInLoc,PNTR ParaGFeaturesInLocPtr; 223 224 typedef struct bspinfo { 225 /*general data*/ 226 Uint2 bsp_entityID; 227 Uint4 bsp_itemID; 228 Uint2 bsp_itemType; 229 BioseqPtr bsp; /* set to NULL if uninitialized */ 230 Char bspName[41]; 231 Char bspAccNum[21]; 232 Char bspRepr[21]; 233 Char bspMol[21]; 234 Boolean bspMolNuc; 235 Char bspTopo[21]; 236 Char bspStrand[21]; 237 Char bspDataType[21]; 238 CharPtr bspGeneticCode;/* set to NULL if uninitialized */ 239 Int4 bspLength; 240 SeqPortPtr spp; /* set to NULL if uninitialized */ 241 SeqIdPtr sip; /* set to NULL if uninitialized */ 242 243 /*SAM specific data*/ 244 Int4 BspID; 245 246 /*Sequence Buffer*/ 247 Int4 StartBuf; /*buffer start here in the sequence*/ 248 Int4 StopBuf; /*buffer stop here... (0 based values)*/ 249 Int2 LengthBuf; /*buffer size*/ 250 CharPtr SeqBuf; /*buffer sequence*/ 251 ValNodePtr PgpStartBuf;/*Pgp where start buffer is located*/ 252 253 struct bspinfo *next; 254 }BspInfo, PNTR BspInfoPtr; 255 256 /******************************************************************************* 257 258 FUNCTIONS DECLARATION 259 (see .c module for a complete description) 260 261 *******************************************************************************/ 262 263 NLM_EXTERN MsaTxtDispPtr UDV_MsaTxtDispNew(MsaTxtDispPtr pTxtDisp); 264 NLM_EXTERN MsaTxtDispPtr UDV_MsaTxtDispFree(MsaTxtDispPtr pTxtDisp); 265 /*BSP information*/ 266 NLM_EXTERN void UDV_ReadBspDataForViewer(BspInfoPtr bsp_i); 267 /*Feature management*/ 268 NLM_EXTERN void UDV_DecodeIdxFeat (Uint4 index_g, Uint2Ptr val1, 269 Uint4Ptr val2); 270 NLM_EXTERN void UDV_BigDecodeIdxFeat (Uint8 index_g, Uint4Ptr val1, Uint2Ptr val2, 271 Uint2Ptr val3, Uint2Ptr val4); 272 NLM_EXTERN Uint4 UDV_EncodeIdxFeat (Uint2 val1,Uint2 val2); 273 NLM_EXTERN Uint8 UDV_BigEncodeIdxFeat (Uint2 val1,Uint2 val2,Uint2 val3,Uint2 val4); 274 NLM_EXTERN SeqMgrFeatContextPtr UDV_ConvertFeatContext( 275 SeqMgrFeatContextPtr context,Int4 cumOffset,Int4 bsp_part_length); 276 NLM_EXTERN Boolean UDV_IsTranslationNeeded(SeqMgrFeatContextPtr context, 277 ParaGPtr pgp); 278 NLM_EXTERN Boolean LIBCALLBACK UDV_ParaGFTableFeatures (SeqFeatPtr sfp, 279 SeqMgrFeatContextPtr context); 280 NLM_EXTERN Uint2 UDV_CreateOneFeatureIndex(Uint2 entityID_seq, 281 BioseqPtr bsp,Boolean bReverse); 282 NLM_EXTERN void UDV_FreeListParaG(ValNodePtr PNTR vnp_head); 283 NLM_EXTERN ValNodePtr UDV_CreateParaGList(Int2 nCharByLine, 284 Int4 bsp_length,Int4 from,Int4 to, 285 Boolean ShowTop,Boolean ShowTick,Boolean ShowSequence, 286 Boolean ShowBlank,Int4Ptr nTotL,ValNodePtr ParaG_head); 287 NLM_EXTERN Boolean UDV_PopulateParaGFeatures(BioseqPtr bsp, 288 ValNodePtr ParaG_vnp,Boolean ShowFeatures,Int4Ptr nTotL, 289 Uint4 DispType,Int2Ptr nFeatFound); 290 NLM_EXTERN Boolean UDV_PopParaGFeaturesEx(BioseqPtr bsp,ValNodePtr ParaG_vnp, 291 Boolean ShowFeatures,Int4Ptr nTotL,Uint4 DispType,Int2Ptr nFeatFound, 292 BoolPtr FeatDefTable,Int4 from_bsp,Int4 to_bsp); 293 /*Sequence reader*/ 294 NLM_EXTERN CharPtr UDV_Read_SequenceEx (SeqIdPtr sip, Int4 from, Int4 to, 295 Boolean IsProt,Int2 len,Uint1 strand); 296 NLM_EXTERN CharPtr UDV_Read_Sequence (SeqIdPtr sip, Int4 from, Int4 to, 297 Boolean IsProt,Int2 len); 298 NLM_EXTERN void UDV_ComputeBspCoordRangeinPGP(ParaGPtr pgp,Int4Ptr from, 299 Int4Ptr to); 300 NLM_EXTERN void UDV_GetStrandinPGP(ParaGPtr pgp,Uint1Ptr strand); 301 NLM_EXTERN void UDV_GetStrandinPGPList(ValNodePtr pgp_list,Uint1Ptr strand); 302 NLM_EXTERN void UDV_GetBspRangeinPGPList(ValNodePtr pgp_list, 303 Int4Ptr bsp_start,Int4Ptr bsp_stop); 304 NLM_EXTERN Int4 UDV_RevertBioSeqCoord(Int4 bsp_coord,Int4 bsp_length); 305 306 307 308 #ifdef __cplusplus 309 } 310 #endif 311 312 #endif /* ndef _UDVSEQ_ */ 313 314