Google

Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

gnBaseSource Class Reference

gnBaseSource defines a standard interface for derived classes to provide access to file, database, and network sources of genetic data. More...

#include <gnBaseSource.h>

Inheritance diagram for gnBaseSource::

gnClone gnDataBaseSource gnFileSource gnABISource gnDNXSource gnFASSource gnGBKSource gnRAWSource gnSEQSource List of all members.

Public Methods

 gnBaseSource ()
virtual ~gnBaseSource ()
 Destructor, frees memory used by this source class. More...

virtual gnBaseSource* Clone () const=0
virtual void Open (string openString)=0
 Opens the source given in "openString" for reading. More...

virtual void Open ()=0
 Opens this source for reading. More...

virtual void Close ()=0
 Closes the file or connection this source is reading from. More...

virtual string GetOpenString () const=0
 Get the location of the source that is being used. More...

virtual uint32 GetContigListLength () const=0
 Get the number of sequence contigs in this source. More...

virtual boolean HasContig (const string &name) const=0
 Looks for a contig by name. More...

virtual uint32 GetContigID (const string &name) const=0
 Get a contig index by name. More...

virtual string GetContigName (const uint32 i) const=0
 Get the name of the specified contig. More...

virtual gnSeqI GetContigSeqLength (const uint32 i) const=0
 Get the total number of base pairs in the specified contig. More...

virtual const gnFilterGetFilter () const=0
 Get the filter currently being used to filter unwanted characters out of read sequences. More...

virtual void SetFilter (gnFilter *filter)=0
 Set the filter that will be used to filter unwanted characters out of the sequence data. More...

virtual boolean Read (const uint64 pos, char *buf, uint32 &len)=0
 Gets raw input from this source. More...

virtual boolean SeqRead (const gnSeqI start, char *buf, uint32 &bufLen, const uint32 contigI=ALL_CONTIGS)=0
 Gets sequence data from this source. More...

virtual gnGenomeSpecGetSpec () const=0
 Get the annotated sequence data as a gnGenomeSpec. More...


Detailed Description

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.

Definition at line 32 of file gnBaseSource.h.


Constructor & Destructor Documentation

gnBaseSource::gnBaseSource ( ) [inline]
 

Definition at line 35 of file gnBaseSource.h.

gnBaseSource::~gnBaseSource ( ) [inline, virtual]
 

Destructor, frees memory used by this source class.

Definition at line 39 of file gnBaseSource.h.


Member Function Documentation

gnBaseSource * gnBaseSource::Clone ( ) const [pure virtual]
 

Reimplemented from gnClone.

Reimplemented in gnABISource, gnDataBaseSource, gnDataBaseSource, gnDNXSource, gnFASSource, gnFileSource, gnGBKSource, gnRAWSource, and gnSEQSource.

Referenced by gnSourceFactory::AddSource(), gnSourceFactory::SetDefaultSourceClass(), and gnSourceFactory::SetSourceClass().

void gnBaseSource::Close ( ) [pure virtual]
 

Closes the file or connection this source is reading from.

Exceptions:
IOStreamError   if an error occurs closing the file.

Reimplemented in gnDataBaseSource, and gnFileSource.

Referenced by gnSourceFactory::DelSource().

uint32 gnBaseSource::GetContigID ( const string & name ) const [pure virtual]
 

Get a contig index by name.

If the source does not contain a contig by the specified name GetContigID returns UINT32_MAX.

Parameters:
name   The name of the contig to look for.
Returns:
The index of the named contig or UINT32_MAX.

Reimplemented in gnABISource, gnDataBaseSource, gnDNXSource, gnFASSource, gnGBKSource, gnRAWSource, and gnSEQSource.

Referenced by gnDNXSource::ParseStream().

uint32 gnBaseSource::GetContigListLength ( ) const [pure virtual]
 

Get the number of sequence contigs in this source.

Returns:
The number of contigs in this source.

Reimplemented in gnABISource, gnDataBaseSource, gnDNXSource, gnFASSource, gnGBKSource, gnRAWSource, and gnSEQSource.

Referenced by gnFASSource::Write().

string gnBaseSource::GetContigName ( const uint32 i ) const [pure virtual]
 

Get the name of the specified contig.

Returns an empty string if the specified contig is out of range.

Parameters:
i   The index of the contig or ALL_CONTIGS.
Returns:
The name of the contig or an empty string.

Reimplemented in gnABISource, gnDataBaseSource, gnDNXSource, gnFASSource, gnGBKSource, gnRAWSource, and gnSEQSource.

Referenced by gnFASSource::Write().

gnSeqI gnBaseSource::GetContigSeqLength ( const uint32 i ) const [pure virtual]
 

Get the total number of base pairs in the specified contig.

Parameters:
i   The index of the contig or ALL_CONTIGS.
Returns:
The length in base pairs of the specified contig.

Reimplemented in gnABISource, gnDataBaseSource, gnDNXSource, gnFASSource, gnGBKSource, gnRAWSource, and gnSEQSource.

Referenced by gnSourceSpec::GetSourceLength(), gnFASSource::Write(), and gnSourceSpec::gnSourceSpec().

const gnFilter * gnBaseSource::GetFilter ( ) const [pure virtual]
 

Get the filter currently being used to filter unwanted characters out of read sequences.

Returns:
A pointer to the gnFilter currently in use.

Reimplemented in gnDataBaseSource, and gnFileSource.

string gnBaseSource::GetOpenString ( ) const [pure virtual]
 

Get the location of the source that is being used.

Returns:
The location string describing this source, usually a file name.

Reimplemented in gnDataBaseSource, and gnFileSource.

gnGenomeSpec * gnBaseSource::GetSpec ( ) const [pure virtual]
 

Get the annotated sequence data as a gnGenomeSpec.

GetSpec returns a gnGenomeSpec which contains the sequence, header, and feature data contained by this source.

Returns:
The annotated sequence data.

Reimplemented in gnABISource, gnDataBaseSource, gnDNXSource, gnFASSource, gnGBKSource, gnRAWSource, and gnSEQSource.

Referenced by gnSequence::LoadSource(), gnSEQSource::Write(), gnRAWSource::Write(), gnGBKSource::Write(), and gnDNXSource::Write().

boolean gnBaseSource::HasContig ( const string & name ) const [pure virtual]
 

Looks for a contig by name.

Returns true if it finds the contig, otherwise false.

Parameters:
name   The name of the contig to look for.
Returns:
True if the named contig exists, false otherwise.

Reimplemented in gnABISource, gnDataBaseSource, gnDNXSource, gnFASSource, gnGBKSource, gnRAWSource, and gnSEQSource.

void gnBaseSource::Open ( ) [pure virtual]
 

Opens this source for reading.

Exceptions:
Will   throw a FileNotOpened exception if the file was not found or was not accessible.

Reimplemented in gnDataBaseSource, and gnFileSource.

Referenced by gnSourceFactory::AddSource().

void gnBaseSource::Open ( string openString ) [pure virtual]
 

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.

Reimplemented in gnDataBaseSource, and gnFileSource.

boolean gnBaseSource::Read ( const uint64 pos,
char * buf,
uint32 & bufLen ) [pure virtual]
 

Gets raw input from this source.

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.

Parameters:
pos   The position in the file to start reading.
buf   The character array to store data into.
len   The number of bytes to read.
Returns:
True if the operation was successful.

Reimplemented in gnDataBaseSource, and gnFileSource.

Referenced by gnSourceHeader::GetHeader(), and gnSourceQualifier::GetValue().

boolean gnBaseSource::SeqRead ( const gnSeqI start,
char * buf,
uint32 & bufLen,
const uint32 contigI = ALL_CONTIGS ) [pure virtual]
 

Gets sequence data from this source.

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.
Returns:
True if the operation was successful.

Reimplemented in gnABISource, gnDataBaseSource, gnDNXSource, gnFASSource, gnGBKSource, gnRAWSource, and gnSEQSource.

Referenced by gnSourceSpec::Read(), and gnFASSource::Write().

void gnBaseSource::SetFilter ( gnFilter * filter ) [pure virtual]
 

Set the filter that will be used to filter unwanted characters out of the sequence data.

Parameters:
filter   The filter to remove unwanted characters from the sequence.
Exceptions:
NullPointer   is thrown if the specified filter pointer is null.

Reimplemented in gnDataBaseSource, and gnFileSource.


The documentation for this class was generated from the following file:
Generated at Fri Nov 30 15:36:53 2001 for libGenome by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001