first previous next last contents

Basic Gap4 I/O

These functions consist of both basic functions for reading, writing and creation of database items and simple I/O functions that build upon such operations. They are mainly contained within the `Gap4/IO.c' file.

The return codes do vary greatly from function to function. Most return 0 for success and -1 for failure. However some will return other codes. In general it is best to check equality to the success code rather than equality to a specific failure code.

and read as an array of GCardinals. elements indicates the number of array elements and not the size of the array in bytes.

BitmapRead reads records of type GT_Bitmap. The bitmap is allocated by this function. elements indicates the number of bits and not the size of the bitmap in bytes.

GT_Write, GT_Write_cached, TextWrite, DataWrite, ArrayWrite, BitmapWrite

#include <IO.h>

int GT_Write(
        GapIO  *io,
        int     rec,
        void   *buf,
        int     len,
        GCardinal type);

int GT_Write_cached(
        GapIO  *io,
        int     read,
        GReadings *r);

int TextWrite(
        GapIO  *io,
        int     rec,
        char   *buf,
        int     len);

int DataWrite(
        GapIO  *io,
        int     rec,
        void   *buf,
        int     len,
        int     size);

int ArrayWrite(
        GapIO  *io,
        int     rec,
        int     elements,
        Array   a);

int BitmapWrite(
        GapIO  *io,
        int     rec,
        Bitmap  b);

These functions write record number rec with the appropriate data type. They return zero for success and an error code for failure.

GT_Write writes arbitrary records of type type. This is usually a structure. Do not use this function for writing GReadings structures. For best compatibility, use the contig_write, gel_write, tag_write, vector_write and clone_write function.

GT_Write_cached is an interface to GT_Write which also updates the in-memory reading cache. For best compatibility, use the gel_write function.

TextWrite writes a record of type GT_Text. It is used to write text only strings.

DataWrite writes a record of type GT_Data. It is used to write binary data such as sequence confidence values.

ArrayWrite writes a record of type GT_Array. The array must be an array of GCardinal values. elements indicates the number of array elements and not the size of the array in bytes.

BitmapWrite writes a record of type GT_Bitmap. elements indicates the number of bits and not the size of the bitmap in bytes.

io_handle and handle_io

#include <IO.h>

GapIO *io_handle(
        f_int *handle);

f_int *handle_io(
        GapIO *io);

These two routines convert between GapIO pointers and integer handles. Both the Fortran and Tcl code uses integer handles due to no support for structures.

io_handle takes a pointer to an integer handle and returns the associated GapIO pointer. It returns NULL for failure.

handle_io takes a GapIO pointer and returns a pointer to a integer handle. It returns NULL for failure.


first previous next last contents
This page is maintained by staden-package. Last generated on 1 March 2001.
URL: http://www.mrc-lmb.cam.ac.uk/pubseq/manual/scripting_122.html