gnMultiSpec< SubSpec > Class Template Reference

This class defines an interface for specs which have multiple subspecs containing sequence data. More...

#include <gnMultiSpec.h>

Inheritance diagram for gnMultiSpec< SubSpec >:

Inheritance graph
[legend]
Collaboration diagram for gnMultiSpec< SubSpec >:

Collaboration graph
[legend]
List of all members.

Public Member Functions

uint32 AddFeature (gnBaseFeature *feat)
 Add a feature to this spec.
virtual void AddHeader (gnBaseHeader *head, const uint32 i=UINT32_MAX)
 Add a header to this spec, adds to the end of the header list by default.
virtual void AddSpec (SubSpec *spec, const uint32 i=UINT32_MAX)
 Add a subspec to this spec.
virtual void Clear ()
 Clears all data from this spec.
virtual gnMultiSpecClone () const =0
virtual void CropEnd (gnSeqI cropLen)
 Crop the last cropLen bases from the sequence.
virtual void CropStart (gnSeqI cropLen)
 Crop the first cropLen bases from the sequence.
virtual void GetBrokenFeatures (const gnLocation &lt, vector< gnBaseFeature * > &feature_vector) const =0
 Creates a list of features which may have been broken by an edit.
virtual void GetContainedFeatures (const gnLocation &lt, vector< gnBaseFeature * > &feature_vector, vector< uint32 > &index_vector) const =0
 Creates a list of all features which are contained by coordinates specified.
virtual gnBaseFeatureGetFeature (const uint32 i) const =0
 Get the feature at index i in the list of features.
virtual uint32 GetFeatureListLength () const =0
 Returns the number of features this spec contains.
virtual gnBaseHeaderGetHeader (const string &name, uint32 &i) const
 Find the first header with the specified name, starting at index i.
virtual gnBaseHeaderGetHeader (const uint32 i) const
 Get the headers at index i in the list of headers.
virtual uint32 GetHeaderListLength () const
 Returns the number of headers this spec contains.
virtual void GetIntersectingFeatures (const gnLocation &lt, vector< gnBaseFeature * > &feature_vector, vector< uint32 > &index_vector) const =0
 Creates a list of all features which intersect the coordinates specified.
virtual gnSeqI GetLength () const
 Get the length of all the sequence data covered by this spec.
virtual string GetSourceName () const
virtual SubSpec * GetSpec (const uint32 i) const
 Get the spec at index i in the list of subspecs.
virtual SubSpec * GetSpecByBase (const gnSeqI baseI) const
 Get the spec from the list of subspecs which contains the specified base pair.
virtual gnSeqI GetSpecEndBase (const uint32 specI) const
 Get the ending base pair, in this spec's sequence, of the given subspec.
virtual uint32 GetSpecIndexByBase (const gnSeqI baseI) const
 Get the index of the subspec which contains the specified base pair.
virtual uint32 GetSpecIndexByName (const string &name) const
 Get the index of the spec which has the given name.
virtual uint32 GetSpecListLength () const
 Returns the number of subspecs this spec contains.
virtual gnSeqI GetSpecStartBase (const uint32 specI) const
 Get the starting base pair, in this spec's sequence, of the given subspec.
 gnMultiSpec ()
virtual void RemoveFeature (const uint32 i)=0
 Remove a feature from this spec.
virtual void RemoveHeader (uint32 i)
 Remove a header from this spec.
virtual void RemoveSpec (uint32 i)
 Remove a subspec from this spec.
virtual boolean SeqRead (const gnSeqI start, gnSeqC *buf, gnSeqI &bufLen, const uint32 contigI) const
 Reads sequence data from this spec.
virtual void SetSourceName (const string &sourceName)
virtual ~gnMultiSpec ()
 Destructor, frees memory.

Protected Attributes

vector< gnBaseHeader * > m_headerList
string m_sourceName
vector< SubSpec * > m_SpecList

Detailed Description

template<class SubSpec>
class gnMultiSpec< SubSpec >

This class defines an interface for specs which have multiple subspecs containing sequence data.

Definition at line 31 of file gnMultiSpec.h.


Constructor & Destructor Documentation

template<class SubSpec>
gnMultiSpec< SubSpec >::gnMultiSpec  )  [inline]
 

Definition at line 34 of file gnMultiSpec.h.

template<class SubSpec>
virtual gnMultiSpec< SubSpec >::~gnMultiSpec  )  [inline, virtual]
 

Destructor, frees memory.

Definition at line 38 of file gnMultiSpec.h.


Member Function Documentation

template<class SubSpec>
uint32 gnMultiSpec< SubSpec >::AddFeature gnBaseFeature feat  ) 
 

Add a feature to this spec.

Parameters:
feat The feature to add.
Returns:
True if successful

Reimplemented in gnFragmentSpec, and gnGenomeSpec.

template<class SubSpec>
void gnMultiSpec< SubSpec >::AddHeader gnBaseHeader head,
const uint32  i = UINT32_MAX
[virtual]
 

Add a header to this spec, adds to the end of the header list by default.

Parameters:
head The header to add.
i The header to insert before. If i is larger than the size of the header list the header will be added to the end of the list.
Definition at line 366 of file gnMultiSpec.h.

References gnMultiSpec< SubSpec >::m_headerList, uint32, and UINT32_MAX.

Referenced by gnSequence::addHeader(), gnFASSource::GetSpec(), gnSEQSource::ParseStream(), and gnGBKSource::ParseStream().

template<class SubSpec>
void gnMultiSpec< SubSpec >::AddSpec SubSpec *  spec,
const uint32  i = UINT32_MAX
[virtual]
 

Add a subspec to this spec.

Throws an exception if the insertion index i is out of range

Parameters:
spec The subspec to add.
i The subspec to insert before
Returns:
True if successful
Definition at line 241 of file gnMultiSpec.h.

References gnMultiSpec< SubSpec >::m_SpecList, uint32, and UINT32_MAX.

Referenced by gnGenomeSpec::CloneRange(), gnFragmentSpec::CloneRange(), gnFASSource::GetSpec(), gnSequence::gnSequence(), gnSequence::insert(), gnGenomeSpec::MergeFragments(), gnSEQSource::ParseStream(), gnRAWSource::ParseStream(), gnGBKSource::ParseStream(), and gnDNXSource::ParseStream().

template<class SubSpec>
void gnMultiSpec< SubSpec >::Clear  )  [virtual]
 

Clears all data from this spec.

Reimplemented from gnBaseSpec.

Reimplemented in gnFragmentSpec, and gnGenomeSpec.

Definition at line 256 of file gnMultiSpec.h.

References gnBaseSpec::Clear(), gnMultiSpec< SubSpec >::m_headerList, and uint32.

Referenced by gnGenomeSpec::Clear(), and gnFragmentSpec::Clear().

template<class SubSpec>
virtual gnMultiSpec* gnMultiSpec< SubSpec >::Clone  )  const [pure virtual]
 

Implements gnBaseSpec.

Implemented in gnFragmentSpec, and gnGenomeSpec.

template<class SubSpec>
void gnMultiSpec< SubSpec >::CropEnd gnSeqI  cropLen  )  [virtual]
 

Crop the last cropLen bases from the sequence.

CropEnd will delete features and headers associated with the cropped bases.

Parameters:
cropLen The number of base pairs to delete from the end.

Implements gnBaseSpec.

Reimplemented in gnFragmentSpec.

Definition at line 344 of file gnMultiSpec.h.

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

Referenced by gnFragmentSpec::CropEnd(), gnSequence::erase(), gnSequence::insert(), and gnSequence::splitContig().

template<class SubSpec>
void gnMultiSpec< SubSpec >::CropStart gnSeqI  cropLen  )  [virtual]
 

Crop the first cropLen bases from the sequence.

CropStart will delete features and headers associated with the cropped bases.

Parameters:
cropLen The number of base pairs to delete from the beginning.

Implements gnBaseSpec.

Reimplemented in gnFragmentSpec.

Definition at line 324 of file gnMultiSpec.h.

References gnMultiSpec< SubSpec >::GetSpec(), gnMultiSpec< SubSpec >::GetSpecListLength(), gnSeqI, gnMultiSpec< SubSpec >::RemoveSpec(), and uint32.

Referenced by gnFragmentSpec::CropStart(), gnSequence::insert(), and gnSequence::splitContig().

template<class SubSpec>
virtual void gnMultiSpec< SubSpec >::GetBrokenFeatures const gnLocation lt,
vector< gnBaseFeature * > &  feature_vector
const [pure virtual]
 

Creates a list of features which may have been broken by an edit.

Parameters:
lt The coordinates containing the features to return.
feature_vector The vector to store features in.

Implemented in gnFragmentSpec, and gnGenomeSpec.

template<class SubSpec>
virtual void gnMultiSpec< SubSpec >::GetContainedFeatures const gnLocation lt,
vector< gnBaseFeature * > &  feature_vector,
vector< uint32 > &  index_vector
const [pure virtual]
 

Creates a list of all features which are contained by coordinates specified.

Parameters:
lt The coordinates containing the features to return.
feature_vector The vector to store features in.
index_vector A vector of indices which correspond to the features.

Implemented in gnFragmentSpec, and gnGenomeSpec.

template<class SubSpec>
virtual gnBaseFeature* gnMultiSpec< SubSpec >::GetFeature const uint32  i  )  const [pure virtual]
 

Get the feature at index i in the list of features.

Parameters:
i The index of the feature
Returns:
The feature.

Implemented in gnFragmentSpec, and gnGenomeSpec.

template<class SubSpec>
virtual uint32 gnMultiSpec< SubSpec >::GetFeatureListLength  )  const [pure virtual]
 

Returns the number of features this spec contains.

Returns:
The number of features this spec contains.

Implemented in gnFragmentSpec, and gnGenomeSpec.

template<class SubSpec>
gnBaseHeader * gnMultiSpec< SubSpec >::GetHeader const string &  name,
uint32 i
const [virtual]
 

Find the first header with the specified name, starting at index i.

Parameters:
name The name of the header to find.
i The index to start looking at.
Returns:
The header or NULL if none was found.
Definition at line 373 of file gnMultiSpec.h.

References gnMultiSpec< SubSpec >::m_headerList, Throw_gnEx, and uint32.

template<class SubSpec>
gnBaseHeader * gnMultiSpec< SubSpec >::GetHeader const uint32  i  )  const [inline, virtual]
 

Get the headers at index i in the list of headers.

Throws a HeaderIndexOutOfBounds exception if a nonexistant header is referenced

Parameters:
i The index of the header
Returns:
The header.
Definition at line 203 of file gnMultiSpec.h.

References gnMultiSpec< SubSpec >::m_headerList, and uint32.

Referenced by gnSequence::getHeader(), gnGBKSource::Write(), gnFASSource::Write(), gnDNXSource::Write(), and WriteHeader().

template<class SubSpec>
uint32 gnMultiSpec< SubSpec >::GetHeaderListLength  )  const [inline, virtual]
 

Returns the number of headers this spec contains.

Returns:
The number of headers this spec contains.
Definition at line 196 of file gnMultiSpec.h.

References uint32.

Referenced by gnSequence::getHeaderListLength(), gnSEQSource::ParseStream(), gnGBKSource::ParseStream(), and gnGBKSource::Write().

template<class SubSpec>
virtual void gnMultiSpec< SubSpec >::GetIntersectingFeatures const gnLocation lt,
vector< gnBaseFeature * > &  feature_vector,
vector< uint32 > &  index_vector
const [pure virtual]
 

Creates a list of all features which intersect the coordinates specified.

Parameters:
lt The coordinates intersecting the features to return.
feature_vector The vector to store features in.
index_vector A vector of indices which correspond to the features.

Implemented in gnFragmentSpec, and gnGenomeSpec.

template<class SubSpec>
gnSeqI gnMultiSpec< SubSpec >::GetLength  )  const [virtual]
 

Get the length of all the sequence data covered by this spec.

Returns:
This spec's length in base pairs.

Implements gnBaseSpec.

Definition at line 266 of file gnMultiSpec.h.

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

Referenced by gnGenomeSpec::AddFeature(), gnGenomeSpec::CloneRange(), gnSequence::contigLength(), gnMultiSpec< SubSpec >::CropEnd(), gnSequence::erase(), gnGenomeSpec::GetBrokenFeatures(), gnGenomeSpec::GetContainedFeatures(), gnSEQSource::GetContigSeqLength(), gnGBKSource::GetContigSeqLength(), gnDNXSource::GetContigSeqLength(), gnGenomeSpec::GetIntersectingFeatures(), gnSequence::insert(), gnSequence::length(), gnSequence::size(), and gnGBKSource::Write().

template<class SubSpec>
string gnMultiSpec< SubSpec >::GetSourceName  )  const [inline, virtual]
 

Definition at line 213 of file gnMultiSpec.h.

References gnMultiSpec< SubSpec >::m_sourceName.

Referenced by gnDNXSource::Write().

template<class SubSpec>
SubSpec * gnMultiSpec< SubSpec >::GetSpec const uint32  i  )  const [virtual]
 

Get the spec at index i in the list of subspecs.

Parameters:
i The index of the spec
Returns:
The spec.
Definition at line 229 of file gnMultiSpec.h.

References gnMultiSpec< SubSpec >::m_SpecList, Throw_gnEx, and uint32.

Referenced by gnSequence::addHeader(), gnSequence::contig(), gnSequence::contigByName(), gnSequence::contigLength(), gnSequence::contigName(), gnMultiSpec< SubSpec >::CropEnd(), gnMultiSpec< SubSpec >::CropStart(), gnDNXSource::GetContigID(), gnDNXSource::GetContigName(), gnDNXSource::GetContigSeqLength(), gnSequence::getHeader(), gnSequence::getHeaderListLength(), gnMultiSpec< SubSpec >::GetLength(), gnMultiSpec< SubSpec >::GetSpecEndBase(), gnMultiSpec< SubSpec >::GetSpecIndexByBase(), gnMultiSpec< SubSpec >::GetSpecIndexByName(), gnMultiSpec< SubSpec >::GetSpecStartBase(), gnSequence::globalToSource(), gnDNXSource::HasContig(), gnSequence::insert(), gnSequence::isReverseComplement(), gnGenomeSpec::MergeFragments(), gnSequence::removeHeader(), gnMultiSpec< SubSpec >::SeqRead(), gnSequence::setContigName(), gnSequence::setReverseComplement(), gnGBKSource::Write(), gnFASSource::Write(), and gnDNXSource::Write().

template<class SubSpec>
SubSpec * gnMultiSpec< SubSpec >::GetSpecByBase const gnSeqI  baseI  )  const [virtual]
 

Get the spec from the list of subspecs which contains the specified base pair.

Parameters:
baseI The base pair index.
Returns:
The spec.
Definition at line 236 of file gnMultiSpec.h.

References gnMultiSpec< SubSpec >::GetSpecIndexByBase(), gnSeqI, and gnMultiSpec< SubSpec >::m_SpecList.

Referenced by gnSequence::contigByBase().

template<class SubSpec>
gnSeqI gnMultiSpec< SubSpec >::GetSpecEndBase const uint32  specI  )  const [virtual]
 

Get the ending base pair, in this spec's sequence, of the given subspec.

Parameters:
specI The subspec index.
Returns:
The subspec's ending base pair.
Definition at line 311 of file gnMultiSpec.h.

References gnMultiSpec< SubSpec >::GetSpec(), gnMultiSpec< SubSpec >::GetSpecListLength(), gnSeqI, Throw_gnEx, and uint32.

template<class SubSpec>
uint32 gnMultiSpec< SubSpec >::GetSpecIndexByBase const gnSeqI  baseI  )  const [virtual]
 

Get the index of the subspec which contains the specified base pair.

Parameters:
baseI The base pair index.
Returns:
The subspec index.
Definition at line 276 of file gnMultiSpec.h.

References gnMultiSpec< SubSpec >::GetSpec(), gnMultiSpec< SubSpec >::GetSpecListLength(), gnSeqI, Throw_gnEx, and uint32.

Referenced by gnSequence::contigIndexByBase(), gnMultiSpec< SubSpec >::GetSpecByBase(), and gnSequence::globalToSource().

template<class SubSpec>
uint32 gnMultiSpec< SubSpec >::GetSpecIndexByName const string &  name  )  const [virtual]
 

Get the index of the spec which has the given name.

Parameters:
name The name of the spec to find.
Returns:
The spec index.
Definition at line 288 of file gnMultiSpec.h.

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

Referenced by gnSequence::contigByName(), and gnSequence::contigIndexByName().

template<class SubSpec>
uint32 gnMultiSpec< SubSpec >::GetSpecListLength  )  const [virtual]
 

Returns the number of subspecs this spec contains.

Returns:
The number of subspecs this spec contains.
Definition at line 224 of file gnMultiSpec.h.

References gnMultiSpec< SubSpec >::m_SpecList, and uint32.

Referenced by gnSequence::contigListLength(), gnSequence::contigListSize(), gnMultiSpec< SubSpec >::CropEnd(), gnMultiSpec< SubSpec >::CropStart(), gnDNXSource::GetContigID(), gnDNXSource::GetContigListLength(), gnDNXSource::GetContigName(), gnDNXSource::GetContigSeqLength(), gnMultiSpec< SubSpec >::GetLength(), gnMultiSpec< SubSpec >::GetSpecEndBase(), gnMultiSpec< SubSpec >::GetSpecIndexByBase(), gnMultiSpec< SubSpec >::GetSpecIndexByName(), gnMultiSpec< SubSpec >::GetSpecStartBase(), gnDNXSource::HasContig(), gnSequence::insert(), gnGenomeSpec::MergeFragments(), gnSEQSource::ParseStream(), gnGBKSource::ParseStream(), gnDNXSource::ParseStream(), gnMultiSpec< SubSpec >::RemoveSpec(), gnMultiSpec< SubSpec >::SeqRead(), gnGBKSource::Write(), and gnDNXSource::Write().

template<class SubSpec>
gnSeqI gnMultiSpec< SubSpec >::GetSpecStartBase const uint32  specI  )  const [virtual]
 

Get the starting base pair, in this spec's sequence, of the given subspec.

Parameters:
specI The subspec index.
Returns:
The subspec's starting base pair.
Definition at line 298 of file gnMultiSpec.h.

References gnMultiSpec< SubSpec >::GetSpec(), gnMultiSpec< SubSpec >::GetSpecListLength(), gnSeqI, Throw_gnEx, and uint32.

Referenced by gnSequence::contigStart(), and gnSequence::globalToSource().

template<class SubSpec>
virtual void gnMultiSpec< SubSpec >::RemoveFeature const uint32  i  )  [pure virtual]
 

Remove a feature from this spec.

Parameters:
i The index of the feature to remove.
Returns:
True if successful

Implemented in gnFragmentSpec, and gnGenomeSpec.

template<class SubSpec>
void gnMultiSpec< SubSpec >::RemoveHeader uint32  i  )  [virtual]
 

Remove a header from this spec.

Throws a HeaderIndexOutOfBounds exception if a nonexistant header is referenced

Parameters:
i The index of the header to remove.
Definition at line 382 of file gnMultiSpec.h.

References gnMultiSpec< SubSpec >::m_headerList, Throw_gnEx, and uint32.

Referenced by gnSequence::removeHeader().

template<class SubSpec>
void gnMultiSpec< SubSpec >::RemoveSpec uint32  i  )  [virtual]
 

Remove a subspec from this spec.

Parameters:
i The index of the subspec to remove.
Definition at line 249 of file gnMultiSpec.h.

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

Referenced by gnMultiSpec< SubSpec >::CropEnd(), gnMultiSpec< SubSpec >::CropStart(), gnSEQSource::ParseStream(), and gnGBKSource::ParseStream().

template<class SubSpec>
boolean gnMultiSpec< SubSpec >::SeqRead const gnSeqI  start,
gnSeqC buf,
gnSeqI bufLen,
const uint32  contigI
const [virtual]
 

Reads sequence data from this spec.

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. This will be modified to reflect the actual number of bases read.
contigI The index of the subspec to read or ALL_CONTIGS by default.
Returns:
True if the operation was successful.

Implements gnBaseSpec.

Definition at line 391 of file gnMultiSpec.h.

References gnMultiSpec< SubSpec >::GetSpec(), gnMultiSpec< SubSpec >::GetSpecListLength(), gnSeqC, gnSeqI, Throw_gnEx, and uint32.

Referenced by gnSequence::GetSeqC(), gnDNXSource::SeqRead(), gnSequence::ToArray(), and gnSequence::ToString().

template<class SubSpec>
void gnMultiSpec< SubSpec >::SetSourceName const string &  sourceName  )  [inline, virtual]
 

Definition at line 219 of file gnMultiSpec.h.

References gnMultiSpec< SubSpec >::m_sourceName.

Referenced by gnFASSource::GetSpec(), and gnDNXSource::ParseStream().


Member Data Documentation

template<class SubSpec>
vector< gnBaseHeader* > gnMultiSpec< SubSpec >::m_headerList [protected]
 

Definition at line 189 of file gnMultiSpec.h.

Referenced by gnMultiSpec< SubSpec >::AddHeader(), gnMultiSpec< SubSpec >::Clear(), gnMultiSpec< SubSpec >::GetHeader(), gnFragmentSpec::gnFragmentSpec(), gnGenomeSpec::gnGenomeSpec(), and gnMultiSpec< SubSpec >::RemoveHeader().

template<class SubSpec>
string gnMultiSpec< SubSpec >::m_sourceName [protected]
 

Reimplemented from gnBaseSpec.

Definition at line 186 of file gnMultiSpec.h.

Referenced by gnMultiSpec< SubSpec >::GetSourceName(), gnFragmentSpec::gnFragmentSpec(), gnGenomeSpec::gnGenomeSpec(), and gnMultiSpec< SubSpec >::SetSourceName().

template<class SubSpec>
vector< SubSpec* > gnMultiSpec< SubSpec >::m_SpecList [protected]
 

Definition at line 188 of file gnMultiSpec.h.

Referenced by gnMultiSpec< SubSpec >::AddSpec(), gnMultiSpec< SubSpec >::GetSpec(), gnMultiSpec< SubSpec >::GetSpecByBase(), gnMultiSpec< SubSpec >::GetSpecListLength(), gnFragmentSpec::gnFragmentSpec(), gnGenomeSpec::gnGenomeSpec(), and gnMultiSpec< SubSpec >::RemoveSpec().


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