A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://www.ncbi.nlm.nih.gov/IEB/ToolBox/SDKDOCS/ACCESS.HTML below:

Entrez Data Access

Entrez Data Access

Introduction
Connecting To and Disconnecting From Data Sources
Scanning the List of Available Terms
Obtaining the UID Given an Accession Number
Obtaining the UIDs That Satisfy a Boolean Query
Loading a Sequence Record
Loading a MEDLINE Record
Streaming Through All of the Data Records
Converting to FASTA Format
Converting GenBank Format
Converting to MEDLARS Format
Loading a Document Summary
Loading a Set of Document Summaries
Retrieving Neighbors and Links
C Structures and Functions: accentr.h
C Structures and Functions: casn.h

 Introduction

The NCBI Software Development Kit provides functions to load Sequence and MEDLINE records from the Entrez: Sequences and Entrez: Citations CD-ROMs.  Records can be accessed by specifying their unique ID (UID). UIDs for a sequence record can easily be obtained by supplying an accession number from a source database, or a full Boolean query on indexed terms can be evaluated to return a list of UIDs that satisfy the query.  Given a UID, a single function call will load the record into a defined structure in memory, and return a pointer to the head of the memory object.

Alternatively, each record can be read in turn by a process called streaming, which does not require knowledge of a specific UID.  A program can either use the Object Loader level, which loads a given record into the defined memory structure, or it can use the AsnLib level, allowing it to read each ASN.1 item as it streams by.  The decision on which method to use depends upon the task being performed.

These memory object pointers can be passed to a number of utility functions.  These include standard report generators, which can convert MEDLINE records to MEDLARS format and sequence records to FASTA or GenBank Flat File formats.  A sequence port can be opened that gives a simple, linear view of a segmented sequence, converting alphabets, merging exon segments, and dealing with information on both strands of the DNA.  There are also functions to explore the individual BioSeqs in an object, and to retrieve features from any level in the structure. These functions have been discussed in the Sequence Utilities chapter.

A demo program, getseq.c, in the \demo directory of the NCBI software toolkit takes any sequence identifier (e.g. accession number, locus name), finds the unique id, then retrieves the entry. Parts of this program are explained below. Also, all of the Entrez application itself can be found in the \browser directory. The access functions are in the \cdromlib directory and listed in accentr.h.

Connecting To and Disconnecting From Data Sources

The program must connect to the databases before attempting to access them, and must disconnect from the databases prior to exit.  The Entrez application calls EntrezInit and EntrezFini.  (Access to more complicated Sequence and MEDLINE services are obtained by calling AccSeqInit, AccMlInit, AccSeqFini and AccMlFini.)  Many programs will also need to load the ASN.1 parse tables.   These function calls require that the NCBI configuration file (ncbi.cnf, ncbi.ini, ncbi.cfg or .ncbirc, depending upon the computer platform) is properly set up to specify appropriate data paths:

  #include <accentr.h>

  #include <objall.h>

  #include <objcode.h>

  if (EntrezInit ()) {

    if (AllObjLoad () && SeqCodeSetLoad ()) {

      /* Main body of program goes here. */

    }

    EntrezFini ();

  }

Scanning the List of Available Terms

The list of terms can be obtained by a scanning procedure.  This utilizes a callback function.  If the Boolean return of the callback is FALSE, the scanning stops:

  #include <accentr.h>

  static Boolean ReadProc (CharPtr term, Int4 special, Int4 total)

  {

    Char  str [32];

    /* Do something with the term. */

    MemFree (term);

    return TRUE;

  }

The term scanning can be started from a given string using EntrezTermListByTerm.  The page on which the first term appears is returned via the last parameter.  The return value is the number of complete pages read.  Scanning will continue until the end of the term list or until the callback returns FALSE:

  EntrezTermListByTerm (TYPE, FIELD, str, TERMS, ReadProc, &startPage);

The term scanning can be started from a given page using EntrezTermListByPage.  Scanning will continue until the end of the term list, until the specified number of pages has been read, or until the callback returns FALSE:

  EntrezTermListByPage (TYPE, FIELD, startPage, PAGES, ReadProc);

The special and total counts for a given term can be obtained by EntrezFindTerm.  This will also perform a truncation if the term string ends in "...":

  EntrezFindTerm (TYPE, FIELD, str, &special, &total);

Obtaining the UID Given an Accession Number

The unique ID for the first record indexed under a given name or accession number from a particular source database can be obtained with FindSeqId.  (To get all record UIDS, see the Boolean Query evaluation section below.)  FindSeqId returns a single UID, even if the accession number points to multiple records:

  #include <accseq.h>

  SeqIdPtr      sip;

  TextSeqIdPtr  tsip;

  DocUid        uid;

  tsip = TextSeqIdNew ();

  sip = ValNodeNew (NULL);

  sip->data.ptrvalue = tsip;

  switch (TYPE) {

    case GENBANK :

    sip->choice = SEQID_GENBANK;

    break;

    case PIR :

    sip->choice = SEQID_PIR;

    break;

    case SWISSPROT :

    sip->choice = SEQID_SWISSPROT;

    break;

  };

  switch (KIND) {

    case NAME :

      tsip->name = StringSave (TERM);

      break;

    case ACCESSION :

      tsip->accession = StringSave (TERM);

      break;

  }

  uid = FindSeqId (sip);

  if (uid != 0) {

    /* Do something with the uid. */

  }

  TextSeqIdFree (tsip);

  ValNodeFree (sip);

Obtaining the UIDs That Satisfy a Boolean Query

Boolean query evaluation is done by constructing a formula in memory andpassing it to an evaluation routine.  A LinkSetPtr containing the satisfying UIDS is returned.  All calls must define the data type and field of interest. A series of #defines are available in accentr.h for this purpose.

#define

Data Type

TYP_ML

MEDLINE

TYP_AA

Amino Acid Sequence

TYP_NT

Nucleotide Sequence

TYP_SEQ

Either Sequence Type

#define

Field

FLD_WORD

Text words

FLD_MESH

MeSH terms

FLD_KYWD

Keywords

FLD_AUTH

Author Names

FLD_JOUR

Journal Names

FLD_ORGN

Organism Names

FLD_ACCN

Accession numbers, locus names, patent ids...

FLD_GENE

Gene Symbols

FLD_PROT

Protein Names

FLD_ECNO

E.C. numbers

  #include <accentr.h>

  ValNodePtr  elst;

  Int2        group;

  Int4        i;

  Int2        last;

  LinkSetPtr  lsp;

  DocUid      uid;

  group = 0;

  last = 0;

  while (MORE_QUERIES) {

    elst = EntrezTLNew (TYPE);

    while (GET_NEXT_TERM ()) {

      if (GROUP_SINGLE || GROUP_FIRST) {

        group++;

      }

      if (last == 0) {

        EntrezTLAddLParen (elst);

      } else if (last == group) {

        EntrezTLAddOR (elst);

      } else {

        EntrezTLAddRParen (elst);

        EntrezTLAddAND (elst);

        EntrezTLAddLParen (elst);

      }

      EntrezTLAddTerm (elst, TERM, TYPE, FIELD, STATE_SPECIAL);

      last = group;

    }

    lsp = EntrezTLEval (elst);

    EntrezTLFree (elst);

    for (i = 0; i < lsp->num; i++) {

      uid = lsp->uids [i];

      /* Do something with the uid. */

    }

    LinkSetFree (lsp);

  }

Loading a Sequence Record

Given a UID, SeqEntryGet will find the record on the CD-ROM, open an AsnIo channel at that location, call the object loader, and return a pointer to the SeqEntry.  The retcode parameter determines the maximum level of complexity of the loaded sequence object (BioSeq, SegSet or NucProtSet).

  #include <accentr.h>

  #include <objsset.h>

  Int2         retcode;

  SeqEntryPtr  sep;

  switch (complexity) {

    case BIOSEQ :

      retcode = SEQENTRY_READ_BIOSEQ;

      break;

    case SEGSET :

      retcode = SEQENTRY_READ_SEG_SET;

      break;

    case NUCPROT :

      retcode = SEQENTRY_READ_NUC_PROT;

      break;

  }

  sep = EntrezSeqEntryGet (uid, retcode);

  /* Do something with the sep. */

  SeqEntryFree (sep);

Loading a MEDLINE Record

Given a UID, MedlineEntryGet will find the record on the CD-ROM, open an AsnIo channel at that location, call the object loader, and return a pointer to the MedlineEntry:

  #include <accentr.h>

  #include <objmedli.h>

  MedlineEntryPtr  mep;

  mep = EntrezMedlineEntryGet (uid);

  /* Do something with the mep. */

  MedlineEntryFree (mep);

Streaming Through All of the Data Records

All sequence or MEDLINE records can be examined by streaming through thedata files.  Each data file in the sequence or medline directories on the CD-ROM need to be opened and read separately. The data on the Entrez CD-ROM has undergone Huffman compression. The casn routines used here do the Huffman decompression for you. A program in the \demo directory called asndhuff.c shows various was to decompress the data continuously. The data can be read a complete entry at a time into memory, as show below, or as an ASN.1 stream from which lower level data elements can be selected as shown in asndhuff.c.

  #include <casn.h>

  #include <objmedli.h>

  #include <objsset.h>

  CASN_Handle      casnh;

  Char             filename [FILENAME_MAX];

  Int2             i;

  MedlineEntryPtr  mep;

  Char             path [PATH_MAX];

  SeqEntryPtr      sep;

  Int4             total;

  for (i = 1; i <= 21; i++) {

    if (i < 10) {

      sprintf (filename, "seqasn.00%d", (int) i);

    } else {

      sprintf (filename, "seqasn.0%d", (int) i);

    }

    StringCpy (path, "SEQDATA:sequence:");

    FileBuildPath (path, NULL, filename);

    if ((casnh= CASN_Open (path)) != NULL) {

      total = CASN_DocCount (casnh);

      if (CASN_DocType (casnh) == CASN_TypSeq) {

        while ((sep = CASN_NextSeqEntry (casnh)) != NULL) {

          /* Do something with the sep. */

          SeqEntryFree (sep);

        }

      }

      CASN_Close (casnh);

    }

  }

  for (i = 1; i <= 10; i++) {

    if (i < 10) {

      sprintf (filename, "medasn.00%d", (int) i);

    } else {

      sprintf (filename, "medasn.0%d", (int) i);

    }

    StringCpy (path, "REFDATA:medline:");

    FileBuildPath (path, NULL, filename);

    if ((casnh= CASN_Open (path)) != NULL) {

      total = CASN_DocCount (casnh);

      if (CASN_DocType (casnh) == CASN_TypMed) {

        while ((mep = CASN_NextMedlineEntry(casnh)) != NULL) {

          /* Do something with the mep. */

          MedlineEntryFree (mep);

        }

      }

      CASN_Close (casnh);

    }

  }

Converting to FASTA Format

A loaded sequence record can be converted to and saved in FASTA format:

  #include <tofasta.h>

  #include <sequtil.h>

  FILE  *fp;

  fp = FileOpen (str, "w");

  SeqEntryConvert (sep, Seq_code_iupacna);

  SeqEntryToFasta (sep, fp, is_na);

  FileClose (fp);

Converting GenBank Format

A loaded sequence record can be converted to and saved in GenBank flat file format:

  #include <togenbnk.h>

  #include <asn.h>

  FILE          *fp;

  AsnOptionPtr  opt;

  DataVal       val;

  fp = FileOpen (str, "w");

  optionHead = NULL;

  val.intvalue = TRUE;

  AsnOptionNew (&opt, OP_TOGENBNK, OP_TOGENBNK_QUIET, val, NULL);

  AsnOptionNew (&opt, OP_TOGENBNK, OP_TOGENBNK_NO_NCBI, val, NULL);

  val.ptrvalue = StringSave ("\?\?\?");

  AsnOptionNew (&opt, OP_TOGENBNK, OP_TOGENBNK_DIV, val,

                (AsnOptFreeFunc) MemFree);

  val.ptrvalue = StringSave ("\?\?-\?\?\?-\?\?\?\?");

  AsnOptionNew (&opt, OP_TOGENBNK, OP_TOGENBNK_DATE, val,

                (AsnOptFreeFunc) MemFree);

  AsnOptionNew (&opt, OP_TOGENBNK, OP_TOGENBNK_RELEASE, val, NULL);

  if (IsGenBank (sep)) {

    SeqEntryToGenbank (fp, sep, opt);

  }

  AsnOptionFree (&opt, OP_TOGENBNK, 0);

  FileClose (fp);

Converting to MEDLARS Format

A loaded MEDLINE record can be converted to and saved in MEDLARS format:

  #include <tomedlin.h>

  FILE  *fp;

  fp = FileOpen (str, "w");

  MedlineEntryToDataFile (mep, fp);

  FileClose (fp);

Loading a Document Summary

Given a UID and a type, EntrezDocSum will return a document summary for a record.  TYPE is TYP_ML, TYP_AA, TYP_NT, or TYP_SEQ:

  #include <accentr.h>

  DocSumPtr  dsp;

  dsp = EntrezDocSum (TYPE, uid);

  /* Do something with the dsp. */

  DocSumFree (dsp);

Loading a Set of Document Summaries

Given a list of UIDs and a type, EntrezDocSumListGet will call a callback for each document summary.  If the callback returns FALSE, then remaining DocSums may be cached locally for subsequent retrieval by EntrezDocSum:

  #include <accentr.h>

  static Boolean DocSumProc (DocSumPtr dsp, DocUid uid)

  {

    /* Do something with the docsum. */

    DocSumFree (dsp);

    return TRUE;

  }

For EntrezDocSumListGet, NUM is the number of DocSums desired, UIDs is a DocUid array of of length NUM, and TYPE is TYP_ML, TYP_AA, TYP_NT, or TYP_SEQ:

 EntrezDocSumListGet (NUM, TYPE, UIDs, DocSumProc);

Retreiving Neighbors and Links

Neighbors and links are precomputed and stored on the Entrez CD-ROM. See the Entrez documentation for an explanation of what neighbors and links are.

 #include <accentr.h>

  #include <objacces.h>

  LinkSetPtr  lsp;

  DocUid      uid;

  lsp= EntrezUidLinks (FIELD, uid, LINK_TO_FIELD);

  for (i = 0; i < lsp->num; i++) {

    uid = lsp->uids [i];

    /* Do something with the uid. */

  }

  LinkSetFree (lsp);

C Structures and Functions: accentr.h

/*   accentr.h

* ===========================================================================

*

*                            PUBLIC DOMAIN NOTICE                          

*               National Center for Biotechnology Information

*                                                                         

*  This software/database is a "United States Government Work" under the  

*  terms of the United States Copyright Act.  It was written as part of   

*  the author's official duties as a United States Government employee and

*  thus cannot be copyrighted.  This software/database is freely available

*  to the public for use. The National Library of Medicine and the U.S.   

*  Government have not placed any restriction on its use or reproduction. 

*                                                                         

*  Although all reasonable efforts have been taken to ensure the accuracy 

*  and reliability of the software and data, the NLM and the U.S.         

*  Government do not and cannot warrant the performance or results that   

*  may be obtained by using this software or data. The NLM and the U.S.   

*  Government disclaim all warranties, express or implied, including      

*  warranties of performance, merchantability or fitness for any particular

*  purpose.                                                               

*                                                                          

*  Please cite the author in any work or product based on this material.  

*

* ===========================================================================

*

* File Name:  accentr.h

*

* Author:  Ostell

*

* Version Creation Date:   4/23/92

*

* $Revision: 1.2 $

*

* File Description:

*       entrez index access library for Entrez

*

* Modifications: 

* --------------------------------------------------------------------------

* Date     Name        Description of modification

* -------  ----------  -----------------------------------------------------

*

* ==========================================================================

*/

#ifndef _ACCENTR_

#define _ACCENTR_

#ifndef _NCBI_Seqset_

#include <objsset.h>

#endif

#ifndef _NCBI_Medline_

#include <objmedli.h>

#endif

#ifndef _NCBI_Access_

#include <objacces.h>

#endif

#ifdef __cplusplus

extern "C" {

#endif

/* --- Type Definitions --- */

typedef Int4  DocUid;

typedef Int4Ptr DocUidPtr;

typedef Int2   DocType;

typedef Int2   DocField;

typedef struct fielddata {

    Int4    num_terms;                /* number of terms in this field */

    Int2    num_bucket;           /* number of buckets of terms */

} EntrezFieldData, PNTR EntrezFieldDataPtr;

typedef struct typedata {

    Int4    num;                   /* number of entries */

    Int4    num_uids;                  /* number of uids */

    DocUid  minuid;                /* minimum uid for this type */

    DocUid  maxuid;                /* maxuid for this type */

    Int2    num_bucket;            /* number of uid buckets */

    EntrezFieldDataPtr fields;

} EntrezTypeData, PNTR EntrezTypeDataPtr;

typedef struct _EntrezInfo {

    CharPtr volume_label;

    Int2    version;

    Int2    issue;

    Int2    format;

    CharPtr descr;

    Boolean no_compression;

    Int2    huff_count;

    Int2Ptr huff_left;

    Int2Ptr huff_right;

    Int2    type_count;

    CharPtr PNTR type_names;

    Int2    type_bucket_size;

    Int2    field_count;

    CharPtr PNTR field_names;

    Int2    field_bucket_size;

    EntrezTypeDataPtr types;

} EntrezInfo, PNTR EntrezInfoPtr;

/*****************************************************************************

*

*   PreDefined Entrez types and fields

*

*****************************************************************************/

/* doc type codes */

#define NTYPE       3   /* number of types == 3 */

#define TYP_ML      0   /*  Medline-entry */

#define TYP_AA      1   /*  amino acid data   */

#define TYP_NT      2   /*  nucleic acid data */

#define TYP_SEQ     4   /*  either aa or na used only for uid lookups */

/* field codes */

#define NFLD        10  /* number of fields == 10 */

#define FLD_WORD    0   /*  Words           */

#define FLD_MESH    1   /*  MeSH terms      */

#define FLD_KYWD    2   /*  Keyword         */

#define FLD_AUTH    3   /*  Authors         */

#define FLD_JOUR    4   /*  Journal title   */

#define FLD_ORGN    5   /*  Organism        */

#define FLD_ACCN    6   /*  Accession number */

#define FLD_GENE    7   /*  Gene Symbol     */

#define FLD_PROT    8   /*  Protein name    */

#define FLD_ECNO    9   /*  E.C. number     */

typedef struct docsum {

    DocUid uid;

    Boolean no_abstract,

        translated_title,

        no_authors;

    CharPtr caption,

        title;

} DocSum, PNTR DocSumPtr;

typedef Boolean (*DocSumListCallBack) PROTO((DocSumPtr dsp, DocUid uid));

#define NULLSYM     0     /* for building booleans */

#define LPAREN      1

#define RPAREN      2

#define ANDSYMBL    3

#define ORSYMBL     4

#define BUTNOTSYMBL 5

#define SPECIALTERM 6

#define TOTALTERM   7

/**** Initialize and close session *********************/

/* Note:                                                                      */

/*   In October 1993, EntrezInit() will be replaced by the functionality of   */

/*   EntrezInitWithExtras(), and EntrezInitWithExtras(), in turn, will be     */

/*   temporarily defined as a macro version of EntrezInit().                  */

/*   I.e., in October 1993, this code will read as follows:                   */

/*     #define EntrezInitWithExtras(a,b,c)   EntrezInit(a,b,c)                */

/*     extern Boolean _cdecl EntrezInit PROTO((CharPtr appl_id,               */

/*         Boolean no_warnings, BoolPtr is_network));                         */

/*                                                                            */

/*   In the Spring of 1994, the EntrezInitWithExtras() macro will be deleted. */

/*                                  - J. Epstein, 8 June 1993                 */

#define EntrezInit()             EntrezInitWithExtras(NULL, FALSE, NULL)

Boolean LIBCALL EntrezInitWithExtras PROTO((CharPtr appl_id, Boolean no_warnings, BoolPtr is_network));

void LIBCALL EntrezFini PROTO((void));

/**** Get names and numbers of fields and types ********/

EntrezInfoPtr LIBCALL EntrezGetInfo PROTO((void));

EntrezInfoPtr LIBCALL EntrezInfoAsnRead PROTO((AsnIoPtr aip, AsnTypePtr orig));

EntrezInfoPtr LIBCALL EntrezInfoFree PROTO((EntrezInfoPtr cip));

/**** Creates a term node from the uid parameter ********/

void LIBCALL EntrezCreateNamedUidList PROTO((CharPtr term, DocType type, DocField field, Int4 num, DocUidPtr uids));

/**** Used only by Entrez network server ***************/

Boolean LIBCALL EntrezInfoAsnWrite PROTO((EntrezInfoPtr p, AsnIoPtr aip, AsnTypePtr orig));

/**** Get detailed text information about the current status *****/

CharPtr LIBCALL EntrezDetailedInfo PROTO((void));

/**** Get Links and Neighbors **************************/

Int4 LIBCALL EntrezGetMaxLinks PROTO((void));

Int4 LIBCALL EntrezSetUserMaxLinks PROTO((Int4 usermax));

Int4 LIBCALL EntrezGetUserMaxLinks PROTO((void));

LinkSetPtr LIBCALL EntrezUidLinks PROTO((DocType type, DocUid uid, DocType link_to_type));

Int2 LIBCALL EntrezLinkUidList PROTO((LinkSetPtr PNTR result, DocType type,

   DocType link_to_type, Int2 numuid, Int4Ptr uids, Boolean mark_missing));

/**** Get Summaries ************************************/

DocSumPtr LIBCALL EntrezDocSum PROTO((DocType type, DocUid uid));

DocSumPtr LIBCALL DocSumFree PROTO((DocSumPtr dsp));

Int2 LIBCALL EntrezDocSumListGet PROTO((Int2 numuid, DocType type, DocUidPtr uids, DocSumListCallBack callback));

Int2 LIBCALL EntrezMlSumListGet PROTO((DocSumPtr PNTR result, Int2 numuid, Int4Ptr uids));

Int2 LIBCALL EntrezSeqSumListGet PROTO((DocSumPtr PNTR result, Int2 numuid, Int4Ptr uids));

/**** Get Term Lists ***********************************/

typedef Boolean (*TermListProc) PROTO((CharPtr term, Int4 special, Int4 total));

Int2 LIBCALL EntrezTermListByPage PROTO((DocType type, DocField field, Int2 page, Int2 numpage, TermListProc proc));

Int2 LIBCALL EntrezTermListByTerm PROTO((DocType type, DocField field, CharPtr term, Int2 numterms, TermListProc proc, Int2Ptr first_page));

Boolean LIBCALL EntrezFindTerm PROTO((DocType type, DocField field, CharPtr term, Int4Ptr spcl, Int4Ptr totl));

/**** Look up terms with Boolean operations ************/

ValNodePtr LIBCALL EntrezTLNew PROTO((DocType type));

ValNodePtr LIBCALL EntrezTLAddTerm PROTO((ValNodePtr elst, CharPtr term, DocType type, DocField field, Boolean special));

ValNodePtr LIBCALL EntrezTLAddLParen PROTO((ValNodePtr elst));

ValNodePtr LIBCALL EntrezTLAddRParen PROTO((ValNodePtr elst));

ValNodePtr LIBCALL EntrezTLAddAND PROTO((ValNodePtr elst));

ValNodePtr LIBCALL EntrezTLAddOR PROTO((ValNodePtr elst));

ValNodePtr LIBCALL EntrezTLAddBUTNOT PROTO((ValNodePtr elst));

ValNodePtr LIBCALL EntrezTLFree PROTO((ValNodePtr elst));

LinkSetPtr LIBCALL EntrezTLEval PROTO((ValNodePtr elst));

/**** Look Up a Uid from a SeqId using the Terms list ****/

Int4 LIBCALL EntrezFindSeqId PROTO((SeqIdPtr sip));

/**** Get Sequence or MEDLINE data **********************/

Int2 LIBCALL EntrezSeqEntryListGet PROTO((SeqEntryPtr PNTR result, Int2 numuid, Int4Ptr uids, Int2 retcode, Boolean mark_missing));

SeqEntryPtr LIBCALL EntrezSeqEntryGet PROTO((Int4 uid, Int2 retcode));

Int2 LIBCALL EntrezMedlineEntryListGet PROTO((MedlineEntryPtr PNTR result, Int2 numuid, Int4Ptr uids, Boolean mark_missing));

MedlineEntryPtr LIBCALL EntrezMedlineEntryGet PROTO((Int4 uid));

#ifdef __cplusplus

}

#endif

#endif

C Structures and Functions: casn.h

/* casn.h

* ===========================================================================

*

*                            PUBLIC DOMAIN NOTICE                         

*               National Center for Biotechnology Information

*                                                                         

*  This software/database is a "United States Government Work" under the  

*  terms of the United States Copyright Act.  It was written as part of   

*  the author's official duties as a United States Government employee and

*  thus cannot be copyrighted.  This software/database is freely available

*  to the public for use. The National Library of Medicine and the U.S.   

*  Government have not placed any restriction on its use or reproduction. 

*                                                                         

*  Although all reasonable efforts have been taken to ensure the accuracy 

*  and reliability of the software and data, the NLM and the U.S.          

*  Government do not and cannot warrant the performance or results that   

*  may be obtained by using this software or data. The NLM and the U.S.   

*  Government disclaim all warranties, express or implied, including      

*  warranties of performance, merchantability or fitness for any particular

*  purpose.                                                               

*                                                                         

*  Please cite the author in any work or product based on this material.  

*

* ===========================================================================

*

* File Name: casn.h

*

* Author:  Greg Schuler

*

* Version Creation Date: 9/23/92

*

* $Revision: 1.2 $

*

* File Description:

   functions to decompress a compressed ASN,1 (CASN) file.

*

* Modifications: 

* --------------------------------------------------------------------------

* Date     Name        Description of modification

* -------  ----------  -----------------------------------------------------

* 04-21-93 Schuler     CASN_ReadBuff declared as LIBCALLBACK

* 06-28-93 Schuler     New function:  CASN_Seek()

*

* ==========================================================================

*/

#ifndef __CompressedASN1__

#define __CompressedASN1__

#include <objsset.h>

#ifdef _cplusplus

extern "C" {

#endif

enum CASN_Error      {

   CASN_ErrNone,                  /* no error */

   CASN_ErrGeneric,        /* general error, not one listed below */

   CASN_ErrMemory,                /* memory allocation failed */

   CASN_ErrBadHandle,             /* CASN_Handle is invalid or corrupt */

   CASN_ErrFileOpen,              /* unable to open file for reading */

   CASN_ErrFileCreate,            /* unable to open file for writing */

   CASN_ErrFileRead,              /* unable to read from open file */

   CASN_ErrFileWrite,             /* unable to write to open file */

   CASN_ErrFileSeek,              /* either seek or tell failed */

   CASN_ErrFileFormat };   /* file format not recognized, or file corrupt */

enum CASN_DocType    {

   CASN_TypeMed     = 1,   /* MEDLINE record (ASN.1 type Medline-entry)*/

   CASN_TypeSeq     = 2 }; /* Sequence record (ASN.1 type Seq-entry)*/

struct casn_ioblock;

typedef struct casn_ioblock *CASN_Handle;

/* ----- high-level ----- */

CASN_Handle     LIBCALL  CASN_Open PROTO((CharPtr fname));

void            LIBCALL  CASN_Close PROTO((CASN_Handle handle));

AsnIoPtr        LIBCALL  CASN_GetAsnIoPtr PROTO((CASN_Handle handle));

Int2            LIBCALL  CASN_DocType PROTO((CASN_Handle handle));

Int4            LIBCALL  CASN_DocCount PROTO((CASN_Handle handle));

MedlineEntryPtr LIBCALL  CASN_NextMedlineEntry PROTO((CASN_Handle handle));

SeqEntryPtr     LIBCALL  CASN_NextSeqEntry PROTO((CASN_Handle handle));

int             LIBCALL  CASN_Seek PROTO((CASN_Handle,long offset,int origin));

/* ----- low-level ----- */

CASN_Handle LIBCALL  CASN_New PROTO((Int2 doc_type, Int2 huff_count));

void        LIBCALL  CASN_Free PROTO((CASN_Handle));

#ifdef _cplusplus

}

#endif

#endif


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4