gnSEQSource Class Reference

gnSEQSource is a SEQ file reader. More...

#include <gnSEQSource.h>

Inheritance diagram for gnSEQSource:

Inheritance graph
[legend]
Collaboration diagram for gnSEQSource:

Collaboration graph
[legend]
List of all members.

Public Member Functions

gnSEQSourceClone () const
 Returns an exact copy of this class.

uint32 GetContigID (const string &name) const
 Get a contig index by name.

uint32 GetContigListLength () const
 Get the number of sequence contigs in this source.

string GetContigName (const uint32 i) const
 Get the name of the specified contig.

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

gnFileContigGetFileContig (const uint32 contigI) const
 Returns a pointer to the file contig corresponding to contigI or null if none exists.

gnGenomeSpecGetSpec () const
 Get the annotated sequence data as a gnGenomeSpec.

 gnSEQSource (const gnSEQSource &s)
 Clone Constructor copies the specified gnSEQSource.

 gnSEQSource ()
 Empty Constructor, does nothing.

boolean HasContig (const string &name) const
 Looks for a contig by name.

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

 ~gnSEQSource ()
 Destructor, frees memory.


Static Public Member Functions

boolean Write (gnGenomeSpec *spec, const string &filename)
 Writes the given spec to a .SEQ file named "filename".

boolean Write (gnBaseSource *source, const string &filename)
 Writes the specified source to a .SEQ file named "filename".

boolean Write (gnSequence &sequence, const string &filename)
 Writes the specified gnSequence to a .SEQ file named "filename".


Private Member Functions

boolean ParseStream (istream &fin)
boolean SeqSeek (const gnSeqI start, const uint32 &contigI, uint64 &startPos, uint64 &readableBytes)
boolean SeqStartPos (const gnSeqI start, gnFileContig &contig, uint64 &startPos, uint64 &readableBytes)

Static Private Member Functions

void BaseCount (const string &bases, gnSeqI &a_count, gnSeqI &c_count, gnSeqI &g_count, gnSeqI &t_count, gnSeqI &other_count)
string & Filler (uint32 length)
void FormatString (string &data, uint32 offset, uint32 width)

Private Attributes

vector< gnFileContig * > m_contigList
gnGenomeSpecm_spec

Detailed Description

gnSEQSource is a SEQ file reader.

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

Definition at line 34 of file gnSEQSource.h.


Constructor & Destructor Documentation

gnSEQSource::gnSEQSource  ) 
 

Empty Constructor, does nothing.

Definition at line 23 of file gnSEQSource.cpp.

References DebugMsg(), and gnFilter::proteinSeqFilter().

Referenced by Clone().

gnSEQSource::gnSEQSource const gnSEQSource s  ) 
 

Clone Constructor copies the specified gnSEQSource.

Parameters:
s The gnSEQSource to copy.

Definition at line 31 of file gnSEQSource.cpp.

References m_contigList.

gnSEQSource::~gnSEQSource  ) 
 

Destructor, frees memory.

Definition at line 39 of file gnSEQSource.cpp.


Member Function Documentation

void gnSEQSource::BaseCount const string &  bases,
gnSeqI a_count,
gnSeqI c_count,
gnSeqI g_count,
gnSeqI t_count,
gnSeqI other_count
[static, private]
 

Definition at line 262 of file gnSEQSource.cpp.

References gnSeqI, and uint32.

gnSEQSource * gnSEQSource::Clone  )  const [inline, virtual]
 

Returns an exact copy of this class.

Implements gnFileSource.

Definition at line 101 of file gnSEQSource.h.

References gnSEQSource().

string& gnSEQSource::Filler uint32  length  )  [static, private]
 

void gnSEQSource::FormatString string &  data,
uint32  offset,
uint32  width
[static, private]
 

Definition at line 282 of file gnSEQSource.cpp.

References uint32.

uint32 gnSEQSource::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.

Implements gnBaseSource.

Definition at line 59 of file gnSEQSource.cpp.

References uint32.

uint32 gnSEQSource::GetContigListLength  )  const [inline, virtual]
 

Get the number of sequence contigs in this source.

Returns:
The number of contigs in this source.

Implements gnBaseSource.

Definition at line 107 of file gnSEQSource.h.

References uint32.

string gnSEQSource::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.

Implements gnBaseSource.

Definition at line 68 of file gnSEQSource.cpp.

References uint32.

gnSeqI gnSEQSource::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.

Implements gnBaseSource.

Definition at line 76 of file gnSEQSource.cpp.

References gnMultiSpec< gnFragmentSpec >::GetLength(), gnSeqI, GNSEQI_ERROR, and uint32.

gnFileContig * gnSEQSource::GetFileContig const uint32  contigI  )  const [virtual]
 

Returns a pointer to the file contig corresponding to contigI or null if none exists.

Implements gnFileSource.

Definition at line 328 of file gnSEQSource.cpp.

References uint32.

gnGenomeSpec * gnSEQSource::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.

Implements gnBaseSource.

Definition at line 120 of file gnSEQSource.h.

References gnGenomeSpec::Clone().

boolean gnSEQSource::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.

Implements gnBaseSource.

Definition at line 50 of file gnSEQSource.cpp.

References uint32.

boolean gnSEQSource::ParseStream istream &  fin  )  [private, virtual]
 

Implements gnFileSource.

Definition at line 335 of file gnSEQSource.cpp.

References gnFragmentSpec::AddFeature(), gnMultiSpec< gnContigSpec >::AddHeader(), gnMultiSpec< gnFragmentSpec >::AddHeader(), gnBaseFeature::AddLocation(), gnBaseFeature::AddQualifier(), gnMultiSpec< gnFragmentSpec >::AddSpec(), gnMultiSpec< gnContigSpec >::AddSpec(), gnFragmentSpec::GetFeatureListLength(), gnMultiSpec< gnContigSpec >::GetHeaderListLength(), gnContigSpec::GetLength(), gnBaseFeature::GetLocationListLength(), gnFileContig::GetRepeatSeqGapSize(), gnMultiSpec< gnFragmentSpec >::GetSpecListLength(), gnContigSequence, gnSeqI, int32, int64, gnFilter::IsValid(), gnMultiSpec< gnFragmentSpec >::RemoveSpec(), SEQ_HEADER_NAME_LENGTH, SEQ_LOCUS_CIRCULAR_COLUMN, SEQ_LOCUS_NAME_COLUMN, SEQ_LOCUS_NAME_LENGTH, SEQ_SUBTAG_COLUMN, gnBaseSpec::SetCircular(), gnContigSpec::SetLength(), gnBaseFeature::SetLocationType(), gnBaseSpec::SetName(), gnFileContig::SetName(), gnFileContig::SetRepeatGapSize(), gnFileContig::SetRepeatSeqGap(), gnFileContig::SetRepeatSeqSize(), gnFileContig::SetSectEnd(), gnFileContig::SetSectStart(), gnFileContig::SetSeqLength(), gnContigSpec::SetSourceName(), uint32, and uint64.

boolean gnSEQSource::SeqRead const gnSeqI  start,
char *  buf,
gnSeqI 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.
bufLen 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.

Implements gnBaseSource.

Definition at line 87 of file gnSEQSource.cpp.

References gnSeqC, gnSeqI, gnFilter::IsValid(), SeqSeek(), uint32, and uint64.

boolean gnSEQSource::SeqSeek const gnSeqI  start,
const uint32 contigI,
uint64 startPos,
uint64 readableBytes
[private]
 

Definition at line 170 of file gnSEQSource.cpp.

References gnSeqI, SeqStartPos(), uint32, and uint64.

Referenced by SeqRead().

boolean gnSEQSource::SeqStartPos const gnSeqI  start,
gnFileContig contig,
uint64 startPos,
uint64 readableBytes
[private]
 

Definition at line 197 of file gnSEQSource.cpp.

References DebugMsg(), ErrorMsg(), gnFileContig::GetRepeatSeqGapSize(), gnFileContig::GetSectStartEnd(), gnContigSequence, gnSeqI, gnFileContig::HasRepeatSeqGap(), gnFilter::IsValid(), uint32, and uint64.

Referenced by SeqSeek().

boolean gnSEQSource::Write gnGenomeSpec spec,
const string &  filename
[static]
 

Writes the given spec to a .SEQ file named "filename".

Parameters:
spec The spec to write out.
filename The name of the file to write.
Returns:
True if successful, false otherwise.

Definition at line 323 of file gnSEQSource.cpp.

References ErrorMsg().

boolean gnSEQSource::Write gnBaseSource source,
const string &  filename
[inline, static]
 

Writes the specified source to a .SEQ 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 116 of file gnSEQSource.h.

References gnBaseSource::GetSpec(), and Write().

boolean gnSEQSource::Write gnSequence sequence,
const string &  filename
[inline, static]
 

Writes the specified gnSequence to a .SEQ file named "filename".

Parameters:
sequence The gnSequence to write out.
filename The name of the file to write.
Returns:
True if successful, false otherwise.

Definition at line 112 of file gnSEQSource.h.

References gnSequence::GetSpec().

Referenced by Write().


Member Data Documentation

vector< gnFileContig* > gnSEQSource::m_contigList [private]
 

Definition at line 97 of file gnSEQSource.h.

Referenced by gnSEQSource().

gnGenomeSpec* gnSEQSource::m_spec [private]
 

Definition at line 96 of file gnSEQSource.h.


The documentation for this class was generated from the following files:
Generated on Mon Mar 28 06:00:59 2005 for libGenome by doxygen 1.3.6