gnDNXSource Class Reference

gnDNXSource implements the DNX file source. More...

#include <gnDNXSource.h>

Inheritance diagram for gnDNXSource:

Inheritance graph
[legend]
Collaboration diagram for gnDNXSource:

Collaboration graph
[legend]
List of all members.

Public Member Functions

gnDNXSourceClone () const
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.
 gnDNXSource (const gnDNXSource &s)
 The copy constructor copies the given gnDNXSource.
 gnDNXSource ()
 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.
 ~gnDNXSource ()
 Destructor, frees memory.

Static Public Member Functions

boolean Write (gnGenomeSpec *spec, const string &filename)
 Writes the given gnGenomeSpec to a DNX file named "filename".
boolean Write (gnBaseSource *source, const string &filename)
 This method is deprecated.
boolean Write (gnSequence &sequence, const string &filename)
 Writes the given gnSequence to a DNX file named "filename".

Private Member Functions

boolean ParseStream (istream &fin)

Static Private Member Functions

void ValidateName (string &name)

Private Attributes

gnGenomeSpecm_DNXSpec

Detailed Description

gnDNXSource implements the DNX file source.

This class reads and writes the Blattner Lab DNX file format. DNX files may be written by calling: gnDNXSource::Write( mySpec, "C:\\myFile.dnx");

Definition at line 35 of file gnDNXSource.h.


Constructor & Destructor Documentation

gnDNXSource::gnDNXSource  ) 
 

Empty Constructor, does nothing.

Definition at line 24 of file gnDNXSource.cpp.

References DebugMsg(), gnFilter::fullDNASeqFilter(), and m_DNXSpec.

Referenced by Clone().

gnDNXSource::gnDNXSource const gnDNXSource s  ) 
 

The copy constructor copies the given gnDNXSource.

Parameters:
s A gnDNXSource to copy.
Definition at line 33 of file gnDNXSource.cpp.

References gnGenomeSpec::Clone(), and m_DNXSpec.

gnDNXSource::~gnDNXSource  ) 
 

Destructor, frees memory.

Definition at line 39 of file gnDNXSource.cpp.

References m_DNXSpec.


Member Function Documentation

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

Implements gnFileSource.

Definition at line 101 of file gnDNXSource.h.

References gnDNXSource().

uint32 gnDNXSource::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 52 of file gnDNXSource.cpp.

References gnBaseSpec::GetName(), gnMultiSpec< SubSpec >::GetSpec(), gnMultiSpec< SubSpec >::GetSpecListLength(), m_DNXSpec, and uint32.

uint32 gnDNXSource::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 gnDNXSource.h.

References gnMultiSpec< SubSpec >::GetSpecListLength(), m_DNXSpec, and uint32.

string gnDNXSource::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 60 of file gnDNXSource.cpp.

References gnBaseSpec::GetName(), gnMultiSpec< SubSpec >::GetSpec(), gnMultiSpec< SubSpec >::GetSpecListLength(), m_DNXSpec, and uint32.

gnSeqI gnDNXSource::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 68 of file gnDNXSource.cpp.

References gnBaseSpec::GetLength(), gnMultiSpec< SubSpec >::GetLength(), gnMultiSpec< SubSpec >::GetSpec(), gnMultiSpec< SubSpec >::GetSpecListLength(), gnSeqI, m_DNXSpec, and uint32.

gnFileContig * gnDNXSource::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 136 of file gnDNXSource.cpp.

References uint32.

gnGenomeSpec * gnDNXSource::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 127 of file gnDNXSource.h.

References gnGenomeSpec::Clone(), and m_DNXSpec.

boolean gnDNXSource::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 44 of file gnDNXSource.cpp.

References gnBaseSpec::GetName(), gnMultiSpec< SubSpec >::GetSpec(), gnMultiSpec< SubSpec >::GetSpecListLength(), m_DNXSpec, and uint32.

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

Implements gnFileSource.

Definition at line 141 of file gnDNXSource.cpp.

References gnSourceFactory::AddPath(), gnSourceFactory::AddSource(), gnMultiSpec< SubSpec >::AddSpec(), DebugMsg(), gnBaseSource::GetContigID(), getPathString(), gnSourceFactory::GetSourceFactory(), gnMultiSpec< SubSpec >::GetSpecListLength(), GNSEQI_END, m_DNXSpec, gnBaseSpec::SetName(), gnContigSpec::SetSourceName(), gnMultiSpec< SubSpec >::SetSourceName(), uint32, and uint64.

boolean gnDNXSource::SeqRead const gnSeqI  start,
char *  buf,
gnSeqI bufLen,
const uint32  contigI = ALL_CONTIGS
[inline, 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 113 of file gnDNXSource.h.

References gnSeqI, m_DNXSpec, gnMultiSpec< SubSpec >::SeqRead(), and uint32.

void gnDNXSource::ValidateName string &  name  )  [static, private]
 

Definition at line 80 of file gnDNXSource.cpp.

Referenced by Write().

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

Writes the given gnGenomeSpec to a DNX file named "filename".

Actual sequence and annotation data will be written to GenBank files. The DNX file will then reference any created GenBank files.

Parameters:
spec The spec to write out.
filename The name of the file to write.
Returns:
True if successful, false otherwise.
Definition at line 89 of file gnDNXSource.cpp.

References gnBaseHeader::GetHeader(), gnMultiSpec< SubSpec >::GetHeader(), gnBaseSpec::GetName(), gnSourceFactory::GetSourceFactory(), gnMultiSpec< SubSpec >::GetSourceName(), gnMultiSpec< SubSpec >::GetSpec(), gnMultiSpec< SubSpec >::GetSpecListLength(), gnSourceFactory::HasSource(), uint32, ValidateName(), and gnGBKSource::Write().

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

This method is deprecated.

Writes the given gnBaseSource to a DNX file named "filename". Actual sequence and annotation data will be written to GenBank files. The DNX file will then reference any created GenBank files.

Parameters:
source The source to write out.
filename The name of the file to write.
Returns:
True if successful, false otherwise.
Definition at line 123 of file gnDNXSource.h.

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

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

Writes the given gnSequence to a DNX file named "filename".

Actual sequence and annotation data will be written to GenBank files. The DNX file will then reference any created GenBank files.

Parameters:
sequence The gnSequence to write out.
filename The name of the file to write.
Returns:
True if successful, false otherwise.
Definition at line 119 of file gnDNXSource.h.

References gnSequence::GetSpec().

Referenced by Write().


Member Data Documentation

gnGenomeSpec* gnDNXSource::m_DNXSpec [private]
 

Definition at line 97 of file gnDNXSource.h.

Referenced by GetContigID(), GetContigListLength(), GetContigName(), GetContigSeqLength(), GetSpec(), gnDNXSource(), HasContig(), ParseStream(), SeqRead(), and ~gnDNXSource().


The documentation for this class was generated from the following files:
Generated on Mon Feb 14 19:29:49 2005 for libGenome by doxygen 1.3.8