1 /* gather.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: gather.h 27 * 28 * Author: Jim Ostell 29 * 30 * Version Creation Date: 10/7/94 31 * 32 * $Revision: 6.15 $ 33 * 34 * File Description: 35 * 36 * Modifications: 37 * -------------------------------------------------------------------------- 38 * Date Name Description of modification 39 * ------- ---------- ----------------------------------------------------- 40 * 41 * $Log: gather.h,v $ 42 * Revision 6.15 2012/07/30 21:52:07 kans 43 * JIRA:GPI-1532 Track indexing of external AnnotDesc, assign to most recent Bioseq if sequence component ID not already loaded 44 * 45 * Revision 6.14 2006/07/13 17:06:38 bollin 46 * use Uint4 instead of Uint2 for itemID values 47 * removed unused variables 48 * resolved compiler warnings 49 * 50 * Revision 6.13 2004/10/25 20:13:27 kans 51 * added AssignIDsInEntityEx and GatherObjectsInEntityEx to index remotely fetched features 52 * 53 * Revision 6.12 2002/05/08 18:58:09 kans 54 * itemID is Uint4 55 * 56 * Revision 6.11 2001/11/15 18:34:52 kans 57 * added GetNextDescriptorUnindexed, requires AssignIDsInEntity be called first 58 * 59 * Revision 6.10 2000/01/06 00:54:50 kans 60 * added useSeqMgrIndexes field to GatherScope and InternalGCC structures, will implement indexed feature table exploration tomorrow 61 * 62 * Revision 6.9 1999/10/29 18:06:27 kans 63 * added GetPointerForIDs (with SW) 64 * 65 * Revision 6.8 1999/09/29 18:24:54 kans 66 * added DeleteMarkedObjects 67 * 68 * Revision 6.7 1999/09/28 18:10:16 kans 69 * added DeleteMarkedObjectsProc callback - not yet tested 70 * 71 * Revision 6.6 1999/09/28 12:10:25 kans 72 * finished implementing lightweight GatherObjectsInEntity 73 * 74 * Revision 6.5 1999/09/26 20:44:26 kans 75 * implemented most of VisitProc callbacks 76 * 77 * Revision 6.4 1999/09/26 00:17:14 kans 78 * VisitObjectsInEntity prototype added 79 * 80 * Revision 6.3 1999/09/07 17:59:53 kans 81 * AssignIDsInEntity takes datatype and dataptr for when entityID is 0, allowing unlinked components to be updated 82 * 83 * Revision 6.2 1999/09/07 17:00:43 kans 84 * added AssignIDsInEntity 85 * 86 * Revision 6.1 1999/01/13 23:34:20 kans 87 * added GatherSpecificProcLaunch 88 * 89 * Revision 6.0 1997/08/25 18:05:51 madden 90 * Revision changed to 6.0 91 * 92 * Revision 5.5 1997/06/19 18:37:53 vakatov 93 * [WIN32,MSVC++] Adopted for the "NCBIOBJ.LIB" DLL'ization 94 * 95 * Revision 5.4 1997/03/24 20:45:52 shavirin 96 * Added protection for usage with C++ compiler 97 * 98 * Revision 5.3 1996/11/05 17:58:57 zjing 99 * add a new member last to aligndata 100 * 101 * Revision 5.2 1996/08/29 01:18:34 ostell 102 * added GatherAddExtraLoc for codebreak and trna.atncodon mapping 103 * 104 * Revision 5.0 1996/05/28 13:23:23 ostell 105 * Set to revision 5.0 106 * 107 * Revision 4.11 1996/02/28 04:53:06 ostell 108 * added ObjMgrHold suport 109 * 110 * Revision 4.9 1996/01/03 23:01:04 ostell 111 * added GatherOverWrite() to support find/replace external to Gather 112 * 113 * Revision 4.8 1995/12/22 14:42:30 ostell 114 * added do_not_reload_from_cache to GatherScope 115 * modified calls to support it 116 * changed default behavior of gather to load and reclock entities 117 * 118 * Revision 4.7 1995/12/20 19:19:39 ostell 119 * added GatherContext.igccp field 120 * added FocusSeqEntry() function 121 * 122 * Revision 4.6 1995/11/21 23:08:38 ostell 123 * added support in GatherContext for gatherstack 124 * 125 * Revision 4.5 1995/11/06 22:18:38 kans 126 * added prototypes for ReMapIntFuzz and SeqLocReMap 127 * 128 * Revision 4.4 1995/11/06 21:29:03 ostell 129 * added newid and convert_loc to GatherScope, and new_loc to GatherContext 130 * added functions ReMapIntFuzz and SeqLocReMap to support them 131 * This allows SeqLocs on features to be copied into a remapped form by gather 132 * 133 * Revision 4.3 1995/10/06 19:25:24 ostell 134 * added fields "ignore_top" and "stop_on_annot" to GatherScope 135 * if "ignore_top" is TRUE, features on seglevel 0 are ignored 136 * if "stop_on_annot" is TRUE, segments are traversed to a maximum depth 137 * of gsp->seglevel, but traversing is stopped as soon as an annotation is 138 * found. 139 * 140 * Revision 4.2 1995/09/30 03:38:31 ostell 141 * Changed ObjMgrMessage functions to pass a structure 142 * Added support for selecting regions 143 * Added ability to remove entity when no more views on it 144 * 145 * Revision 4.1 1995/08/16 17:48:34 kans 146 * add a chain parameter for gather Seq-align (jz) 147 * 148 * Revision 4.0 1995/07/26 13:49:01 ostell 149 * force revision to 4.0 150 * 151 * Revision 1.15 1995/07/10 15:51:59 kans 152 * changes in gather_align_data (zjing) 153 * 154 * Revision 1.14 1995/06/01 21:53:55 kans 155 * support for Seq-align (zjing) 156 * 157 * Revision 1.13 1995/05/15 21:46:05 ostell 158 * added Log line 159 * 160 * 161 * 162 * 163 * ========================================================================== 164 */ 165 166 #ifndef _GATHER_ 167 #define _GATHER_ 168 169 #include <sequtil.h> 170 171 172 typedef struct gatherrange { 173 Int4 left; 174 Int4 right; 175 Boolean l_trunc; 176 Boolean r_trunc; 177 Uint1 strand; 178 } GatherRange, PNTR GatherRangePtr; 179 180 typedef struct seqrange { 181 Int4 start; 182 Int4 stop; 183 Uint1 strand; 184 } SeqRange, PNTR SeqRangePtr; 185 186 typedef struct alignrange{ 187 Uint1 segtype; /* codes for segments of alignments, _SEG below */ 188 GatherRange gr; 189 SeqRange sr; 190 struct alignrange PNTR next; 191 } AlignRange, PNTR AlignRangePtr; 192 193 194 typedef struct aligndata { 195 Uint2 chain; /*the current count of the dense-diag or std-seg chain*/ 196 Int4 master_pos; /*the start position of the master sequence*/ 197 Int2 order; /*order of sequence in ONE chain*/ 198 SeqIdPtr sip; 199 GatherRange extremes; /*two ends on the graph*/ 200 SeqRange seqends; /*two ends on the sequence*/ 201 AlignRangePtr arp, last; 202 struct aligndata PNTR next; 203 }AlignData, PNTR AlignDataPtr; 204 205 206 #define GAP_SEG 1 /* a gap */ 207 #define REG_SEG 2 /* a segment */ 208 #define INS_SEG 3 /* an insertion */ 209 #define STD_SEG 4 /*a segment from StdSeg*/ 210 #define DIAG_SEG 5 /*a diagnol segment*/ 211 212 /***************************************************************************** 213 * 214 * GatherSeqEntry() and GatherItem() return a pointer to the GatherContext 215 * below. entityID, itemID, and thistype are the 3 minimum elements required 216 * for GatherItem to relocate the item. 217 * 218 * The fields seglevel and propagated will NOT be set by GatherItem(). They 219 * are ONLY set by GatherSeqEntry(). 220 * 221 *****************************************************************************/ 222 typedef struct gatherelement { 223 Uint4 itemID; 224 Uint2 itemtype; 225 Pointer thisitem; 226 Boolean tempload; 227 } GatherElement, PNTR GatherElementPtr; 228 229 typedef struct gathercontext { 230 Uint2 entityID; 231 Uint4 itemID; 232 Pointer thisitem, 233 previtem, 234 parentitem; 235 Uint2 thistype, 236 prevtype, 237 parenttype; 238 Pointer PNTR prevlink; /* used to remove data item from chains */ 239 SeqEntryPtr sep; /* sep that points to Bioseq or BioseqSet in thisitem */ 240 Pointer userdata; 241 Boolean tempload; /* this data temporarily loaded */ 242 Boolean hold; /* ObjMgr is in a hold state (see ObjMgrSetHold, objmgr.h) */ 243 GatherRangePtr rdp; /* mapped intervals to global coordinates */ 244 AlignDataPtr adp; /*for aligned data*/ 245 Int2 num_interval; /* number of mapped intervals */ 246 GatherRange extremes; /* extreme left and right locations */ 247 Boolean propagated; /* is this item propagated from out of scope? */ 248 Int2 seglevel; /* how many segment levels are we? */ 249 Boolean product; /* TRUE if match by SeqId on product */ 250 Int2 indent; /* indent level in containing Seq-entry */ 251 SeqLocPtr new_loc; /* SeqLoc converted to new coordinates if 252 GatherScope.convert_loc == TRUE. 253 WARNING: USER MUST FREE new_loc */ 254 SeqLocPtr PNTR extra_loc; /* converted SeqLocs for CodeBreak or tRNA.anticodon 255 filled in if GatherScope.convert_loc = TRUE 256 WARNING: USER MUST FREE extra_loc[i] */ 257 Int2 extra_loc_cnt, /* number of cells in extra_loc containing converted 258 locs */ 259 extra_loc_total; /* size of extra_loc array */ 260 GatherElementPtr gatherstack; /* thisitem is gcp->indent, parent gcp->indent - 1 */ 261 Int2 numstack; /* gatherstack total size */ 262 Pointer igccp; /* really InternalGCCPtr. use with care */ 263 } GatherContext, PNTR GatherContextPtr; 264 265 typedef Boolean (*GatherItemProc) (GatherContextPtr gcp); 266 267 typedef struct gatherscope { 268 SeqEntryPtr scope; /* NULL, or SeqEntry to limit data items to */ 269 Boolean get_feats_location, /* get all features if location on Bioseq */ 270 get_feats_product; /* get all features if product on Bioseq */ 271 SeqLocPtr target; /* limit features to a range on the Bioseq */ 272 Int4 offset; /* offset features this much */ 273 Boolean ignore[OBJ_MAX]; /* if TRUE, this GITEM does not call userfunc */ 274 Boolean nointervals; /* if TRUE, don't populate GatherIntervals */ 275 Boolean mapinsert; /*if TRUE, map the gaps in master as insertion*/ 276 Int2 seglevels, /* number of segment levels to traverse */ 277 currlevel; /* current segment depth */ 278 Boolean stop_on_annot; /* if TRUE, stop traversing down when Seq-annot found */ 279 Boolean ignore_top; /* if TRUE, ignore Seq-annot on top level segment */ 280 Boolean split_packed_pnt; /* if TRUE, give itemID to each point */ 281 Boolean convert_loc; /* if TRUE, create a copy of Seq-loc for features and 282 put in GatherContext.new_loc. Only works if "target" 283 is not NULL and get_feats... is TRUE */ 284 SeqIdPtr newid; /* SeqId to use if convert_loc is TRUE */ 285 Boolean do_not_reload_from_cache; /* if TRUE, gather does not automatically reload cached entity */ 286 Boolean useSeqMgrIndexes; /* explore targeted feature tables with feature indexing functions */ 287 } GatherScope, PNTR GatherScopePtr; 288 289 typedef struct internalgcc { 290 GatherContext gc; 291 GatherScope scope; 292 GatherItemProc userfunc; 293 Boolean rev; /* TRUE if scope->target is on complement */ 294 Int2 max_interval; 295 BioseqPtr bsp; /* for checking a range on a Bioseq */ 296 Uint4 itemIDs[OBJ_MAX]; 297 SeqLocPtr segloc; /* if target is segmented and seglevel > 0 */ 298 Int2 first_seg, last_seg; /* see SeqLocCopyPart() in edutil.h */ 299 Int2 segcnt; /* count of segments in segloc */ 300 Int4Ptr seglens; /* length of each segment in seqloc */ 301 BoolPtr found_annot; /* TRUE if annot found in this region of current Bioseq */ 302 /* Not an indication of annot found in this segment */ 303 Uint1 locatetype; /* itemtype to locate */ 304 Uint4 locateID; /* itemID to locate */ 305 Pointer locatePtr; /* data item to locate */ 306 ObjMgrDataPtr omdp; /* top level omdp in entity */ 307 Boolean reloaded; /* TRUE if entity was reloaded from cache by IGCCBuild() */ 308 Boolean useSeqMgrIndexes; /* explore targeted feature tables with feature indexing functions */ 309 } InternalGCC, PNTR InternalGCCPtr; 310 311 312 #undef NLM_EXTERN 313 #ifdef NLM_IMPORT 314 #define NLM_EXTERN NLM_IMPORT 315 #else 316 #define NLM_EXTERN extern 317 #endif 318 319 #ifdef __cplusplus 320 extern "C" { 321 #endif 322 323 NLM_EXTERN Boolean SeqLocOffset PROTO((SeqLocPtr seq_loc, SeqLocPtr sfp_loc, GatherRangePtr range, Int4 offset)); 324 NLM_EXTERN Boolean get_align_ends PROTO((SeqAlignPtr align, SeqIdPtr id, Int4Ptr start, Int4Ptr stop, Uint1Ptr strand)); 325 326 NLM_EXTERN AlignDataPtr FreeAlignData PROTO((AlignDataPtr adp)); 327 NLM_EXTERN AlignDataPtr gather_align_data PROTO((SeqLocPtr m_slp, SeqAlignPtr align, Int4 offset, Boolean ck_interval, Boolean map)); 328 329 NLM_EXTERN IntFuzzPtr ReMapIntFuzz PROTO((IntFuzzPtr ifp, Boolean rev, SeqLocPtr seq_loc, SeqLocPtr sfp_loc, Int4 offset)); 330 NLM_EXTERN SeqLocPtr SeqLocReMap PROTO((SeqIdPtr newid, SeqLocPtr seq_loc, SeqLocPtr head, Int4 offset, Boolean rev)); 331 332 /***************************************************************************** 333 * 334 * GatherEntity (entityID, userdata, userproc, scope) 335 * 336 *****************************************************************************/ 337 NLM_EXTERN Boolean LIBCALL GatherEntity PROTO((Uint2 entityID, Pointer userdata, GatherItemProc userfunc, GatherScopePtr scope)); 338 339 /***************************************************************************** 340 * 341 * GatherSeqEntry (sep, userdata, userproc, scope) 342 * 343 *****************************************************************************/ 344 NLM_EXTERN Boolean LIBCALL GatherSeqEntry PROTO((SeqEntryPtr sep, Pointer userdata, GatherItemProc userfunc, GatherScopePtr scope)); 345 346 /***************************************************************************** 347 * 348 * FocusSeqEntry (sep, scope) 349 * zeros out all fields in scope 350 * sets scope.target, .scope, appropriately for 351 * SeqEntry 352 * if (Bioseq) 353 * target is the bioseq 354 * entityID is the containing set if any 355 * scope.scope is null 356 * if (BioseqSet) 357 * target is NULL 358 * entityID is the containing set if any 359 * scope.scope is sep 360 * 361 * return of FOCUS_INITIALIZED means scope is initialized 362 * return of FOCUS_NOT_NEEDED means send NULL for GatherScope.. you 363 * don't need to scope for this SeqEntryPtr 364 * return of FOCUS_ERROR means it could not be initialized 365 * 366 * NOTE: If this function returns FOCUS_INITIALIZED, the CALLER MUST 367 * call SeqLocFree(scope.target) to remove any target this function 368 * had to install. WARNING! 369 * 370 *****************************************************************************/ 371 NLM_EXTERN Int2 LIBCALL FocusSeqEntry PROTO((SeqEntryPtr sep, GatherScopePtr scope)); 372 373 #define FOCUS_ERROR 0 374 #define FOCUS_NOT_NEEDED 1 375 #define FOCUS_INITIALIZED 2 376 377 /***************************************************************************** 378 * 379 * GatherItem (entityID, itemID, itemtype, userdata, userproc) 380 * Get an item by entityID, itemID, itemtype 381 * GatherContext.seglevel and GatherContext.propagated will not be 382 * set on the callback. 383 * itemtype is as defined in objmgr.h for OBJ_ 384 * only those included in GITEM_ defined above will be found 385 * 386 *****************************************************************************/ 387 NLM_EXTERN Boolean LIBCALL GatherItem PROTO((Uint2 entityID, Uint4 itemID, Uint2 itemtype, 388 Pointer userdata, GatherItemProc userfunc)); 389 390 /***************************************************************************** 391 * 392 * GatherData (entityID, itemID, itemtype, userdata, userproc) 393 * Get an item by entityID, itemtype, and a Pointer of itemtype 394 * GatherContext.seglevel and GatherContext.propagated will not be 395 * set on the callback. 396 * 397 * Sets in_scope to FALSE so that the callback is not called 398 * Scope is NULL, so in_scope is never TRUE 399 * Sets ignore TRUE for everything not needed to find item 400 * Sets locatetype and locateID, which are checked in the traversal 401 * 402 *****************************************************************************/ 403 NLM_EXTERN Boolean LIBCALL GatherData PROTO((Uint2 entityID, Pointer dataptr, Uint2 itemtype, 404 Pointer userdata, GatherItemProc userfunc)); 405 406 /***************************************************************************** 407 * 408 * GatherItemIDByData (entityID, itemtype, dataptr) 409 * Looks in entityID for an element of itemtype that matches the pointer 410 * dataptr. 411 * if found, returns the itemID 412 * else returns 0 413 * itemtype is as defined in objmgr.h for OBJ_ 414 * 415 *****************************************************************************/ 416 NLM_EXTERN Uint4 LIBCALL GatherItemIDByData PROTO((Uint2 entityID, Uint2 itemtype, Pointer dataptr)); 417 418 419 /**************************************************************************** 420 * 421 * GatherDataForProc(ompcp, sel) 422 * 423 * fills in data, choice, and choictype in OMProcControlPtr 424 * sets ompcp->whole_entity TRUE if appropriate 425 * returns TRUE if it did it 426 * if (sel == TRUE), fills in ompcp with data from ObjMgrGetSelect first. 427 * returns FALSE if nothing selected.. Does ErrPostEx() for it 428 * 429 ****************************************************************************/ 430 NLM_EXTERN Boolean LIBCALL GatherDataForProc PROTO((OMProcControlPtr ompcp, Boolean sel)); 431 432 /**************************************************************************** 433 * 434 * DetachDataForProc(ompcp, sel) 435 * 436 * fills in data, choice, and choictype in OMProcControlPtr 437 * sets ompcp->whole_entity TRUE if appropriate 438 * returns TRUE if it did it 439 * if (sel == TRUE), fills in ompcp with data from ObjMgrGetSelect first. 440 * returns FALSE if nothing selected.. Does ErrPostEx() for it 441 * Detaches data item from surrounding data if necessary 442 * 443 ****************************************************************************/ 444 NLM_EXTERN Boolean LIBCALL DetachDataForProc PROTO((OMProcControlPtr ompcp, Boolean sel)); 445 446 /**************************************************************************** 447 * 448 * AttachDataForProc(ompcp, sel) 449 * 450 * fills in data, choice, and choictype in OMProcControlPtr 451 * sets ompcp->whole_entity TRUE if appropriate 452 * returns TRUE if it did it 453 * if (sel == TRUE), fills in ompcp with data from ObjMgrGetSelect first. 454 * returns FALSE if nothing selected.. Does ErrPostEx() for it 455 * Attaches data in output section of ompcp into the input section 456 * 457 ****************************************************************************/ 458 NLM_EXTERN Boolean LIBCALL AttachDataForProc PROTO((OMProcControlPtr ompcp, Boolean sel)); 459 460 /**************************************************************************** 461 * 462 * CopyDataForProc(ompcp, sel) 463 * 464 * fills in data, choice, and choictype in OMProcControlPtr 465 * sets ompcp->whole_entity TRUE if appropriate 466 * returns TRUE if it did it 467 * if (sel == TRUE), fills in ompcp with data from ObjMgrGetSelect first. 468 * returns FALSE if nothing selected.. Does ErrPostEx() for it 469 * Attaches copy of data in output section of ompcp 470 * adds to objmgr as necessary, but does NOT register copy 471 * 472 ****************************************************************************/ 473 NLM_EXTERN Boolean LIBCALL CopyDataForProc PROTO((OMProcControlPtr ompcp, Boolean sel)); 474 475 /**************************************************************************** 476 * 477 * ReplaceDataForProc(ompcp, sel) 478 * 479 * fills in data, choice, and choictype in OMProcControlPtr 480 * sets ompcp->whole_entity TRUE if appropriate 481 * returns TRUE if it did it 482 * if (sel == TRUE), fills in ompcp with data from ObjMgrGetSelect first. 483 * returns FALSE if nothing selected.. Does ErrPostEx() for it 484 * 485 * Replaces data in input section of ompcp with the output section 486 * Data in input section is deleted 487 * 488 * This replaces all contained data!! Replacing a Bioseq replaces any 489 * attached descriptors or annots or history as well, for example. 490 * 491 * This does NOT send update messages to the ObjMgr for you. 492 * 493 ****************************************************************************/ 494 NLM_EXTERN Boolean LIBCALL ReplaceDataForProc PROTO((OMProcControlPtr ompcp, Boolean sel)); 495 496 497 /***************************************************************************** 498 * 499 * GatherProcLaunch(proctype, sel, entityID, itemID, itemtype, 500 * inputtype, subinputtype, outputtype, suboutputtype) 501 * 502 * looks for proctype of highest priority that 503 * matches inputtype and outputtype 504 * if (sel) then fills in entityID,itemID,itemtype with currently selected 505 * item 506 * else 507 * uses the function arguments 508 * locates the data pointer, determines the subtype (if any) 509 * then finds the highest priority process 510 * 0 on outputtype, inputsubtype, outputsubtype matches any 511 * if subtype can be matched on input/output, takes in preference over 512 * more general proc 513 * 514 * USAGE: 515 * 1) To launch an editor for the currently selected item 516 * GatherProcLaunch(OMPROC_EDIT,TRUE,0,0,0,0,0,0,0); 517 * 2) To launch an editor to create a new seq_descr of type pub 518 * GatherProcLaunch(OMPROC_EDIT,FALSE,0,0,0,OBJ_SEQDESC,Seq_descr_pub,0,0); 519 * 3) To launch an editor for a specific seq_descr 520 * GatherProcLaunch(OMPROC_EDIT,FALSE,2,1,4,0,0,0,0); 521 * (where the 3 numbers identify the seq_descr) 522 * 4)To launch an editor which will create a new seq_descr and attach it 523 * to the currently selected Bioseq 524 * GatherProcLaunch(OMPROC_EDIT,TRUE,0,0,0,OBJ_SEQDESC,Seq_descr_pub,0,0) 525 * Note in this case ompcp->input_entityid, .input_itemid, input_itemtype 526 * well refer to a Bioseq. The editor should check the input_itemtype 527 * and decide if it can attach it's output to it, or if it is an 528 * input type mismatch error. 529 * 5) To launch an editor which will create a new seq_descr and attach to 530 * a specific Bioseq 531 * (Same as (4) but sel=FALSE, and entitid,itemid,itemtype filled in 532 * for the Bioseq). 533 * 534 * GENERAL RULES: 535 * 536 * All this means the function will be called with OMProcControlPtr (ompcp) 537 * fields filled in (input_entityid, input_itemid, input_itemtype) as: 538 * 1) Create new one, place in desktop = 0,0,0 539 * 2) Edit old one, non-zero values, with input_itemtype matching the type 540 * of the editor. 541 * 3) Create a new one, attach it to something else, non-zero values, 542 * with input_itemtype not matching the type of the editor. 543 * 544 * Functions to install the returned values are for the cases above: 545 * 1) ObjMgrRegister() 546 * 2) GatherReplaceDataForProc() 547 * 3) GatherAttachDataForProc() 548 * 549 * returns the return from the proc, or OM_MSG_RET_NOPROC if not found 550 * 551 *****************************************************************************/ 552 NLM_EXTERN Int2 GatherProcLaunch PROTO((Uint2 proctype, Boolean sel, Uint2 entityID, Uint4 itemID, 553 Uint2 itemtype, Uint2 inputtype, Uint2 subinputtype, Uint2 outputtype, Uint2 suboutputtype)); 554 555 /***************************************************************************** 556 * 557 * GatherSpecificProcLaunch(procid, procname, proctype, sel, entityID, itemID, itemtype) 558 * 559 * Launches specific viewer or editor 560 * 561 *****************************************************************************/ 562 NLM_EXTERN Int2 GatherSpecificProcLaunch PROTO((Uint2 procid, CharPtr procname, Uint2 proctype, 563 Boolean sel, Uint2 entityID, Uint4 itemID, Uint2 itemtype)); 564 565 /***************************************************************** 566 * 567 * GatherOverWrite (oldptr, newptr, type) 568 * type is OBJ_... 569 * overwrites oldptr with contents of newptr 570 * sets any "next" pointers contained in newptr to point to the same 571 * chain as those in oldptr did 572 * At the end, oldptr contains the data from newptr, 573 * newptr contains the data from oldptr 574 * newptr is removed from any chain 575 * oldptr remains in whatever chain it was in before 576 * CALLER must call appropriate free function for newptr 577 * this function is used for making a varient copy of an object, then 578 * replacing it in another object without changing points to or from 579 * this object 580 *******************************************************************/ 581 NLM_EXTERN Boolean LIBCALL GatherOverWrite PROTO((Pointer oldptr, Pointer newptr, Uint2 type)); 582 583 584 /***************************************************************************** 585 * 586 * AssignIDsInEntity (entityID, datatype, dataptr) 587 * Assigns entityID/itemID/itemtype, parent pointer, and prevlink to several 588 * data objects. If entityID is > 0 it looks up the registered datatype and 589 * dataptr from the object manager. Otherwise it uses the remaining parameters, 590 * assigning entityID 0 to the unregistered components. 591 * 592 * GatherObjectsInEntity (entityID, datatype, dataptr, callback, userdata, objMgrFilter) 593 * Calls callback for objects within entity. If the objMgrFilter parameter is NULL, 594 * every object type is visited, otherwise the array length should be OBJ_MAX, and 595 * the elements are from the OBJ_ list. 596 * 597 * The Ex versions take a ValNodePtr parameter whose data.ptrvalue fields point to 598 * a Bioseq that contains a SeqAnnot with remotely fetched features. 599 * 600 *****************************************************************************/ 601 602 typedef struct gatherobject { 603 Uint2 entityID; 604 Uint2 itemtype; 605 Uint1 subtype; 606 Uint2 parenttype; 607 Uint4 itemID; 608 Pointer dataptr; 609 Pointer parentptr; 610 Pointer PNTR prevlink; 611 Pointer userdata; 612 Boolean external; 613 } GatherObject, PNTR GatherObjectPtr; 614 615 typedef Boolean (*GatherObjectProc) (GatherObjectPtr gop); 616 617 NLM_EXTERN Boolean LIBCALL AssignIDsInEntity ( 618 Uint2 entityID, 619 Uint2 datatype, 620 Pointer dataptr 621 ); 622 623 NLM_EXTERN Boolean LIBCALL AssignIDsInEntityEx ( 624 Uint2 entityID, 625 Uint2 datatype, 626 Pointer dataptr, 627 ValNodePtr extra 628 ); 629 630 NLM_EXTERN Boolean LIBCALL GatherObjectsInEntity ( 631 Uint2 entityID, 632 Uint2 datatype, 633 Pointer dataptr, 634 GatherObjectProc callback, 635 Pointer userdata, 636 BoolPtr objMgrFilter 637 ); 638 639 NLM_EXTERN Boolean LIBCALL GatherObjectsInEntityEx ( 640 Uint2 entityID, 641 Uint2 datatype, Pointer dataptr, 642 GatherObjectProc callback, 643 Pointer userdata, 644 BoolPtr objMgrFilter, 645 ValNodePtr extra 646 ); 647 648 /***************************************************************************** 649 * 650 * DeleteMarkedObjects (entityID, datatype, dataptr) 651 * Unlinks and removes all objects whose GatherIndex.deleteme flag is not 0. 652 * 653 *****************************************************************************/ 654 655 NLM_EXTERN Boolean DeleteMarkedObjects (Uint2 entityID, Uint2 datatype, Pointer dataptr); 656 657 /***************************************************************************** 658 * 659 * GetPointerForIDs (entityID, itemID, itemtype) 660 * Finds pointer of specified object (GatherItem replacement). 661 * 662 *****************************************************************************/ 663 664 NLM_EXTERN Pointer LIBCALL GetPointerForIDs (Uint2 entityID, Uint4 itemID, Uint2 itemtype); 665 666 /***************************************************************************** 667 * 668 * GetNextDescriptorUnindexed (bsp, choice, curr) 669 * After AssignIDsInEntity, gets next descriptor up the set hierarchy. 670 * 671 *****************************************************************************/ 672 673 NLM_EXTERN SeqDescrPtr GetNextDescriptorUnindexed ( 674 BioseqPtr bsp, 675 Uint1 choice, 676 SeqDescrPtr curr 677 ); 678 679 680 #ifdef __cplusplus 681 } 682 #endif 683 684 #undef NLM_EXTERN 685 #ifdef NLM_EXPORT 686 #define NLM_EXTERN NLM_EXPORT 687 #else 688 #define NLM_EXTERN 689 #endif 690 691 #endif 692