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

# gnMultiSpec Class Reference

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

`#include <gnMultiSpec.h>`

Inheritance diagram for gnMultiSpec::

List of all members.

## Public Methods
| gnMultiSpec ()
virtual | ~gnMultiSpec ()
| Destructor, frees memory. More...
virtual gnMultiSpec* | Clone () const=0
virtual gnSeqI | GetLength () const
| Get the length of all the sequence data covered by this spec. More...
virtual void | CropStart (gnSeqI cropLen)
| Crop the first cropLen bases from the sequence. More...
virtual void | CropEnd (gnSeqI cropLen)
| Crop the last cropLen bases from the sequence. More...
virtual string | GetSourceName () const
virtual void | SetSourceName (const string &sourceName)
virtual void | Clear ()
| Clears all data from this spec. More...
virtual boolean | SeqRead (const gnSeqI start, gnSeqC *buf, uint32 &bufLen, const uint32 contigI) const
| Reads sequence data from this spec. More...
virtual uint32 | GetSpecListLength () const=0
| Returns the number of subspecs this spec contains. More...
virtual gnBaseSpec* | GetSpec (const uint32 i) const=0
| Get the spec at index i in the list of subspecs. More...
virtual gnBaseSpec* | GetSpecByBase (const gnSeqI baseI) const=0
| Get the spec from the list of subspecs which contains the specified base pair. More...
virtual uint32 | GetSpecIndexByBase (const gnSeqI baseI) const
| Get the index of the subspec which contains the specified base pair. More...
virtual uint32 | GetSpecIndexByName (const string &name) const
| Get the index of the spec which has the given name. More...
virtual gnSeqI | GetSpecStartBase (const uint32 specI) const
| Get the starting base pair, in this spec's sequence, of the given subspec. More...
virtual gnSeqI | GetSpecEndBase (const uint32 specI) const
| Get the ending base pair, in this spec's sequence, of the given subspec. More...
virtual void | AddSpec (gnBaseSpec *spec, const uint32 i=UINT32_MAX)=0
| Add a subspec to this spec. More...
virtual void | RemoveSpec (uint32 i)=0
| Remove a subspec from this spec. More...
virtual uint32 | GetHeaderListLength () const
| Returns the number of headers this spec contains. More...
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. More...
virtual gnBaseHeader* | GetHeader (const uint32 i) const
| Get the headers at index i in the list of headers. More...
virtual gnBaseHeader* | GetHeader (const string &name, uint32 &i) const
| Find the first header with the specified name, starting at index i. More...
virtual void | RemoveHeader (uint32 i)
| Remove a header from this spec. More...
uint32 | AddFeature (gnBaseFeature *feat)
| Add a feature to this spec. More...
virtual uint32 | GetFeatureListLength () const=0
| Returns the number of features this spec contains. More...
virtual gnBaseFeature* | GetFeature (const uint32 i) const=0
| Get the feature at index i in the list of features. More...
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. More...
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. More...
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. More...
virtual void | RemoveFeature (const uint32 i)=0
| Remove a feature from this spec. More...
## Protected Attributes
string | m_sourceName
vector<gnBaseHeader*> | m_headerList

## Detailed Description

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

Definition at line 30 of file gnMultiSpec.h.

## Constructor & Destructor Documentation

gnMultiSpec::gnMultiSpec ( | )`[inline]`

| Definition at line 33 of file gnMultiSpec.h.

gnMultiSpec::~gnMultiSpec ( | )`[inline, virtual]`

| Destructor, frees memory. Definition at line 37 of file gnMultiSpec.h.

## Member Function Documentation

uint32 gnMultiSpec::AddFeature ( | gnBaseFeature * feat )

  | Add a feature to this spec. Parameters:
  feat | The feature to add.
  i | The feature to insert before
Returns: True if successful Reimplemented in gnFragmentSpec, and gnGenomeSpec.

void gnMultiSpec::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 126 of file gnMultiSpec.cpp. Referenced by gnFASSource::GetSpec(), gnSEQSource::ParseStream(), gnGBKSource::ParseStream(), and gnSequence::addHeader().

void gnMultiSpec::AddSpec ( | gnBaseSpec * spec,
| const uint32 i = UINT32_MAX )`[pure 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 Reimplemented in gnFragmentSpec, and gnGenomeSpec.

void gnMultiSpec::Clear ( | )`[virtual]`

| Clears all data from this spec. Reimplemented from gnBaseSpec. Reimplemented in gnFragmentSpec, and gnGenomeSpec. Definition at line 24 of file gnMultiSpec.cpp. Referenced by gnGenomeSpec::Clear(), and gnFragmentSpec::Clear().

gnMultiSpec * gnMultiSpec::Clone ( | ) const`[pure virtual]`

| Reimplemented from gnBaseSpec. Reimplemented in gnFragmentSpec, and gnGenomeSpec.

void gnMultiSpec::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.
Reimplemented from gnBaseSpec. Reimplemented in gnFragmentSpec. Definition at line 105 of file gnMultiSpec.cpp. Referenced by gnFragmentSpec::CropEnd(), gnSequence::erase(), gnSequence::insert(), and gnSequence::splitContig().

void gnMultiSpec::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.
Reimplemented from gnBaseSpec. Reimplemented in gnFragmentSpec. Definition at line 86 of file gnMultiSpec.cpp. Referenced by gnFragmentSpec::CropStart(), gnSequence::insert(), and gnSequence::splitContig().

void gnMultiSpec::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.
Reimplemented in gnFragmentSpec, and gnGenomeSpec.

void gnMultiSpec::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.
Reimplemented in gnFragmentSpec, and gnGenomeSpec.

gnBaseFeature * gnMultiSpec::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. Reimplemented in gnFragmentSpec, and gnGenomeSpec.

uint32 gnMultiSpec::GetFeatureListLength ( | ) const`[pure virtual]`

| Returns the number of features this spec contains. Returns: The number of features this spec contains. Reimplemented in gnFragmentSpec, and gnGenomeSpec.

gnBaseHeader * gnMultiSpec::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 132 of file gnMultiSpec.cpp.

gnBaseHeader * gnMultiSpec::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 199 of file gnMultiSpec.h. Referenced by gnGBKSource::Write(), gnFASSource::Write(), gnDNXSource::Write(), gnGBKSource::WriteHeader(), and gnSequence::getHeader().

uint32 gnMultiSpec::GetHeaderListLength ( | ) const`[inline, virtual]`

| Returns the number of headers this spec contains. Returns: The number of headers this spec contains. Definition at line 194 of file gnMultiSpec.h. Referenced by gnSEQSource::ParseStream(), gnGBKSource::ParseStream(), gnGBKSource::Write(), and gnSequence::getHeaderListLength().

void gnMultiSpec::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.
Reimplemented in gnFragmentSpec, and gnGenomeSpec.

gnSeqI gnMultiSpec::GetLength ( | ) const`[virtual]`

| Get the length of all the sequence data covered by this spec. Returns: This spec's length in base pairs. Reimplemented from gnBaseSpec. Definition at line 33 of file gnMultiSpec.cpp. Referenced by gnGenomeSpec::AddFeature(), gnGenomeSpec::CloneRange(), gnFragmentSpec::CloneRange(), CropEnd(), gnGenomeSpec::GetBrokenFeatures(), gnGenomeSpec::GetContainedFeatures(), gnSEQSource::GetContigSeqLength(), gnGBKSource::GetContigSeqLength(), gnDNXSource::GetContigSeqLength(), gnGenomeSpec::GetIntersectingFeatures(), gnGBKSource::Write(), gnSequence::contigLength(), gnSequence::erase(), gnSequence::insert(), gnSequence::length(), and gnSequence::size().

string gnMultiSpec::GetSourceName ( | ) const`[inline, virtual]`

| Definition at line 208 of file gnMultiSpec.h. Referenced by gnDNXSource::Write().

gnBaseSpec * gnMultiSpec::GetSpec ( | const uint32 i ) const`[pure virtual]`

  | Get the spec at index i in the list of subspecs. Parameters:
  i | The index of the spec
Returns: The spec. Reimplemented in gnFragmentSpec, and gnGenomeSpec. Referenced by CropEnd(), CropStart(), GetLength(), GetSpecEndBase(), GetSpecIndexByBase(), GetSpecIndexByName(), GetSpecStartBase(), and SeqRead().

gnBaseSpec * gnMultiSpec::GetSpecByBase ( | const gnSeqI baseI ) const`[pure virtual]`

  | Get the spec from the list of subspecs which contains the specified base pair. Parameters:
  baseI | The base pair index.
Returns: The spec. Reimplemented in gnFragmentSpec, and gnGenomeSpec.

gnSeqI gnMultiSpec::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 74 of file gnMultiSpec.cpp.

uint32 gnMultiSpec::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 42 of file gnMultiSpec.cpp. Referenced by gnGenomeSpec::CloneRange(), gnFragmentSpec::CloneRange(), gnGenomeSpec::GetSpecByBase(), gnFragmentSpec::GetSpecByBase(), gnSequence::contigIndexByBase(), and gnSequence::globalToSource().

uint32 gnMultiSpec::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 53 of file gnMultiSpec.cpp. Referenced by gnSequence::contigByName(), and gnSequence::contigIndexByName().

uint32 gnMultiSpec::GetSpecListLength ( | ) const`[pure virtual]`

| Returns the number of subspecs this spec contains. Returns: The number of subspecs this spec contains. Reimplemented in gnFragmentSpec, and gnGenomeSpec. Referenced by CropEnd(), CropStart(), GetLength(), GetSpecEndBase(), GetSpecIndexByBase(), GetSpecIndexByName(), GetSpecStartBase(), gnGenomeSpec::RemoveSpec(), gnFragmentSpec::RemoveSpec(), and SeqRead().

gnSeqI gnMultiSpec::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 62 of file gnMultiSpec.cpp. Referenced by gnGenomeSpec::CloneRange(), gnFragmentSpec::CloneRange(), gnGenomeSpec::GetFeature(), gnSequence::contigStart(), and gnSequence::globalToSource().

void gnMultiSpec::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 Reimplemented in gnFragmentSpec, and gnGenomeSpec.

void gnMultiSpec::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 140 of file gnMultiSpec.cpp. Referenced by gnSequence::removeHeader().

void gnMultiSpec::RemoveSpec ( | uint32 i )`[pure virtual]`

  | Remove a subspec from this spec. Parameters:
  i | The index of the subspec to remove.
Reimplemented in gnFragmentSpec, and gnGenomeSpec. Referenced by CropEnd(), and CropStart().

boolean gnMultiSpec::SeqRead ( | const gnSeqI start,
| gnSeqC * buf,
| uint32 & 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. Reimplemented from gnBaseSpec. Definition at line 148 of file gnMultiSpec.cpp. Referenced by gnSequence::GetSeqC(), gnDNXSource::SeqRead(), gnSequence::ToArray(), and gnSequence::ToString().

void gnMultiSpec::SetSourceName ( | const string & sourceName )`[inline, virtual]`

| Definition at line 213 of file gnMultiSpec.h. Referenced by gnFASSource::GetSpec(), and gnDNXSource::ParseStream().

## Member Data Documentation

vector< gnBaseHeader *> gnMultiSpec::m_headerList<gnBaseHeader*>`[protected]`

| Definition at line 188 of file gnMultiSpec.h.

string gnMultiSpec::m_sourceName`[protected]`

| Reimplemented from gnBaseSpec. Definition at line 186 of file gnMultiSpec.h.

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

- gnMultiSpec.h
- gnMultiSpec.cpp