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

# gnGBKSource Class Reference

gnGBKSource is a GenBank sequence file reader. More...

`#include <gnGBKSource.h>`

Inheritance diagram for gnGBKSource::

List of all members.

## Public Methods
| gnGBKSource ()
| Empty Constructor, does nothing. More...
| gnGBKSource (const gnGBKSource &s)
| Clone Constructor copies the specified gnGBKSource. More...
| ~gnGBKSource ()
| Destructor, frees memory. More...
gnGBKSource* | Clone () const
| Returns an exact copy of this class. More...
uint32 | GetContigListLength () const
| Get the number of sequence contigs in this source. More...
boolean | HasContig (const string &name) const
| Looks for a contig by name. More...
uint32 | GetContigID (const string &name) const
| Get a contig index by name. More...
string | GetContigName (const uint32 i) const
| Get the name of the specified contig. More...
gnSeqI | GetContigSeqLength (const uint32 i) const
| Get the total number of base pairs in the specified contig. More...
boolean | SeqRead (const gnSeqI start, char *buf, uint32 &bufLen, const uint32 contigI=ALL_CONTIGS)
| Gets sequence data from this source. More...
gnGenomeSpec* | GetSpec () const
| Get the annotated sequence data as a gnGenomeSpec. More...
gnFileContig* | GetFileContig (const uint32 contigI) const
| Returns a pointer to the file contig corresponding to contigI or null if none exists. More...
## Static Public Methods
boolean | Write (gnSequence &seq, const string &filename)
| Writes the specified gnSequence to a .GBK file named "filename". More...
boolean | Write (gnBaseSource *source, const string &filename)
| Writes the specified source to a .GBK file named "filename". More...
## Private Methods
boolean | SeqSeek (const gnSeqI start, const uint32 &contigI, uint64 &startPos, uint64 &readableBytes)
boolean | SeqStartPos (const gnSeqI start, gnFileContig &contig, uint64 &startPos, uint64 &readableBytes)
boolean | ParseStream (istream &fin)
## Static Private Methods
string& | Filler (uint32 length)
void | FormatString (string &data, uint32 offset, uint32 width)
void | WriteHeader (gnMultiSpec *spec, const string &hdr, ofstream &m_ofstream)
## Private Attributes
gnGenomeSpec* | m_spec
vector< gnFileContig* > | m_contigList

## Detailed Description

gnGBKSource is a GenBank sequence file reader.

This class reads and writes the GenBank file format. gnGBKSource is used by gnSourceFactory to read files and should only be used directly when writing out files in GBK file format by calling gnGBKSource::Write( mySpec, "C:\mySeqFile.gbk");

Definition at line 51 of file gnGBKSource.h.

## Constructor & Destructor Documentation

gnGBKSource::gnGBKSource ( | )

| Empty Constructor, does nothing. Definition at line 24 of file gnGBKSource.cpp. Referenced by Clone().

gnGBKSource::gnGBKSource ( | const gnGBKSource & s )

  | Clone Constructor copies the specified gnGBKSource. Parameters:
  s | The gnGBKSource to copy.
Definition at line 32 of file gnGBKSource.cpp.

gnGBKSource::~gnGBKSource ( | )

| Destructor, frees memory. Definition at line 40 of file gnGBKSource.cpp.

## Member Function Documentation

gnGBKSource * gnGBKSource::Clone ( | ) const`[inline, virtual]`

| Returns an exact copy of this class. Reimplemented from gnFileSource. Definition at line 111 of file gnGBKSource.h.

string & gnGBKSource::Filler ( | uint32 length )`[static, private]`

void gnGBKSource::FormatString ( | string & data,
| uint32 offset,
| uint32 width )`[static, private]`

| Definition at line 254 of file gnGBKSource.cpp.

uint32 gnGBKSource::GetContigID ( | const string & name ) const`[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 from gnBaseSource. Definition at line 60 of file gnGBKSource.cpp.

uint32 gnGBKSource::GetContigListLength ( | ) const`[inline, virtual]`

| Get the number of sequence contigs in this source. Returns: The number of contigs in this source. Reimplemented from gnBaseSource. Definition at line 117 of file gnGBKSource.h.

string gnGBKSource::GetContigName ( | const uint32 i ) const`[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 from gnBaseSource. Definition at line 69 of file gnGBKSource.cpp.

gnSeqI gnGBKSource::GetContigSeqLength ( | const uint32 i ) const`[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 from gnBaseSource. Definition at line 77 of file gnGBKSource.cpp.

gnFileContig * gnGBKSource::GetFileContig ( | const uint32 contigI ) const`[virtual]`

| Returns a pointer to the file contig corresponding to contigI or null if none exists. Reimplemented from gnFileSource. Definition at line 547 of file gnGBKSource.cpp.

gnGenomeSpec * gnGBKSource::GetSpec ( | ) const`[inline, 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 from gnBaseSource. Definition at line 127 of file gnGBKSource.h.

boolean gnGBKSource::HasContig ( | const string & name ) const`[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 from gnBaseSource. Definition at line 51 of file gnGBKSource.cpp.

boolean gnGBKSource::ParseStream ( | istream & fin )`[private, virtual]`

| Reimplemented from gnFileSource. Definition at line 554 of file gnGBKSource.cpp.

boolean gnGBKSource::SeqRead ( | const gnSeqI start,
| char * buf,
| uint32 & bufLen,
| const uint32 contigI = ALL_CONTIGS )`[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 from gnBaseSource. Definition at line 88 of file gnGBKSource.cpp.

boolean gnGBKSource::SeqSeek ( | const gnSeqI start,
| const uint32 & contigI,
| uint64 & startPos,
| uint64 & readableBytes )`[private]`

| Definition at line 171 of file gnGBKSource.cpp. Referenced by SeqRead().

boolean gnGBKSource::SeqStartPos ( | const gnSeqI start,
| gnFileContig & contig,
| uint64 & startPos,
| uint64 & readableBytes )`[private]`

| Definition at line 198 of file gnGBKSource.cpp. Referenced by SeqSeek().

boolean gnGBKSource::Write ( | gnBaseSource * source,
| const string & filename )`[inline, static]`

  | Writes the specified source to a .GBK file named "filename". Parameters:
  source | The source to write out.
  filename | The name of the file to write.
Returns: True if successful, false otherwise. Definition at line 122 of file gnGBKSource.h.

boolean gnGBKSource::Write ( | gnSequence & seq,
| const string & filename )`[static]`

  | Writes the specified gnSequence to a .GBK file named "filename". Parameters:
  source | The gnSequence to write out.
  filename | The name of the file to write.
Returns: True if successful, false otherwise. Definition at line 306 of file gnGBKSource.cpp. Referenced by Write(), gnDNXSource::Write(), and main().

void gnGBKSource::WriteHeader ( | gnMultiSpec * spec,
| const string & hdr,
| ofstream & m_ofstream )`[static, private]`

| Definition at line 295 of file gnGBKSource.cpp. Referenced by Write().

## Member Data Documentation

vector< gnFileContig * > gnGBKSource::m_contigList< gnFileContig* >`[private]`

| Definition at line 107 of file gnGBKSource.h.

gnGenomeSpec * gnGBKSource::m_spec`[private]`

| Definition at line 106 of file gnGBKSource.h.

The documentation for this class was generated from the following files:

- gnGBKSource.h
- gnGBKSource.cpp