first previous next last contents

IO.h Macros

There are many C macros defined to interact with the GapIO structure. These both simplify and improve readeability of the code and also provide a level of future proofing. Where the macros are available it is always advisable to use these instead of accessing the GapIO structure directly.

Note that not all of these macros are actually held within the `IO.h' file, rather some are in files included by `IO.h'. However whenever wishing to use one of these macros you should still use "#include <IO.h>".

io_dbsize(io)
io->db.actual_db_size

The maximum number of readings plus contigs allowed.

max_gel_len(io)
(io)->max_gel_len

The maximum reading length.

NumContigs(io)
(io)->db.num_contigs

The number of used contigs.

NumReadings(io)
(io)->db.num_readings

The number of used readings.

Ncontigs(io)
(io)->db.Ncontigs

The number of allocated contigs.

Nreadings(io)
(io)->db.Nreadings

The number of allocated readings.

Nannotations(io)
(io)->db.Nannotations

The number of allocated annotations.

Ntemplates(io)
(io)->db.Ntemplates

The number of annotated templates.

Nclones(io)
(io)->db.Nclones

The number of allocated clones.

Nvectors(io)
(io)->db.Nvectors

The number of allocated vectors.

io_relpos(io,g)
(io)->relpos[(g)]

The position of a reading g.

io_length(io,g)
(io)->length[(g)]

The length of a reading g. If the reading is complemented this value is negative, but still represents the length.

io_lnbr(io,g)
(io)->lnbr[(g)]

The reading number of the left neighbour of reading g.

io_rnbr(io,g)
(io)->rnbr[(g)]

The reading number of the right neighbour of reading g.

io_clength(io,c)
(io)->relpos[io_dbsize(io)-(c)]

The length of contig c.

io_clnbr(io,c)
(io)->lnbr[io_dbsize(io)-(c)]

The leftmost reading number of contig c.

io_crnbr(io,c)
(io)->rnbr[io_dbsize(io)-(c)]

The rightmost reading number of contig c.

io_name(io)
(io)->db_name

The database name.

io_rdonly(io)
This returns 1 when the database has been opened as read-only; 0 otherwise.
io_rname(io,g)
This returns the reading name for reading number g. This is fetched from the in memory cache.
io_wname(io,g,n)
Sets the in-memory copy of the reading name for reading number g to be the string n. This does not write to disk.
PRIMER_TYPE(r)
This returns the type of the primer used for sequencing reading number r. This information is calculated from the primer and strand fields of the GReadings structure. It returns one of GAP_PRIMER_UNKNOWN, GAP_PRIMER_FORWARD, GAP_PRIMER_REVERSE, GAP_PRIMER_CUSTFOR and GAP_PRIMER_CUSTREV.
PRIMER_TYPE_GUESS(r)
As PRIMER_TYPE except always choose a sensible guess in place of GAP_PRIMER_UNKNOWN.
STRAND(r)
Returns the strand (one of GAP_STRAND_FORWARD or GAP_STRAND_REVERSE) from the primer information for reading number r. The reason for these primer and strand macros is that the meaning of the primer and strand fields of GReadings has changed slightly from early code in that we now make a distinction between custom forward primers and custom reverse primers. The strand field may become completely redundant in future as it can now be derived entirely from the primer.
contig_read(io, cn, c)
gel_read(io, gn, g)
tag_read(io, tn, t)
vector_read(io, vn, v)
clone_read(io, cn, c)
Reads one of the basic database structures. For contigs, contig_read reads contig number cn and stores in the GContigs structure named c. Eg to read the a contig:
	GContigs c;
	contig_read(io, contig_num, c);
This is functionally equivalent to:
	GContigs c;
	GT_Read(io, arr(GCardinal, io->contigs, contig_num-1),
		&c, sizeof(c), GT_Contigs);
The exception to this is gel_read which reads from a cached copy held in memory.
contig_write(io, cn, c)
gel_write(io, gn, g)
tag_write(io, tn, t)
vector_write(io, vn, v)
clone_write(io, cn, c)
Writes one of the basic types in a similar fashion to the read functions. To write to annotation number anno we should use:
	GAnnotations a;
	/* ... some code to manipulate 'a' ... */
	tag_write(io, anno, a);	       
This is functionally equivalent to:
	GT_Write(io, arr(GCardinal, io->annotations, anno-1),
		 &a, sizeof(a), GT_Annotations);
Note that the gel_write function must be used instead of GT_Write as gel_write will also update the reading memory cache.

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_121.html