1 /* objsset.h 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: objsset.h 27 * 28 * Author: James Ostell 29 * 30 * Version Creation Date: 4/1/91 31 * 32 * $Revision: 6.9 $ 33 * 34 * File Description: Object manager interface for module NCBI-Seqset 35 * 36 * Modifications: 37 * -------------------------------------------------------------------------- 38 * Date Name Description of modification 39 * ------- ---------- ----------------------------------------------------- 40 * 41 * ========================================================================== 42 */ 43 44 #ifndef _NCBI_Seqset_ 45 #define _NCBI_Seqset_ 46 47 #ifndef _ASNTOOL_ 48 #include <asn.h> 49 #endif 50 #ifndef _NCBI_General_ 51 #include <objgen.h> 52 #endif 53 #ifndef _NCBI_Seq_ 54 #include <objseq.h> 55 #endif 56 57 #undef NLM_EXTERN 58 #ifdef NLM_IMPORT 59 #define NLM_EXTERN NLM_IMPORT 60 #else 61 #define NLM_EXTERN extern 62 #endif 63 64 #ifdef __cplusplus 65 extern "C" { 66 #endif 67 68 /***************************************************************************** 69 * 70 * loader 71 * 72 *****************************************************************************/ 73 NLM_EXTERN Boolean LIBCALL SeqSetAsnLoad PROTO((void)); 74 75 /***************************************************************************** 76 * 77 * internal structures for NCBI-Seqset objects 78 * 79 *****************************************************************************/ 80 /***************************************************************************** 81 * 82 * BioseqSet - a collection of sequences 83 * 84 *****************************************************************************/ 85 typedef struct seqset { 86 ObjectIdPtr id; 87 DbtagPtr coll; 88 Int2 level; /* set to INT2_MIN (ncbilcl.h) for not used */ 89 Uint1 _class; 90 CharPtr release; 91 DatePtr date; 92 ValNodePtr descr; 93 SeqEntryPtr seq_set; 94 SeqAnnotPtr annot; 95 GatherIndex idx; /* internal gather/objmgr tracking fields */ 96 SeqEntryPtr seqentry; /* internal seqentry that points to this bioseqset */ 97 } BioseqSet, PNTR BioseqSetPtr; 98 99 NLM_EXTERN BioseqSetPtr LIBCALL BioseqSetNew PROTO((void)); 100 NLM_EXTERN Boolean LIBCALL BioseqSetAsnWrite PROTO((BioseqSetPtr bsp, AsnIoPtr aip, AsnTypePtr atp)); 101 NLM_EXTERN BioseqSetPtr LIBCALL BioseqSetAsnRead PROTO((AsnIoPtr aip, AsnTypePtr atp)); 102 NLM_EXTERN BioseqSetPtr LIBCALL BioseqSetFree PROTO((BioseqSetPtr bsp)); 103 NLM_EXTERN Int2 LIBCALL BioseqSetLabel PROTO((BioseqSetPtr bssp, CharPtr buffer, Int2 buflen, Uint1 content)); 104 105 /***************************************************************************** 106 * 107 * defines for BioseqSet._class 108 not-set (0) , 109 nuc-prot (1) , -- nuc acid and coded proteins 110 segset (2) , -- segmented sequence + parts 111 conset (3) , -- constructed sequence + parts 112 parts (4) , -- parts for 2 or 3 113 gibb (5) , -- geninfo backbone 114 gi (6) , -- geninfo 115 genbank (7) , -- converted genbank 116 pir (8) , -- converted pir 117 pub-set (9) , -- all the seqs from a single publication 118 equiv (10) , -- a set of equivalent maps or seqs 119 swissprot (11) , -- converted SWISSPROT 120 pdb-entry (12) , -- a complete PDB entry 121 mut-set (13) , -- set of mutations 122 pop-set (14) , -- population study 123 phy-set (15) , -- phylogenetic study 124 eco-set (16) , -- ecological sample study 125 gen-prod-set (17) , -- genomic products, chrom+mRNa+protein 126 wgs-set (18) , -- whole genome shotgun project 127 named-annot (19) , -- named annotation set 128 named-annot-prod (20) , -- with instantiated mRNA+protein 129 read-set (21) , -- set from a single read 130 paired-end-reads (22) , -- paired sequences within a read-set 131 small-genome-set (23) , -- viral segments or mitochondrial minicircles 132 other (255) } DEFAULT not-set , 133 134 * 135 ******************************************************************************/ 136 #define BioseqseqSet_class_not_set 0 137 #define BioseqseqSet_class_nuc_prot 1 138 #define BioseqseqSet_class_segset 2 139 #define BioseqseqSet_class_conset 3 140 #define BioseqseqSet_class_parts 4 141 #define BioseqseqSet_class_gibb 5 142 #define BioseqseqSet_class_gi 6 143 #define BioseqseqSet_class_genbank 7 144 #define BioseqseqSet_class_pir 8 145 #define BioseqseqSet_class_pub_set 9 146 #define BioseqseqSet_class_equiv 10 147 #define BioseqseqSet_class_swissprot 11 148 #define BioseqseqSet_class_pdb_entry 12 149 #define BioseqseqSet_class_mut_set 13 150 #define BioseqseqSet_class_pop_set 14 151 #define BioseqseqSet_class_phy_set 15 152 #define BioseqseqSet_class_eco_set 16 153 #define BioseqseqSet_class_gen_prod_set 17 154 #define BioseqseqSet_class_wgs_set 18 155 #define BioseqseqSet_class_named_annot 19 156 #define BioseqseqSet_class_named_annot_prod 20 157 #define BioseqseqSet_class_read_set 21 158 #define BioseqseqSet_class_paired_end_reads 22 159 #define BioseqseqSet_class_small_genome_set 23 160 161 /* for temporary internal use to prevent automatic freeing */ 162 #define BioseqseqSet_class_empty_set 254 163 164 #define BioseqseqSet_class_other 255 165 166 /***************************************************************************** 167 * 168 * BioseqSetFreeComponents(bsp, parts) 169 * Frees associated data of a BioseqSet 170 * if (parts == FALSE) 171 * Calls SeqEntryFreeComponents() for seq-set 172 * else 173 * Calls SeqEntryFree() 174 * Does not free the BioseqSet itself 175 * Called by BioseqSetFree 176 * Used by SeqMgr for caching out 177 * 178 *****************************************************************************/ 179 NLM_EXTERN BioseqSetPtr LIBCALL BioseqSetFreeComponents PROTO((BioseqSetPtr bsp, Boolean parts)); 180 181 /***************************************************************************** 182 * 183 * SeqEntry - implemented as an ValNode 184 * choice: 185 * 1 = Bioseq 186 * 2 = Bioseq-set 187 * 188 *****************************************************************************/ 189 190 NLM_EXTERN SeqEntryPtr LIBCALL SeqEntryNew PROTO((void)); 191 NLM_EXTERN Boolean LIBCALL SeqEntryAsnWrite PROTO((SeqEntryPtr sep, AsnIoPtr aip, AsnTypePtr atp)); 192 NLM_EXTERN SeqEntryPtr LIBCALL SeqEntryAsnRead PROTO((AsnIoPtr aip, AsnTypePtr atp)); 193 NLM_EXTERN SeqEntryPtr LIBCALL SeqEntryFree PROTO((SeqEntryPtr sep)); 194 NLM_EXTERN Int2 LIBCALL SeqEntryLabel PROTO((SeqEntryPtr sep, CharPtr buffer, Int2 buflen, Uint1 content)); 195 196 /***************************************************************************** 197 * 198 * SeqEntryFreeComponents(sep) 199 * Frees components of elements associated with SeqEntry 200 * used by SeqMgr for caching out 201 * 202 *****************************************************************************/ 203 NLM_EXTERN SeqEntryPtr LIBCALL SeqEntryFreeComponents PROTO((SeqEntryPtr sep)); 204 205 /***************************************************************************** 206 * 207 * Options for SeqEntryAsnRead() 208 * 209 *****************************************************************************/ 210 NLM_EXTERN SeqEntryPtr LIBCALL SeqEntryAsnGet PROTO((AsnIoPtr aip, AsnTypePtr atp, SeqIdPtr sip, Int2 retcode)); 211 212 #define SEQENTRY_OPTION_MAX_COMPLEX 1 /* option type to use with OP_NCBIOBJSSET */ 213 214 /* values for retcode, implemented with AsnIoOptions */ 215 #define SEQENTRY_READ_BIOSEQ 1 /* read only Bioseq identified by sip */ 216 #define SEQENTRY_READ_SEG_SET 2 /* read any seg-set it may be part of */ 217 #define SEQENTRY_READ_NUC_PROT 3 /* read any nuc-prot set it may be in */ 218 #define SEQENTRY_READ_PUB_SET 4 /* read pub-set it may be part of */ 219 220 typedef struct objsset_option { 221 SeqIdPtr sip; /* seq-id to find */ 222 Int2 retcode; /* type of set/seq to return */ 223 Boolean in_right_set; 224 Uint1 working_on_set; /* 2, if in first set of retcode type */ 225 /* 1, if found Bioseq, but not right set */ 226 /* 0, if Bioseq not yet found */ 227 } Op_objsset, PNTR Op_objssetPtr; 228 229 230 #define IS_Bioseq(a) ((a)->choice == 1) 231 #define IS_Bioseq_set(a) ((a)->choice == 2) 232 233 /***************************************************************************** 234 * 235 * loader for ObjSeqSet and Sequence Codes 236 * 237 *****************************************************************************/ 238 NLM_EXTERN Boolean LIBCALL SeqEntryLoad PROTO((void)); 239 240 241 #ifdef __cplusplus 242 } 243 #endif 244 245 #undef NLM_EXTERN 246 #ifdef NLM_EXPORT 247 #define NLM_EXTERN NLM_EXPORT 248 #else 249 #define NLM_EXTERN 250 #endif 251 252 #endif 253