gnBaseSource defines a standard interface for derived classes to provide access to file, database, and network sources of genetic data.
First the data source is opened and parsed, using the open() function. The source class then creates and a gnGenomeSpec containing references to its sequence data. The gnGenomeSpec can then be used by gnSequence to give programmer friendly access to the sequence data.
Opens the source given in "openString" for reading.
Parameters:
openString
The name of the source (file, network URL, or database) to open.
Exceptions:
Will
throw a FileNotOpened exception if the file was not found or was not accessible. Will propagate a FileUnreadable exception if the file format was invalid.
Read will attempt to read "bufLen" bytes starting at "pos" directly from the source. It stores the data in "buf", and returns the actual number of bytes read in bufLen. Read will return false if a serious error occurs.
SeqRead will attempt to read "bufLen" base pairs starting at "start", an offset into the sequence. Reading inside a specific contig can be accomplished by supplying the "contigI" parameter with a valid contig index. SeqRead stores the sequence data in "buf" and returns the actual number of bases read in "bufLen". SeqRead will return false if a serious error occurs.
Parameters:
start
The base pair to start reading at.
buf
The character array to store base pairs into.
len
The number of base pairs to read.
contigI
The index of the contig to read or ALL_CONTIGS by default.