1 /* lsqfetch.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: lsqfetch.h 27 * 28 * Author: Jinghui Zhang 29 * 30 * Version Creation Date: 5/25/95 31 * 32 * $Revision: 6.8 $ 33 * 34 * File Description: Utilities for fetching local sequences 35 * 36 * Modifications: 37 * -------------------------------------------------------------------------- 38 * Date Name Description of modification 39 * ------- ---------- ----------------------------------------------------- 40 * 41 * 42 * $Log: lsqfetch.h,v $ 43 * Revision 6.8 2006/11/09 22:41:51 kans 44 * allow AsnIndex files to be made in separate directory from data source files 45 * 46 * Revision 6.7 2006/11/07 21:40:02 kans 47 * added CreateMasterAsnIndex 48 * 49 * Revision 6.6 2004/08/03 17:51:49 kans 50 * added AsnIndexedLibFetch enable and disable functions 51 * 52 * Revision 6.5 2004/08/02 19:10:14 kans 53 * added CreateAsnIndex for indexing Bioseq-set ftp release files 54 * 55 * Revision 6.4 2003/11/12 23:38:49 kans 56 * changing AltIndexedFastaLibFetchEnable prototype, implementation not yet finished 57 * 58 * Revision 6.3 2003/08/27 19:27:43 kans 59 * added AltIndexedFastaLibFetch functions for chimpanzee genome project 60 * 61 * Revision 6.2 2001/03/12 23:19:33 kans 62 * added IndexedFastaLib functions - currently uses genome contig naming conventions 63 * 64 * Revision 6.1 1998/02/06 17:41:39 zjing 65 * make the function CheckDnaResidue external 66 * 67 * Revision 6.0 1997/08/25 18:06:30 madden 68 * Revision changed to 6.0 69 * 70 * Revision 5.2 1997/07/18 21:26:07 zjing 71 * *** empty log message *** 72 * 73 * Revision 5.1 1997/06/19 18:38:18 vakatov 74 * [WIN32,MSVC++] Adopted for the "NCBIOBJ.LIB" DLL'ization 75 * 76 * Revision 5.0 1996/05/28 13:23:23 ostell 77 * Set to revision 5.0 78 * 79 * Revision 4.5 1995/11/02 21:37:55 zjing 80 * . 81 * 82 * Revision 4.4 1995/10/11 19:29:28 zjing 83 * add LIBCALL for find_big_bioseq 84 * 85 * Revision 4.3 1995/08/31 18:55:36 zjing 86 * add include file accentr.h 87 * 88 * Revision 4.2 1995/08/04 17:31:32 kans 89 * JZ added LocalSeqFetchInit, LocalSeqFetchDisable 90 * 91 * Revision 4.1 1995/08/03 20:56:18 kans 92 * paths can now be specified in a regular NCBI config file 93 * 94 * Revision 4.0 1995/07/26 13:49:01 ostell 95 * force revision to 4.0 96 * 97 * Revision 1.1 1995/05/25 19:50:52 zjing 98 * Initial revision 99 * 100 * 101 * 102 * ========================================================================== 103 */ 104 105 #ifndef _LSQFETCH_ 106 #define _LSQFETCH_ 107 108 109 #ifndef _NCBI_SeqMgr_ 110 #include <seqmgr.h> 111 #endif 112 113 #ifndef _NCBI_Seqloc_ 114 #include <objloc.h> 115 #endif 116 117 #ifndef _NCBI_Seqset_ 118 #include <objsset.h> 119 #endif 120 121 #ifndef _NCBI_SeqUtil_ 122 #include <sequtil.h> 123 #endif 124 125 /* #include <accentr.h> */ 126 127 #undef NLM_EXTERN 128 #ifdef NLM_IMPORT 129 #define NLM_EXTERN NLM_IMPORT 130 #else 131 #define NLM_EXTERN extern 132 #endif 133 134 #ifdef __cplusplus 135 extern "C" { 136 #endif 137 138 /********************************************************************* 139 * 140 * seqid_to_string(sip, name, use_locus) 141 * print the most important field in Seqid to a string stored in 142 * name. 143 * 144 **********************************************************************/ 145 NLM_EXTERN Boolean seqid_to_string PROTO((SeqIdPtr sip, CharPtr name, Boolean use_locus)); 146 147 /********************************************************************** 148 * 149 * FastaLibBioseqFetchEnable(libs, now) 150 * Initiate the function for fetch a Bioseq from a Fasta Library 151 * file. libs is a list of library file names. 152 * If now = TRUE, open the library files and set the state to 153 * FASTALIB_OPEN. return TRUE for success. 154 * 155 ***********************************************************************/ 156 NLM_EXTERN Boolean FastaLibBioseqFetchEnable PROTO((ValNodePtr libs, Boolean now)); 157 158 /********************************************************************** 159 * 160 * FastaLibBioseqFetchEnable(libs, now) 161 * Initiate the function for fetch a Bioseq from a Fasta Library 162 * file. libs is a list of library file names. 163 * If now = TRUE, open the library files and set the state to 164 * FASTALIB_OPEN. return TRUE for success. 165 * 166 ***********************************************************************/ 167 NLM_EXTERN void FastaLibBioseqFetchDisable PROTO((void)); 168 169 170 #define BIN_ASN 1 171 #define TEXT_ASN 2 172 #define FASTA_FILE 3 173 174 #define FASTALIB_ERROR 0 /*can not open fasta lib*/ 175 #define FASTALIB_OPEN 1 /*fasta library is open*/ 176 #define FASTALIB_CLOSE 2 /*fasta libary is closed*/ 177 typedef struct fastalib{ 178 Boolean use_locus; 179 Char file_name[100]; 180 FILE *fp; 181 Uint1 state; 182 Int2 order; 183 struct fastalib PNTR next; 184 }FastaLib, PNTR FastaLibPtr; 185 186 typedef ValNode SingleBspFile, FAR *SingleBspFilePtr; 187 188 typedef struct filebsp{ /*structure for opening a bioseq from a file*/ 189 Boolean use_locus; 190 CharPtr path; /*path for the files*/ 191 CharPtr ext; /*extension for files*/ 192 Int2 order; /*the order of the search */ 193 }FileBsp, PNTR FileBspPtr; 194 195 /********************************************************************* 196 * 197 * FileBioseqFetchEnable(path, ext) 198 * Initiate a BioseqFetch function by either reading an ASN.1 199 * Seq-entry file or FASTA file. path->choice determines the 200 * type of the file, such as text ASN, binary ASN and FASTA file 201 * ext is the extension that is needed to add to the end of the 202 * sequence name to make the sequence file 203 * 204 *********************************************************************/ 205 NLM_EXTERN Boolean FileBioseqFetchEnable PROTO((ValNodePtr path, ValNodePtr ext)); 206 207 208 209 210 211 /********************************************************************** 212 * 213 * FileBioseqFetchDisable() 214 * Remove the proc associated with FileBioseqFetch and free all the 215 * sequence names in userdata 216 * 217 ***********************************************************************/ 218 NLM_EXTERN void FileBioseqFetchDisable PROTO((void)); 219 220 221 222 NLM_EXTERN Boolean LocalSeqFetchInit PROTO((Boolean now)); 223 224 /********************************************************************* 225 * 226 * BioseqFetchInit() 227 * Initiate BioseqFetch functions from local data and Entrez. 228 * Local data files are stored in a config file. 229 * If non is successful, return FALSE 230 * 231 *********************************************************************/ 232 NLM_EXTERN Boolean BioseqFetchInit PROTO((Boolean now)); 233 234 235 236 /*********************************************************************** 237 * 238 * BioseqFetchDisable(): Remove all the functions associated with 239 * BioseqFetch 240 * 241 **********************************************************************/ 242 NLM_EXTERN void BioseqFetchDisable PROTO((void)); 243 244 NLM_EXTERN void LocalSeqFetchDisable PROTO((void)); 245 246 /********************************************************************* 247 * 248 * find_big_bioseq(sep) 249 * return the longest Bioseq found in Seq-entry sep 250 * 251 * 252 **********************************************************************/ 253 NLM_EXTERN BioseqPtr LIBCALL find_big_bioseq PROTO((SeqEntryPtr sep)); 254 255 /*********************************************************************** 256 * 257 * Check if the sequence is a DNA or protein 258 * ck_len: the length for checking 259 * pnon_DNA: store the number of non-DNA residue 260 * return TRUE if it is a DNA sequence, FALSE for protein 261 * 262 ***********************************************************************/ 263 NLM_EXTERN Boolean CheckDnaResidue PROTO((CharPtr seq_ptr, Int4 ck_len, Int4Ptr pnon_DNA)); 264 265 /**********************************************************************/ 266 267 /* indexed FASTA lib functions - currently uses human genome contig naming convention */ 268 269 NLM_EXTERN Boolean IndexedFastaLibFetchEnable (CharPtr path); 270 NLM_EXTERN void IndexedFastaLibFetchDisable (void); 271 272 /* alternative indexed FASTA lib functions - currently uses new chimpanzee genome contig naming convention */ 273 274 NLM_EXTERN Boolean AltIndexedFastaLibFetchEnable (CharPtr path); 275 NLM_EXTERN void AltIndexedFastaLibFetchDisable (void); 276 277 /* common function for creating indexes of fasta library files */ 278 279 NLM_EXTERN void CreateFastaIndex (CharPtr file); 280 281 /* indexed ASN.1 lib functions */ 282 283 NLM_EXTERN Boolean AsnIndexedLibFetchEnable (CharPtr path, Boolean binary); 284 NLM_EXTERN void AsnIndexedLibFetchDisable (void); 285 286 287 /* common functions for creating indexes of ASN.1 Bioseq-set ftp release files */ 288 289 NLM_EXTERN void CreateAsnIndex (CharPtr datafile, CharPtr indexpath, Boolean binary); 290 291 NLM_EXTERN void CreateMasterAsnIndex (CharPtr datapath, CharPtr indexpath); 292 293 294 #ifdef __cplusplus 295 } 296 #endif 297 298 #undef NLM_EXTERN 299 #ifdef NLM_EXPORT 300 #define NLM_EXTERN NLM_EXPORT 301 #else 302 #define NLM_EXTERN 303 #endif 304 305 #endif 306