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

gnDNASequence Class Reference

gnDNASequence is a special kind of gnSequence which can be used for DNA sequences It sets the default filters and comparators to the DNA filters and comparators. More...

#include <gnDNASequence.h>

Inheritance diagram for gnDNASequence:

gnSequence gnClone List of all members.

Public Member Functions

 gnDNASequence ()
 Empty Constructor, creates an empty gnDNASequence.

 gnDNASequence (const gnSeqC *seq)
 Creates a gnDNASequence with a single contig containing the bases in "seq".

 gnDNASequence (const string &str)
 Creates a gnDNASequence with a single contig containing the bases in "str".

 gnDNASequence (const gnGenomeSpec &gngs)
 Creates a gnDNASequence with the contigs stored in "gngs".

 gnDNASequence (const gnFragmentSpec &gnfs)
 Creates a gnDNASequence with the contigs stored in "gnfs".

 gnDNASequence (const gnContigSpec &gncs)
 Creates a gnDNASequence with the contigs stored in "gncs".

 gnDNASequence (gnSeqC *bases, const gnSeqI length)
 Creates a gnDNASequence with a single contig containing the bases in "bases".

 gnDNASequence (const gnDNASequence &seq)
 Copies the gnDNASequence "seq".

gnSequenceClone () const
gnSeqI contigListSize () const
 Returns the number of sequence fragments in this sequence.

gnSeqI contigListLength () const
 Returns the number of sequence fragments in this sequence.

uint32 contigIndexByBase (const gnSeqI baseI) const
 Returns the index of the contig which contains the specified base.

gnSequence contig (const uint32 contigI) const
 Returns a gnSequence containing the specified fragment.

gnSequence contigByBase (const gnSeqI baseI) const
 Returns a gnSequence containing only the fragment which contains the specified base.

virtual gnSeqI contigStart (const uint32 contigI) const
 Returns the index of the base pair where the specified contig starts in this sequence.

virtual gnSeqI contigLength (const uint32 contigI) const
 Returns the length in base pairs of the specified contig in this sequence.

virtual uint32 contigIndexByName (string &contigName) const
 Returns the index of the contig with the given name.

virtual string contigName (const uint32 contigI) const
 Returns the name of the specified contig.

virtual gnSequence contigByName (string &contigName) const
 Returns a gnSequence containing only the named contig.

virtual void merge (const gnSeqI startI, const gnSeqI endI)
 Merges the bases starting at base index "startI" and ending at "endI" into one contig, splitting existing contigs.

virtual void mergeContigs (const uint32 startC, const uint32 endC)
 Merges the contigs starting at the contig index "startC" and ending at "endC" into one contig.

virtual void splitContig (const gnSeqI splitI, const uint32 contigI=ALL_CONTIGS)
 Splits the specified contig after splitI.

virtual void setContigName (const uint32 contigI, const string &contig_name)
virtual uint32 getFeatureListLength () const
 Returns the size of the feature list for the specified contig.

virtual gnBaseFeaturegetFeature (const uint32 featureI) const
 Returns the feature specified by featureI.

virtual void getContainedFeatures (const gnLocation &lt, vector< gnBaseFeature * > &feature_vector, vector< uint32 > &index_vector) const
 Creates a list of all features which are contained by coordinates specified.

virtual void getIntersectingFeatures (const gnLocation &lt, vector< gnBaseFeature * > &feature_vector, vector< uint32 > &index_vector) const
 Creates a list of all features which intersect the coordinates specified.

virtual uint32 addFeature (gnBaseFeature *feature)
 Adds the specified feature to the feature list.

virtual void removeFeature (const uint32 featureI)
 Removes the specified feature.

virtual void getBrokenFeatures (const gnLocation &lt, vector< gnBaseFeature * > &feature_vector) const
 Creates a list of features which may have been broken by an edit.

virtual uint32 getHeaderListLength (const uint32 contigI) const
 Returns the size of the header list for the specified contig.

virtual gnBaseHeadergetHeader (const uint32 contigI, const uint32 headerI) const
 Returns the feature specified by featureI.

virtual void addHeader (const uint32 contigI, gnBaseHeader *header, const uint32 headerI)
 Adds header information to a specified contig.

virtual void removeHeader (const uint32 contigI, const uint32 headerI)
 Removes header information from a specified contig.

virtual void setReverseComplement (const boolean revComp, const uint32 contigI=ALL_CONTIGS)
 Reverse complements a specified contig, or the entire sequence if ALL_CONTIGS is specified.

virtual boolean isReverseComplement (const uint32 contigI=ALL_CONTIGS)
 Returns true if a specified contig, or the entire sequence is reverse complement.

virtual boolean isCircular () const
 Returns true if this sequence is circular.

virtual void setCircular (const boolean value)
 Sets whether this sequence should be read circular.

virtual void globalToLocal (uint32 &contigI, gnSeqI &baseI) const
 Converts the global sequence coordinate baseI to a contig local coordinate.

virtual void localToGlobal (const uint32 contigI, gnSeqI &baseI) const
 Converts the local contig coordinate baseI to a global sequence coordinate.

virtual void globalToSource (uint32 &contigI, gnSeqI &baseI) const
 Converts the global sequence coordinate baseI to a local coordinate in the original data source.

virtual void localToSource (uint32 &contigI, gnSeqI &baseI) const
 Converts the contig local sequence coordinate baseI in contig contigI to a local coordinate in the original data source.

virtual bool LoadSource (const string sourcename)
 Loads the sequence located at the URL in "sourcename".

virtual void setFilter (const gnBaseFilter *filt)
 Assigns a filter which all sequence data must pass through when read from the object.

virtual void setFilterList (list< const gnBaseFilter * > &filt_list)
 Assigns a list of filters which all sequence data passes through in order when read from the object.

virtual list< const gnBaseFilter * > getFilterList () const
 Returns the list of filters currently being used.

virtual void assign (gnSequence &seq)
 Assigns the sequence "seq" to this sequence.

boolean operator== (const gnSequence &seq) const
boolean operator!= (const gnSequence &seq) const
boolean operator< (const gnSequence &seq) const
boolean operator<= (const gnSequence &seq) const
boolean operator> (const gnSequence &seq) const
boolean operator>= (const gnSequence &seq) const
gnSequenceoperator+= (const gnSequence &seq)
 Appends the bases in "seq" to this sequence.

virtual int compare (const gnSequence &seq) const
 Compares the bases in "seq" to this sequence.

virtual int compare (const string &str) const
virtual void append (const gnSequence &seq)
 Appends the bases in "seq" to this sequence.

virtual void insert (const gnSeqI offset, const gnSeqC *bases, const gnSeqI length)
 Inserts the first "len" bases in "bases" into this sequence.at "offset".

virtual void insert (const gnSeqI offset, const gnSequence &seq)
 Inserts the annotated sequence in "seq" into this sequence.at "offset".

virtual void insert (const gnSeqI offset, const gnGenomeSpec &gnbs)
 Inserts the annotated sequence in "gnbs" into this sequence.at "offset".

gnSequence const operator+ (const gnSequence &seq) const
 Concatenates this sequence with the annotated sequence in "seq".

gnSequence subseq (const gnSeqI offset, const gnSeqI length) const
 Creates a sequence containing the "length" bases starting at "offset".

virtual void erase (const gnSeqI offset=0, const gnSeqI length=GNSEQI_END)
 Deletes the "len" bases starting at "offset".

virtual gnSeqI length () const
 Returns the length of this sequence.

virtual gnSeqI size () const
 Returns the length of this sequence.

virtual string ToString (const gnSeqI length=GNSEQI_END, const gnSeqI offset=1) const
 Returns the "length" bases starting at "offset" as a string.

virtual boolean ToString (string &str, const gnSeqI length=GNSEQI_END, const gnSeqI offset=1) const
 Converts the "length" bases starting at "offset" into the string "str".

virtual boolean ToArray (gnSeqC *pSeqC, gnSeqI length, const gnSeqI offset=1) const
 Converts the "length" bases starting at "offset" into the character array "pSeqC"..

virtual gnSeqC GetSeqC (const gnSeqI offset) const
 Returns the base at "offset".

gnSeqC operator[] (const gnSeqI offset) const
 Returns the base at the specified index.

virtual gnGenomeSpecGetSpec () const
 Get the spec (annotated sequence) which this sequence represents.

virtual void SetSpec (gnGenomeSpec *s)
 Set the spec (annotated sequence) which this sequence represents.

virtual gnSeqI find (const gnSequence &search, const gnSeqI offset=0) const
 Find looks for the search sequence within this gnSequence and returns the position of the first match if any exists.


Private Attributes

gnGenomeSpecspec
list< const gnBaseFilter * > filter_list
const gnComparecomparator

Friends

std::istream & operator>> (std::istream &is, gnSequence &gns)
 Reads bases from the specified input stream (e.g.

std::ostream & operator<< (std::ostream &os, const gnSequence &gns)
 Writes the bases in this sequence to the specified output stream (e.g.


Detailed Description

gnDNASequence is a special kind of gnSequence which can be used for DNA sequences It sets the default filters and comparators to the DNA filters and comparators.

Definition at line 27 of file gnDNASequence.h.


Constructor & Destructor Documentation

gnDNASequence::gnDNASequence   [inline]
 

Empty Constructor, creates an empty gnDNASequence.

Definition at line 77 of file gnDNASequence.h.

References comparator, gnCompare::DNASeqCompare(), and filter_list.

gnDNASequence::gnDNASequence const gnSeqC   seq [inline]
 

Creates a gnDNASequence with a single contig containing the bases in "seq".

Parameters:
seq The null terminated array of base pairs to use.

Definition at line 82 of file gnDNASequence.h.

References comparator, gnCompare::DNASeqCompare(), and filter_list.

gnDNASequence::gnDNASequence const string &    str [inline]
 

Creates a gnDNASequence with a single contig containing the bases in "str".

Parameters:
str The base pairs to use.

Definition at line 87 of file gnDNASequence.h.

References comparator, gnCompare::DNASeqCompare(), and filter_list.

gnDNASequence::gnDNASequence const gnGenomeSpec   gngs [inline]
 

Creates a gnDNASequence with the contigs stored in "gngs".

Parameters:
gngs the gnGenomeSpec to get contigs from.

Definition at line 92 of file gnDNASequence.h.

References comparator, gnCompare::DNASeqCompare(), and filter_list.

gnDNASequence::gnDNASequence const gnFragmentSpec   gnfs [inline]
 

Creates a gnDNASequence with the contigs stored in "gnfs".

Parameters:
gnfs the gnFragmentSpec to get contigs from.

Definition at line 97 of file gnDNASequence.h.

References comparator, gnCompare::DNASeqCompare(), and filter_list.

gnDNASequence::gnDNASequence const gnContigSpec   gncs [inline]
 

Creates a gnDNASequence with the contigs stored in "gncs".

Parameters:
gncs the gnContigSpec to get contigs from.

Definition at line 102 of file gnDNASequence.h.

References comparator, gnCompare::DNASeqCompare(), and filter_list.

gnDNASequence::gnDNASequence gnSeqC   bases,
const gnSeqI    length
[inline]
 

Creates a gnDNASequence with a single contig containing the bases in "bases".

Parameters:
bases The base pairs to use
length The length of the base pair array.

Definition at line 107 of file gnDNASequence.h.

References comparator, gnCompare::DNASeqCompare(), and filter_list.

gnDNASequence::gnDNASequence const gnDNASequence &    seq [inline]
 

Copies the gnDNASequence "seq".

Parameters:
seq The gnDNASequence to copy.

Definition at line 112 of file gnDNASequence.h.

References comparator, gnCompare::DNASeqCompare(), and filter_list.


Member Function Documentation

uint32 gnSequence::addFeature gnBaseFeature   feature [inline, virtual, inherited]
 

Adds the specified feature to the feature list.

Parameters:
feature The feature to add.
Returns:
The feature index.

Definition at line 566 of file gnSequence.h.

References gnGenomeSpec::AddFeature(), gnSequence::spec, and uint32.

void gnSequence::addHeader const uint32    contigI,
gnBaseHeader   header,
const uint32    headerI
[virtual, inherited]
 

Adds header information to a specified contig.

Parameters:
contigI The index of the contig to use, or ALL_CONTIGS to add a general header.
header The header to add.
headerI The index in the header list where this header should be inserted.
Exceptions:
FragmentIndexOutOfBounds will be propagated if contigI is invalid

Definition at line 487 of file gnSequence.cpp.

References gnMultiSpec::AddHeader(), gnGenomeSpec::GetSpec(), gnSequence::spec, STACK_TRACE_END, and STACK_TRACE_START.

void gnSequence::append const gnSequence   seq [inline, virtual, inherited]
 

Appends the bases in "seq" to this sequence.

Parameters:
seq The sequence to append to this sequence.

Definition at line 553 of file gnSequence.h.

References gnSequence::insert(), and gnSequence::spec.

Referenced by main(), and operator>>().

void gnSequence::assign gnSequence   seq [inline, virtual, inherited]
 

Assigns the sequence "seq" to this sequence.

Parameters:
seq The seqence to assign to this sequence.

Definition at line 519 of file gnSequence.h.

References gnGenomeSpec::Clone(), and gnSequence::spec.

gnSequence * gnSequence::Clone   const [virtual, inherited]
 

Implements gnClone.

Definition at line 89 of file gnSequence.cpp.

References gnSequence::gnSequence().

int gnSequence::compare const string &    str const [virtual, inherited]
 

Definition at line 94 of file gnSequence.cpp.

References gnSequence::comparator, gnSeqI, gnSequence::length(), gnCompare::LessThan(), STACK_TRACE_END, STACK_TRACE_START, and gnSequence::ToString().

int gnSequence::compare const gnSequence   seq const [virtual, inherited]
 

Compares the bases in "seq" to this sequence.

Parameters:
seq The sequence to compare this sequence to.
Returns:
Negative if this sequence is lesser, 0 if the two sequences are equal, and positive if this sequence is greater.

Definition at line 120 of file gnSequence.cpp.

References gnSequence::comparator, gnSeqI, gnSequence::length(), gnCompare::LessThan(), STACK_TRACE_END, STACK_TRACE_START, and gnSequence::ToString().

Referenced by gnSequence::operator!=(), gnSequence::operator<(), gnSequence::operator<=(), gnSequence::operator==(), gnSequence::operator>(), and gnSequence::operator>=().

gnSequence gnSequence::contig const uint32    contigI const [inherited]
 

Returns a gnSequence containing the specified fragment.

Parameters:
contigI The index of the fragment to get.
Exceptions:
FragmentIndexOutOfBounds will be propagated if contigI is invalid
Returns:
A gnSequence containing only the fragment.

Definition at line 345 of file gnSequence.cpp.

References gnGenomeSpec::GetSpec(), gnSequence::gnSequence(), gnSequence::spec, STACK_TRACE_END, and STACK_TRACE_START.

Referenced by gnSequence::isReverseComplement(), and gnSequence::setReverseComplement().

gnSequence gnSequence::contigByBase const gnSeqI    baseI const [inherited]
 

Returns a gnSequence containing only the fragment which contains the specified base.

Parameters:
baseI A base pair index in the contig
Exceptions:
SeqIndexOutOfBounds will be propagated if baseI is invalid
Returns:
A gnSequence containing only the contig.

Definition at line 353 of file gnSequence.cpp.

References gnGenomeSpec::GetSpecByBase(), gnSequence::gnSequence(), gnSequence::spec, STACK_TRACE_END, and STACK_TRACE_START.

gnSequence gnSequence::contigByName string &    contigName const [virtual, inherited]
 

Returns a gnSequence containing only the named contig.

If two contigs have the same name, contigByName() will return the first.

Parameters:
contigName The name of the contig.
Exceptions:
FragmentIndexOutOfBounds will be propagated if contigName is not found
Returns:
A gnSequence containing the contig.

Definition at line 431 of file gnSequence.cpp.

References gnGenomeSpec::GetSpec(), gnMultiSpec::GetSpecIndexByName(), gnSequence::gnSequence(), gnSequence::spec, STACK_TRACE_END, STACK_TRACE_START, and uint32.

uint32 gnSequence::contigIndexByBase const gnSeqI    baseI const [inherited]
 

Returns the index of the contig which contains the specified base.

Parameters:
baseI A base pair in the contig.
Exceptions:
SeqIndexOutOfBounds will be propagated if baseI is invalid
Returns:
The contig index which contains the base.

Definition at line 340 of file gnSequence.cpp.

References gnMultiSpec::GetSpecIndexByBase(), gnSequence::spec, STACK_TRACE_END, STACK_TRACE_START, and uint32.

Referenced by gnSequence::globalToLocal().

uint32 gnSequence::contigIndexByName string &    contigName const [virtual, inherited]
 

Returns the index of the contig with the given name.

If two contigs have the same name, contigIndexByName() will return the first.

Parameters:
contigName The name of the contig.
Exceptions:
FragmentIndexOutOfBounds will be propagated if contigName is not found
Returns:
The index of the contig.

Definition at line 358 of file gnSequence.cpp.

References gnMultiSpec::GetSpecIndexByName(), gnSequence::spec, STACK_TRACE_END, STACK_TRACE_START, and uint32.

gnSeqI gnSequence::contigLength const uint32    contigI const [virtual, inherited]
 

Returns the length in base pairs of the specified contig in this sequence.

Parameters:
contigI The index of the contig.
Exceptions:
FragmentIndexOutOfBounds will be propagated if contigI is invalid
Returns:
The length of the contig.

Definition at line 372 of file gnSequence.cpp.

References gnMultiSpec::GetLength(), gnGenomeSpec::GetSpec(), gnSeqI, gnSequence::spec, STACK_TRACE_END, and STACK_TRACE_START.

Referenced by gnSequence::localToGlobal(), gnGBKSource::Write(), and gnFASSource::Write().

gnSeqI gnSequence::contigListLength   const [inherited]
 

Returns the number of sequence fragments in this sequence.

Returns:
the number of sequence fragments in this sequence.

Definition at line 333 of file gnSequence.cpp.

References gnGenomeSpec::GetSpecListLength(), gnSeqI, gnSequence::spec, STACK_TRACE_END, and STACK_TRACE_START.

Referenced by gnFASSource::Write().

gnSeqI gnSequence::contigListSize   const [inherited]
 

Returns the number of sequence fragments in this sequence.

Returns:
the number of sequence fragments in this sequence.

Definition at line 328 of file gnSequence.cpp.

References gnGenomeSpec::GetSpecListLength(), gnSeqI, gnSequence::spec, STACK_TRACE_END, and STACK_TRACE_START.

string gnSequence::contigName const uint32    contigI const [virtual, inherited]
 

Returns the name of the specified contig.

Parameters:
contigI The index of the contig.
Exceptions:
FragmentIndexOutOfBounds will be propagated if contigI is invalid
Returns:
The name of the contig.

Definition at line 378 of file gnSequence.cpp.

References gnBaseSpec::GetName(), gnGenomeSpec::GetSpec(), gnSequence::spec, STACK_TRACE_END, and STACK_TRACE_START.

Referenced by gnFASSource::Write().

gnSeqI gnSequence::contigStart const uint32    contigI const [virtual, inherited]
 

Returns the index of the base pair where the specified contig starts in this sequence.

Parameters:
contigI The index of the contig.
Exceptions:
FragmentIndexOutOfBounds will be propagated if contigI is invalid
Returns:
The starting base pair index.

Definition at line 364 of file gnSequence.cpp.

References gnMultiSpec::GetSpecStartBase(), gnSeqI, int64, gnSequence::spec, STACK_TRACE_END, and STACK_TRACE_START.

Referenced by gnSequence::globalToLocal(), gnSequence::localToGlobal(), and gnGBKSource::Write().

void gnSequence::erase const gnSeqI    offset = 0,
const gnSeqI    length = GNSEQI_END
[virtual, inherited]
 

Deletes the "len" bases starting at "offset".

Parameters:
offset The base pair index to start erasing.
length The length of the sequence to erase

Definition at line 200 of file gnSequence.cpp.

References gnGenomeSpec::CloneRange(), gnMultiSpec::CropEnd(), gnMultiSpec::GetLength(), gnSeqI, gnSequence::insert(), gnSequence::length(), SeqIndexOutOfBounds(), gnSequence::spec, STACK_TRACE_END, STACK_TRACE_START, Throw_gnEx, and uint32.

gnSeqI gnSequence::find const gnSequence   search,
const gnSeqI    offset = 0
const [virtual, inherited]
 

Find looks for the search sequence within this gnSequence and returns the position of the first match if any exists.

Parameters:
search The gnSequence to be found
offset The position where searching will begin (default is 0)
Returns:
The first position where the search string is found or GNSEQI_ERROR if the search sequence is not found.

Definition at line 532 of file gnSequence.cpp.

References gnSeqI, GNSEQI_ERROR, STACK_TRACE_END, and STACK_TRACE_START.

void gnSequence::getBrokenFeatures const gnLocation   lt,
vector< gnBaseFeature * > &    feature_vector
const [inline, virtual, inherited]
 

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. Each feature pointer points to a copy of the feature on the heap which must be deleted.

Definition at line 582 of file gnSequence.h.

References gnGenomeSpec::GetBrokenFeatures(), and gnSequence::spec.

void gnSequence::getContainedFeatures const gnLocation   lt,
vector< gnBaseFeature * > &    feature_vector,
vector< uint32 > &    index_vector
const [inline, virtual, inherited]
 

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. Each feature pointer points to a copy of the feature on the heap which must be deleted.
index_vector A vector of indices which correspond to the features.

Definition at line 574 of file gnSequence.h.

References gnGenomeSpec::GetContainedFeatures(), and gnSequence::spec.

gnBaseFeature * gnSequence::getFeature const uint32    featureI const [inline, virtual, inherited]
 

Returns the feature specified by featureI.

Parameters:
featureI The index of the feature to return.
Exceptions:
FeatureIndexOutOfBounds exception is thrown if featureI does not reference a valid feature
Returns:
A copy of the feature allocated on the heap. You must delete the feature when finished with it.

Definition at line 562 of file gnSequence.h.

References gnGenomeSpec::GetFeature(), and gnSequence::spec.

uint32 gnSequence::getFeatureListLength   const [inline, virtual, inherited]
 

Returns the size of the feature list for the specified contig.

Returns:
The feature list size.

Definition at line 558 of file gnSequence.h.

References gnGenomeSpec::GetFeatureListLength(), gnSequence::spec, and uint32.

list< const gnBaseFilter * > gnSequence::getFilterList   const [inline, virtual, inherited]
 

Returns the list of filters currently being used.

Returns:
The list of filters in use.

Definition at line 631 of file gnSequence.h.

References gnSequence::filter_list.

gnBaseHeader * gnSequence::getHeader const uint32    contigI,
const uint32    headerI
const [virtual, inherited]
 

Returns the feature specified by featureI.

Parameters:
contigI The index of the contig to use, or ALL_CONTIGS to get a general header.
headerI The index of the header to return.
Exceptions:
FragmentIndexOutOfBounds will be propagated if contigI is invalid
HeaderIndexOutOfBounds will be propagated if headerI is invalid
Returns:
The header, or NULL if headerI is out of range.

Definition at line 477 of file gnSequence.cpp.

References gnMultiSpec::GetHeader(), gnGenomeSpec::GetSpec(), gnSequence::spec, STACK_TRACE_END, and STACK_TRACE_START.

uint32 gnSequence::getHeaderListLength const uint32    contigI const [virtual, inherited]
 

Returns the size of the header list for the specified contig.

Parameters:
contigI The index of the contig to use, or ALL_CONTIGS to add a general header.
Exceptions:
FragmentIndexOutOfBounds will be propagated if contigI is invalid
Returns:
The header list size.

Definition at line 467 of file gnSequence.cpp.

References gnMultiSpec::GetHeaderListLength(), gnGenomeSpec::GetSpec(), gnSequence::spec, STACK_TRACE_END, STACK_TRACE_START, and uint32.

void gnSequence::getIntersectingFeatures const gnLocation   lt,
vector< gnBaseFeature * > &    feature_vector,
vector< uint32 > &    index_vector
const [inline, virtual, inherited]
 

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. Each feature pointer points to a copy of the feature on the heap which must be deleted.
index_vector A vector of indices which correspond to the features.

Definition at line 578 of file gnSequence.h.

References gnGenomeSpec::GetIntersectingFeatures(), and gnSequence::spec.

gnSeqC gnSequence::GetSeqC const gnSeqI    offset const [virtual, inherited]
 

Returns the base at "offset".

Parameters:
offset The index of the base to get.
Returns:
The base.

Definition at line 302 of file gnSequence.cpp.

References gnSequence::filter_list, gnSeqC, GNSEQC_NULL, gnSeqI, gnMultiSpec::SeqRead(), gnSequence::spec, STACK_TRACE_END, and STACK_TRACE_START.

Referenced by gnSequence::operator[]().

gnGenomeSpec * gnSequence::GetSpec   const [inline, virtual, inherited]
 

Get the spec (annotated sequence) which this sequence represents.

Returns:
The spec represented by this gnSequence.

Definition at line 610 of file gnSequence.h.

References gnSequence::spec.

Referenced by gnSEQSource::Write(), gnGBKSource::Write(), gnFASSource::Write(), and gnDNXSource::Write().

void gnSequence::globalToLocal uint32   contigI,
gnSeqI   baseI
const [virtual, inherited]
 

Converts the global sequence coordinate baseI to a contig local coordinate.

Parameters:
contigI This is set to the index of the contig containing baseI
baseI This is the global coordinate to be converted to contig local.
Exceptions:
SeqIndexOutOfBounds will be thrown if baseI is out of range

Definition at line 384 of file gnSequence.cpp.

References gnSequence::contigIndexByBase(), gnSequence::contigStart(), STACK_TRACE_END, and STACK_TRACE_START.

void gnSequence::globalToSource uint32   contigI,
gnSeqI   baseI
const [virtual, inherited]
 

Converts the global sequence coordinate baseI to a local coordinate in the original data source.

globalToSource() will overwrite any values passed to it!

Parameters:
contigI This will be set to contig index in the original source.
baseI This will be set to the contig local base index in the original source.
Exceptions:
SeqIndexOutOfBounds will be thrown if baseI is out of range

Definition at line 399 of file gnSequence.cpp.

References gnContigSpec::GetSourceContigIndex(), gnContigSpec::GetSourceLength(), gnFragmentSpec::GetSpec(), gnGenomeSpec::GetSpec(), gnMultiSpec::GetSpecIndexByBase(), gnMultiSpec::GetSpecStartBase(), gnContigSpec::GetStart(), gnSeqI, gnBaseSpec::IsReverseComplement(), gnSequence::spec, STACK_TRACE_END, and STACK_TRACE_START.

Referenced by gnSequence::localToSource().

void gnSequence::insert const gnSeqI    offset,
const gnGenomeSpec   gnbs
[virtual, inherited]
 

Inserts the annotated sequence in "gnbs" into this sequence.at "offset".

insert() will update the locations of all affected features.

Parameters:
offset The base pair to insert before.
gnbs The spec to insert.

Definition at line 155 of file gnSequence.cpp.

References gnGenomeSpec::AddSpec(), gnGenomeSpec::Clone(), gnFragmentSpec::Clone(), gnMultiSpec::CropEnd(), gnMultiSpec::CropStart(), gnMultiSpec::GetLength(), gnGenomeSpec::GetSpec(), gnGenomeSpec::GetSpecListLength(), gnSeqI, GNSEQI_END, gnSequence::insert(), SeqIndexOutOfBounds(), gnSequence::spec, STACK_TRACE_END, STACK_TRACE_START, Throw_gnEx, and uint32.

void gnSequence::insert const gnSeqI    offset,
const gnSequence   seq
[inline, virtual, inherited]
 

Inserts the annotated sequence in "seq" into this sequence.at "offset".

insert() will update the locations of all affected features.

Parameters:
offset The base pair to insert before.
seq The sequence to insert.

Definition at line 596 of file gnSequence.h.

References gnSequence::insert(), and gnSequence::spec.

void gnSequence::insert const gnSeqI    offset,
const gnSeqC   bases,
const gnSeqI    length
[virtual, inherited]
 

Inserts the first "len" bases in "bases" into this sequence.at "offset".

insert() will update the locations of all affected features.

Parameters:
offset The base pair to insert before.
bases The character array of bases to insert.
length The length of the character array.

Definition at line 146 of file gnSequence.cpp.

References STACK_TRACE_END, and STACK_TRACE_START.

Referenced by gnSequence::append(), gnSequence::erase(), gnSequence::insert(), gnSequence::operator+=(), and gnSequence::splitContig().

boolean gnSequence::isCircular   const [inline, virtual, inherited]
 

Returns true if this sequence is circular.

Returns:
True if this sequence is circular.

Definition at line 587 of file gnSequence.h.

References gnBaseSpec::IsCircular(), and gnSequence::spec.

boolean gnSequence::isReverseComplement const uint32    contigI = ALL_CONTIGS [virtual, inherited]
 

Returns true if a specified contig, or the entire sequence is reverse complement.

Parameters:
contigI The index of the contig to use, or ALL_CONTIGS for the whole sequence.
Exceptions:
FragmentIndexOutOfBounds will be propagated if contigI is invalid
Returns:
True if the sequence is reverse complement, false otherwise.

Definition at line 458 of file gnSequence.cpp.

References gnSequence::contig(), gnGenomeSpec::GetSpec(), gnBaseSpec::IsReverseComplement(), gnSequence::spec, STACK_TRACE_END, and STACK_TRACE_START.

gnSeqI gnSequence::length   const [inline, virtual, inherited]
 

Returns the length of this sequence.

Returns:
the length of this sequence.

Definition at line 602 of file gnSequence.h.

References gnMultiSpec::GetLength(), gnSeqI, and gnSequence::spec.

Referenced by gnSequence::compare(), gnSequence::erase(), gnSequence::splitContig(), gnSequence::ToString(), and gnRAWSource::Write().

bool gnSequence::LoadSource const string    sourcename [virtual, inherited]
 

Loads the sequence located at the URL in "sourcename".

Possible URLs currently include only "file:///" URLs. If no URL prefix is found then LoadSource assumes that "sourcename" contains the name of a local file.

Parameters:
sourcename The location of the data to load.
Returns:
True if successful. False otherwise.

Definition at line 517 of file gnSequence.cpp.

References gnSourceFactory::GetSourceFactory(), gnBaseSource::GetSpec(), gnSequence::spec, STACK_TRACE_END, and STACK_TRACE_START.

void gnSequence::localToGlobal const uint32    contigI,
gnSeqI   baseI
const [virtual, inherited]
 

Converts the local contig coordinate baseI to a global sequence coordinate.

Parameters:
contigI The index of the contig containing baseI.
baseI The local contig coordinate to be converted to global.
Exceptions:
SeqIndexOutOfBounds will be thrown if baseI is out of range
FragmentIndexOutOfBounds will be propagated if contigI is invalid

Definition at line 391 of file gnSequence.cpp.

References gnSequence::contigLength(), gnSequence::contigStart(), SeqIndexOutOfBounds(), STACK_TRACE_END, STACK_TRACE_START, and Throw_gnEx.

Referenced by gnSequence::localToSource(), and gnSequence::splitContig().

void gnSequence::localToSource uint32   contigI,
gnSeqI   baseI
const [virtual, inherited]
 

Converts the contig local sequence coordinate baseI in contig contigI to a local coordinate in the original data source.

localToSource() will overwrite any values passed to it!

Parameters:
contigI This will be set to contig index in the original source.
baseI This will be set to the contig local base index in the original source.
Exceptions:
SeqIndexOutOfBounds will be thrown if baseI is out of range
FragmentIndexOutOfBounds will be propagated if contigI is invalid

Definition at line 424 of file gnSequence.cpp.

References gnSequence::globalToSource(), gnSequence::localToGlobal(), STACK_TRACE_END, and STACK_TRACE_START.

void gnSequence::merge const gnSeqI    startI,
const gnSeqI    endI
[virtual, inherited]
 

Merges the bases starting at base index "startI" and ending at "endI" into one contig, splitting existing contigs.

Parameters:
startI The starting base pair of the new contig.
endI The ending base pair of the new contig.
Exceptions:
SeqIndexOutOfBounds exception is propagated if startI or endI are invalid

Definition at line 506 of file gnSequence.cpp.

References STACK_TRACE_END, and STACK_TRACE_START.

void gnSequence::mergeContigs const uint32    startC,
const uint32    endC
[virtual, inherited]
 

Merges the contigs starting at the contig index "startC" and ending at "endC" into one contig.

Parameters:
startC The starting contig of the new contig.
endC The ending contig of the new contig.
Exceptions:
FragmentIndexOutOfBounds exception is propagated if startC or endC are invalid

Definition at line 511 of file gnSequence.cpp.

References gnGenomeSpec::MergeFragments(), gnSequence::spec, STACK_TRACE_END, and STACK_TRACE_START.

boolean gnSequence::operator!= const gnSequence   seq const [inline, inherited]
 

Definition at line 527 of file gnSequence.h.

References gnSequence::compare().

gnSequence const gnSequence::operator+ const gnSequence   seq const [inherited]
 

Concatenates this sequence with the annotated sequence in "seq".

Definition at line 179 of file gnSequence.cpp.

References STACK_TRACE_END, and STACK_TRACE_START.

gnSequence & gnSequence::operator+= const gnSequence   seq [inline, inherited]
 

Appends the bases in "seq" to this sequence.

Definition at line 548 of file gnSequence.h.

References gnSequence::insert(), and gnSequence::spec.

boolean gnSequence::operator< const gnSequence   seq const [inline, inherited]
 

Definition at line 531 of file gnSequence.h.

References gnSequence::compare().

boolean gnSequence::operator<= const gnSequence   seq const [inline, inherited]
 

Definition at line 535 of file gnSequence.h.

References gnSequence::compare().

boolean gnSequence::operator== const gnSequence   seq const [inline, inherited]
 

Definition at line 523 of file gnSequence.h.

References gnSequence::compare().

boolean gnSequence::operator> const gnSequence   seq const [inline, inherited]
 

Definition at line 539 of file gnSequence.h.

References gnSequence::compare().

boolean gnSequence::operator>= const gnSequence   seq const [inline, inherited]
 

Definition at line 543 of file gnSequence.h.

References gnSequence::compare().

gnSeqC gnSequence::operator[] const gnSeqI    offset const [inherited]
 

Returns the base at the specified index.

Returns:
The base at the specified index.

Definition at line 321 of file gnSequence.cpp.

References gnSequence::GetSeqC(), gnSeqC, STACK_TRACE_END, and STACK_TRACE_START.

void gnSequence::removeFeature const uint32    featureI [inline, virtual, inherited]
 

Removes the specified feature.

Parameters:
featureI The index in the feature list of the feature to remove.
Exceptions:
FeatureIndexOutOfBounds exception is thrown if featureI does not reference a valid feature

Definition at line 570 of file gnSequence.h.

References gnGenomeSpec::RemoveFeature(), and gnSequence::spec.

void gnSequence::removeHeader const uint32    contigI,
const uint32    headerI
[virtual, inherited]
 

Removes header information from a specified contig.

Parameters:
contigI The index of the contig to use, or ALL_CONTIGS to remove a general header.
headerI The index in the header list of the header to remove.
Exceptions:
FragmentIndexOutOfBounds will be propagated if contigI is invalid

Definition at line 497 of file gnSequence.cpp.

References gnGenomeSpec::GetSpec(), gnMultiSpec::RemoveHeader(), gnSequence::spec, STACK_TRACE_END, and STACK_TRACE_START.

void gnSequence::setCircular const boolean    value [inline, virtual, inherited]
 

Sets whether this sequence should be read circular.

If circular is set, reads beyond the end of the sequence will pick up at the beginning.

Parameters:
value True for circular, false otherwise.

Definition at line 592 of file gnSequence.h.

References gnBaseSpec::SetCircular(), and gnSequence::spec.

void gnSequence::setContigName const uint32    contigI,
const string &    contig_name
[virtual, inherited]
 

Definition at line 438 of file gnSequence.cpp.

References gnGenomeSpec::GetSpec(), gnBaseSpec::SetName(), gnSequence::spec, STACK_TRACE_END, and STACK_TRACE_START.

void gnSequence::setFilter const gnBaseFilter   filt [inline, virtual, inherited]
 

Assigns a filter which all sequence data must pass through when read from the object.

Parameters:
filt The filter to use.

Definition at line 621 of file gnSequence.h.

References gnSequence::filter_list.

void gnSequence::setFilterList list< const gnBaseFilter * > &    filt_list [inline, virtual, inherited]
 

Assigns a list of filters which all sequence data passes through in order when read from the object.

There may not be any NULL pointers in the list.

Parameters:
filt_list The ordered list of filters to use.

Definition at line 627 of file gnSequence.h.

References gnSequence::filter_list.

void gnSequence::setReverseComplement const boolean    revComp,
const uint32    contigI = ALL_CONTIGS
[virtual, inherited]
 

Reverse complements a specified contig, or the entire sequence if ALL_CONTIGS is specified.

Parameters:
revComp True if the area should be reverse complement, false otherwise.
contigI The index of the contig to use, or ALL_CONTIGS.
Exceptions:
FragmentIndexOutOfBounds will be propagated if contigI is invalid

Definition at line 447 of file gnSequence.cpp.

References gnSequence::contig(), gnGenomeSpec::GetSpec(), gnFragmentSpec::SetReverseComplement(), gnGenomeSpec::SetReverseComplement(), gnSequence::spec, STACK_TRACE_END, and STACK_TRACE_START.

void gnSequence::SetSpec gnGenomeSpec   s [inline, virtual, inherited]
 

Set the spec (annotated sequence) which this sequence represents.

Parameters:
s The new spec.

Definition at line 614 of file gnSequence.h.

References gnSequence::spec.

gnSeqI gnSequence::size   const [inline, virtual, inherited]
 

Returns the length of this sequence.

Returns:
the length of this sequence.

Definition at line 606 of file gnSequence.h.

References gnMultiSpec::GetLength(), gnSeqI, and gnSequence::spec.

void gnSequence::splitContig const gnSeqI    splitI,
const uint32    contigI = ALL_CONTIGS
[virtual, inherited]
 

Splits the specified contig after splitI.

Parameters:
splitI The base pair to split after.
contigI The index of the contig to split or ALL_CONTIGS by default.

Definition at line 219 of file gnSequence.cpp.

References gnGenomeSpec::Clone(), gnMultiSpec::CropEnd(), gnMultiSpec::CropStart(), gnSeqI, gnSequence::insert(), gnSequence::length(), gnSequence::localToGlobal(), SeqIndexOutOfBounds(), gnSequence::spec, STACK_TRACE_END, STACK_TRACE_START, and Throw_gnEx.

gnSequence gnSequence::subseq const gnSeqI    offset,
const gnSeqI    length
const [inherited]
 

Creates a sequence containing the "length" bases starting at "offset".

Parameters:
offset The base pair index to start the subsequence.
length The length of the subsequence.
Returns:
The subsequence.

Definition at line 187 of file gnSequence.cpp.

References gnGenomeSpec::CloneRange(), gnSequence::gnSequence(), SeqIndexOutOfBounds(), gnSequence::spec, STACK_TRACE_END, STACK_TRACE_START, and Throw_gnEx.

boolean gnSequence::ToArray gnSeqC   pSeqC,
gnSeqI    length,
const gnSeqI    offset = 1
const [virtual, inherited]
 

Converts the "length" bases starting at "offset" into the character array "pSeqC"..

After converting, "length" will be set to the actual length of the sequence. Be sure to null terminate the character array if you are going to print it!

Parameters:
pSeqC The character array of bases to store bases in.
length The length, in base pairs, to convert.
offset The base pair index to start converting.
Returns:
True if successful, false otherwise.

Definition at line 279 of file gnSequence.cpp.

References gnSequence::filter_list, gnSeqC, gnSeqI, GNSEQI_END, gnMultiSpec::SeqRead(), gnSequence::spec, STACK_TRACE_END, and STACK_TRACE_START.

Referenced by gnRAWSource::Write(), gnGBKSource::Write(), and gnFASSource::Write().

boolean gnSequence::ToString string &    str,
const gnSeqI    length = GNSEQI_END,
const gnSeqI    offset = 1
const [virtual, inherited]
 

Converts the "length" bases starting at "offset" into the string "str".

Parameters:
str The string to store bases in.
length The length, in base pairs, to convert.
offset The base pair index to start converting.
Returns:
True if successful, false otherwise.

Definition at line 257 of file gnSequence.cpp.

References Array< T >::data, gnSequence::filter_list, gnSeqI, gnSequence::length(), gnMultiSpec::SeqRead(), gnSequence::spec, STACK_TRACE_END, and STACK_TRACE_START.

string gnSequence::ToString const gnSeqI    length = GNSEQI_END,
const gnSeqI    offset = 1
const [virtual, inherited]
 

Returns the "length" bases starting at "offset" as a string.

Parameters:
length The length of the sequence to convert
offset The base pair index of the sequence to convert
Returns:
The string of base pairs.

Definition at line 249 of file gnSequence.cpp.

References STACK_TRACE_END, and STACK_TRACE_START.

Referenced by gnSequence::compare(), and operator<<().


Friends And Related Function Documentation

std::ostream& operator<< std::ostream &    os,
const gnSequence   gns
[friend, inherited]
 

Writes the bases in this sequence to the specified output stream (e.g.

cout).

Definition at line 245 of file gnSequence.cpp.

std::istream& operator>> std::istream &    is,
gnSequence   gns
[friend, inherited]
 

Reads bases from the specified input stream (e.g.

cin).

Definition at line 239 of file gnSequence.cpp.


Member Data Documentation

const gnCompare* gnDNASequence::comparator [private]
 

Reimplemented from gnSequence.

Definition at line 73 of file gnDNASequence.h.

Referenced by gnDNASequence().

list<const gnBaseFilter*> gnDNASequence::filter_list [private]
 

Reimplemented from gnSequence.

Definition at line 72 of file gnDNASequence.h.

Referenced by gnDNASequence().

gnGenomeSpec* gnDNASequence::spec [private]
 

Reimplemented from gnSequence.

Definition at line 71 of file gnDNASequence.h.


The documentation for this class was generated from the following file:
Generated on Mon Feb 3 02:34:45 2003 for libGenome by doxygen1.3-rc3