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

# gnFASSource Class Reference

gnFASSource reads and writes FastA files. More...

`#include <gnFASSource.h>`

Inheritance diagram for gnFASSource::

List of all members.

## Public Methods
| gnFASSource ()
| Empty Constructor, does nothing. More...
| gnFASSource (const gnFASSource &s)
| Clone Constructor copies the specified gnFASSource. More...
| ~gnFASSource ()
| Destructor, frees memory. More...
gnFASSource* | 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 &nameStr) const
| Looks for a contig by name. More...
uint32 | GetContigID (const string &nameStr) 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...
gnFileContig* | GetContig (const uint32 i) const
boolean | SeqRead (const gnSeqI start, char *buf, uint32 &bufLen, const uint32 contigI=ALL_CONTIGS)
| Gets sequence data from this source. More...
gnGenomeSpec* | GetSpec () const
| deprecated - do not use Writes the given spec to a FastA file named "filename". 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
void | Write (gnSequence &sequence, const string &filename, boolean write_coords=true, boolean enforce_unique_names=true)
| Write the given gnSequence to a FastA file. More...
void | Write (gnSequence &sequence, ostream &m_ostream, boolean write_coords=true, boolean enforce_unique_names=true)
| Write the given gnSequence to an ostream. More...
boolean | Write (gnBaseSource *source, const string &filename)
| Deprecated - do not use. 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)
## Private Attributes
vector< gnFileContig* > | m_contigList

## Detailed Description

gnFASSource reads and writes FastA files.

gnFASSource is used by gnSourceFactory to read files. Files can be written in the FastA file format by calling gnFASSource::Write( mySpec, "C:\myFasFile.fas");

Definition at line 33 of file gnFASSource.h.

## Constructor & Destructor Documentation

gnFASSource::gnFASSource ( | )

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

gnFASSource::gnFASSource ( | const gnFASSource & s )

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

gnFASSource::~gnFASSource ( | )

| Destructor, frees memory. Definition at line 37 of file gnFASSource.cpp.

## Member Function Documentation

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

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

gnFileContig * gnFASSource::GetContig ( | const uint32 i ) const

| Definition at line 85 of file gnFASSource.cpp. Referenced by main().

uint32 gnFASSource::GetContigID ( | const string & nameStr ) 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 57 of file gnFASSource.cpp.

uint32 gnFASSource::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 127 of file gnFASSource.h. Referenced by main().

string gnFASSource::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 66 of file gnFASSource.cpp.

gnSeqI gnFASSource::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 73 of file gnFASSource.cpp.

gnFileContig * gnFASSource::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 384 of file gnFASSource.cpp.

gnGenomeSpec * gnFASSource::GetSpec ( | ) const`[virtual]`

  | deprecated - do not use Writes the given spec to a FastA file named "filename". Parameters:
  spec | The spec to write out.
  filename | The name of the file to write.
Returns: True if successful, false otherwise. Reimplemented from gnBaseSource. Definition at line 360 of file gnFASSource.cpp.

boolean gnFASSource::HasContig ( | const string & nameStr ) 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 48 of file gnFASSource.cpp.

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

| Reimplemented from gnFileSource. Definition at line 390 of file gnFASSource.cpp.

boolean gnFASSource::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 93 of file gnFASSource.cpp. Referenced by main().

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

| Definition at line 178 of file gnFASSource.cpp. Referenced by SeqRead().

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

| Definition at line 206 of file gnFASSource.cpp. Referenced by SeqSeek().

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

  | Deprecated - do not use. Write the given source to a FastA file. Parameters:
  source | The spec to write out.
  filename | The name of the file to write.
Definition at line 261 of file gnFASSource.cpp.

void gnFASSource::Write ( | gnSequence & sequence,
| ostream & m_ostream,
| boolean write_coords = true,
| boolean enforce_unique_names = true )`[static]`

  | Write the given gnSequence to an ostream. Parameters:
  sequence | The gnSequence to write out.
  filename | The name of the file to write.
  write_coords | If true each entry's name will be followed by the coordinates of the entry in the context of the entrire file.
  enforce_unique_names | If true each entry's name will be recorded as they are written. Each successive duplicate name that is found will have an underscore and a number appended to it, indicating the number of entries by the same name which have already been written. Turning this off will yield a slight performance improvement when writing files with a large number of entries. (More than 1000)
Definition at line 295 of file gnFASSource.cpp.

void gnFASSource::Write ( | gnSequence & sequence,
| const string & filename,
| boolean write_coords = true,
| boolean enforce_unique_names = true )`[static]`

  | Write the given gnSequence to a FastA file. Parameters:
  sequence | The gnSequence to write out.
  filename | The name of the file to write.
  write_coords | If true each entry's name will be followed by the coordinates of the entry in the context of the entrire file.
  enforce_unique_names | If true each entry's name will be recorded as they are written. Each successive duplicate name that is found will have an underscore and a number appended to it, indicating the number of entries by the same name which have already been written. Turning this off will yield a slight performance improvement when writing files with a large number of entries. (More than 1000)
  Exceptions:
  A | FileNotOpened() exception may be thrown.
Definition at line 287 of file gnFASSource.cpp. Referenced by WriteData(), and main().

## Member Data Documentation

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

| Definition at line 117 of file gnFASSource.h.

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

- gnFASSource.h
- gnFASSource.cpp