Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

AMOS::Kmer_t Class Reference

String of K bases present in the assembly. More...

#include <Kmer_AMOS.hh>

Inheritance diagram for AMOS::Kmer_t:

Inheritance graph
[legend]
Collaboration diagram for AMOS::Kmer_t:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Kmer_t ()
 Constructs an empty Kmer_t object.
 Kmer_t (const Kmer_t &source)
 Copy constructor.
 ~Kmer_t ()
 Destroys a Kmer_t object.
virtual void clear ()
 Clears all object data, reinitializes the object.
char getBase (Pos_t index) const
 Get a single sequence base from the kmer.
uint32_t getCount () const
 Get the number of this Kmer's occurrences.
uint8_t getLength () const
 Gets the length of the Kmer.
virtual NCode_t getNCode () const
 Get the AMOS NCode type identifier.
const std::vector< ID_t > & getReads () const
 Get the containing read IIDs.
std::vector< ID_t > & getReads ()
 Get the containing read IIDs.
std::string getSeqString () const
 Get the Kmer sequence string.
virtual void readMessage (const Message_t &msg)
 Reads in data from a Message object.
void setBase (char seqchar, Pos_t index)
 Set a single sequence base for the kmer.
void setCount (uint32_t count)
 Set the number of this Kmer's occurrences.
void setReads (const std::vector< ID_t > &reads)
 Set the list of containing read IIDs.
void setSeqString (const std::string &seq)
 Set the Kmer sequence string.
Kmer_toperator++ (int)
 Increments kmer count by 1 (postfix).
virtual void writeMessage (Message_t &msg) const
 Writes data to a Message object.
Kmer_toperator= (const Kmer_t &source)
 Assignment (copy) operator.
const std::string & getComment () const
 Get the comment string.
const Status_t getStatus () const
 Get the status value.
void setComment (const std::string &comment)
 Set the comment string.
void setStatus (Status_t status)
 Set the status value.
const std::string & getEID () const
 Get the external ID.
ID_t getIID () const
 Get the internal ID.
bool isRemoved () const
 Check if the object is waiting to be removed from the bank.
bool isModified () const
 Check if the object has been modified.
bool isFlagA () const
 Check the value of flag A.
bool isFlagB () const
 Check the value of flag B.
void setEID (const std::string &eid)
 Set the external ID.
void setFlagA (bool flag)
 Set flag A.
void setFlagB (bool flag)
 Set flag B.
void setIID (ID_t iid)
 Set the internal ID.

Static Public Attributes

const NCode_t NCODE = M_KMER
 The NCode type identifier for this object.
const uint8_t MAX_LENGTH = 255
 Maximum Kmer length.

Protected Member Functions

virtual void readRecord (std::istream &fix, std::istream &var)
 Read selected class members from a biserial record.
virtual void writeRecord (std::ostream &fix, std::ostream &var) const
 Write selected class members to a biserial record.

Static Protected Member Functions

uint8_t compress (char seqchar)
 Compresses a sequence char into two bits.
char uncompress (uint8_t byte)
 Uncompresses two bits into a sequence char.

Protected Attributes

ID_t iid_m
 internal ID (integer AMOS identifier)
std::string eid_m
 external ID (anything you want sans newlines)
BankFlags_t flags_m
 bank flags, derived classes may use "nibble"

Static Protected Attributes

const uint8_t ADENINE_BITS = 0x0
 'A' bit
const uint8_t CYTOSINE_BITS = 0x40
 'C' bit
const uint8_t GUANINE_BITS = 0x80
 'G' bit
const uint8_t THYMINE_BITS = 0xC0
 'T' bit
const uint8_t SEQ_BITS = 0xC0
 sequence bit mask

Detailed Description

String of K bases present in the assembly.

A string of K bases that is present in one or more occurrences throught a set of sequencing reads.

Definition at line 29 of file Kmer_AMOS.hh.


Constructor & Destructor Documentation

AMOS::Kmer_t::Kmer_t  )  [inline]
 

Constructs an empty Kmer_t object.

Sets all members to 0 or NULL Definition at line 118 of file Kmer_AMOS.hh.

AMOS::Kmer_t::Kmer_t const Kmer_t source  )  [inline]
 

Copy constructor.

Definition at line 128 of file Kmer_AMOS.hh.

AMOS::Kmer_t::~Kmer_t  )  [inline]
 

Destroys a Kmer_t object.

Frees the memory used for the compressed sequence Definition at line 140 of file Kmer_AMOS.hh.


Member Function Documentation

void Kmer_t::clear  )  [virtual]
 

Clears all object data, reinitializes the object.

Reimplemented from AMOS::Universal_t.

Definition at line 23 of file Kmer_AMOS.cc.

References AMOS::Universal_t::clear().

Referenced by readMessage(), and writeMessage().

uint8_t AMOS::Kmer_t::compress char  seqchar  )  [inline, static, protected]
 

Compresses a sequence char into two bits.

Note:
Must work with uncompress(uint8_t) method
Parameters:
seqchar The sequence base character
Precondition:
seqchar is A,C,G,T (case insensitive)
Exceptions:
ArgumentException_t 
Returns:
The compressed 2 bits (in the highest two bit positions)
Definition at line 59 of file Kmer_AMOS.hh.

References ADENINE_BITS, AMOS_THROW_ARGUMENT, CYTOSINE_BITS, GUANINE_BITS, and THYMINE_BITS.

Referenced by setBase(), and setSeqString().

char AMOS::Kmer_t::getBase Pos_t  index  )  const [inline]
 

Get a single sequence base from the kmer.

Retrieves and uncompresses the sequence base for the requested index.

Parameters:
index The index of the requested base
Precondition:
index >= 0 && index < length
Exceptions:
ArgumentException_t 
Returns:
The requested (uppercase) base character
Definition at line 171 of file Kmer_AMOS.hh.

References AMOS_THROW_ARGUMENT, AMOS::Pos_t, and uncompress().

const std::string& AMOS::Universal_t::getComment  )  const [inline, inherited]
 

Get the comment string.

Returns:
The comment string
Definition at line 110 of file Universal_AMOS.hh.

Referenced by AMOS::operator<<().

uint32_t AMOS::Kmer_t::getCount  )  const [inline]
 

Get the number of this Kmer's occurrences.

Returns:
The number of occurrrences
Definition at line 184 of file Kmer_AMOS.hh.

const std::string& AMOS::IBankable_t::getEID  )  const [inline, inherited]
 

Get the external ID.

Returns:
The external ID
Definition at line 156 of file Bank_AMOS.hh.

References AMOS::IBankable_t::eid_m.

Referenced by AMOS::Contig_t::writeUMD().

ID_t AMOS::IBankable_t::getIID  )  const [inline, inherited]
 

Get the internal ID.

Returns:
The internal ID
Definition at line 167 of file Bank_AMOS.hh.

References AMOS::ID_t, and AMOS::IBankable_t::iid_m.

Referenced by AMOS::Index_t::buildContigFeature(), AMOS::Index_t::buildContigScaffold(), AMOS::Index_t::buildReadContig(), AMOS::Index_t::buildReadLibrary(), AMOS::Index_t::buildScaffoldFeature(), and AMOS::operator<<().

uint8_t AMOS::Kmer_t::getLength  )  const [inline]
 

Gets the length of the Kmer.

Returns:
The Kmer length
Definition at line 195 of file Kmer_AMOS.hh.

virtual NCode_t AMOS::Kmer_t::getNCode  )  const [inline, virtual]
 

Get the AMOS NCode type identifier.

Returns:
The AMOS NCode type identifier

Reimplemented from AMOS::Universal_t.

Definition at line 202 of file Kmer_AMOS.hh.

References AMOS::NCode_t.

std::vector<ID_t>& AMOS::Kmer_t::getReads  )  [inline]
 

Get the containing read IIDs.

Returns:
The vector of read IIDs that contain this Kmer
Definition at line 224 of file Kmer_AMOS.hh.

const std::vector<ID_t>& AMOS::Kmer_t::getReads  )  const [inline]
 

Get the containing read IIDs.

Returns:
The vector of read IIDs that contain this Kmer
Definition at line 213 of file Kmer_AMOS.hh.

string Kmer_t::getSeqString  )  const
 

Get the Kmer sequence string.

Uncompresses the Kmer sequence and returns a string representation.

Returns:
The Kmer sequence string
Definition at line 34 of file Kmer_AMOS.cc.

References AMOS::NULL_CHAR, AMOS::Pos_t, and uncompress().

Referenced by writeMessage().

const Status_t AMOS::Universal_t::getStatus  )  const [inline, inherited]
 

Get the status value.

Returns:
The status value
Definition at line 121 of file Universal_AMOS.hh.

References AMOS::Status_t.

bool AMOS::IBankable_t::isFlagA  )  const [inline, inherited]
 

Check the value of flag A.

Returns:
The value of flag A
Definition at line 210 of file Bank_AMOS.hh.

References AMOS::IBankable_t::flags_m.

Referenced by AMOS::Universal_t::writeMessage(), and AMOS::Overlap_t::writeMessage().

bool AMOS::IBankable_t::isFlagB  )  const [inline, inherited]
 

Check the value of flag B.

Returns:
The value of flag B
Definition at line 221 of file Bank_AMOS.hh.

References AMOS::IBankable_t::flags_m.

Referenced by AMOS::Universal_t::writeMessage(), and AMOS::Overlap_t::writeMessage().

bool AMOS::IBankable_t::isModified  )  const [inline, inherited]
 

Check if the object has been modified.

Returns:
true if modified, otherwise false
Definition at line 199 of file Bank_AMOS.hh.

References AMOS::IBankable_t::flags_m.

bool AMOS::IBankable_t::isRemoved  )  const [inline, inherited]
 

Check if the object is waiting to be removed from the bank.

Note:
Useful for debugging only
Returns:
true if removed, otherwise false
Definition at line 188 of file Bank_AMOS.hh.

References AMOS::IBankable_t::flags_m.

Kmer_t& AMOS::Kmer_t::operator++ int   )  [inline]
 

Increments kmer count by 1 (postfix).

Increment the kmer count by 1 using postfix notation, i.e. mykmer ++;

Returns:
This kmer, after incrementation
Definition at line 330 of file Kmer_AMOS.hh.

Kmer_t & Kmer_t::operator= const Kmer_t source  ) 
 

Assignment (copy) operator.

Efficiently copies the compressed data from the another Kmer_t.

Parameters:
source The Kmer_t object to copy
Returns:
The resulting Kmer_t object
Definition at line 214 of file Kmer_AMOS.cc.

References AMOS::SafeRealloc(), and AMOS::Size_t.

void Kmer_t::readMessage const Message_t msg  )  [virtual]
 

Reads in data from a Message object.

Reads the data contained in a Message object and stores it in the Messagable object. Will not complain if incoming message is of the wrong type, will only try and suck out the fields it recognizes. All previous data in the Messagable object will be cleared or overwritten.

Parameters:
msg The Message to read from
Precondition:
The expected fields are formatted properly
Exceptions:
ArgumentException_t 
Returns:
void

Reimplemented from AMOS::Universal_t.

Definition at line 55 of file Kmer_AMOS.cc.

References AMOS_THROW_ARGUMENT, clear(), AMOS::F_COUNT, AMOS::F_READS, AMOS::F_SEQUENCE, AMOS::ID_t, AMOS::Universal_t::readMessage(), and setSeqString().

void Kmer_t::readRecord std::istream &  fix,
std::istream &  var
[protected, virtual]
 

Read selected class members from a biserial record.

Reads the fixed and variable length streams from a biserial record and initializes the class members to the values stored within. Used in translating a biserial IBankable object, and needed to retrieve objects from a bank.

Note:
This method must be able to interpret the biserial record produced by its related function writeRecord.
Parameters:
fix The fixed length stream (stores all fixed length members)
var The variable length stream (stores all var length members)
Precondition:
The get pointer of fix is at the beginning of the record

The get pointer of var is at the beginning of the record

Returns:
void

Reimplemented from AMOS::Universal_t.

Definition at line 102 of file Kmer_AMOS.cc.

References AMOS::NULL_ID, AMOS::Pos_t, AMOS::readLE(), AMOS::Universal_t::readRecord(), AMOS::SafeRealloc(), and AMOS::Size_t.

void AMOS::Kmer_t::setBase char  seqchar,
Pos_t  index
[inline]
 

Set a single sequence base for the kmer.

Only the characters A,C,G,T are allowed, all other characters will throw an exception.

Parameters:
seqchar The sequence base character
index The index to assign this character
Precondition:
index >= 0 && index < length

seqchar is A,C,G,T (case insensitive)

Exceptions:
ArgumentException_t 
Returns:
void
Definition at line 268 of file Kmer_AMOS.hh.

References AMOS_THROW_ARGUMENT, compress(), AMOS::Pos_t, and SEQ_BITS.

void AMOS::Universal_t::setComment const std::string &  comment  )  [inline, inherited]
 

Set the comment string.

Parameters:
comment The new comment string
Returns:
void
Definition at line 144 of file Universal_AMOS.hh.

void AMOS::Kmer_t::setCount uint32_t  count  )  [inline]
 

Set the number of this Kmer's occurrences.

Parameters:
count The new number of occurrences
Returns:
void
Definition at line 288 of file Kmer_AMOS.hh.

void AMOS::IBankable_t::setEID const std::string &  eid  )  [inline, inherited]
 

Set the external ID.

Will only use the characters up to but not including the first newline.

Returns:
void
Definition at line 234 of file Bank_AMOS.hh.

References AMOS::IBankable_t::eid_m, and AMOS::NL_CHAR.

Referenced by AMOS::Contig_t::readUMD().

void AMOS::IBankable_t::setFlagA bool  flag  )  [inline, inherited]
 

Set flag A.

Has no effect on the actual object in memory other than setting a flag. This is one of two user accessible flags to be used as needed, the other is flag B.

Parameters:
flag The new flag A value
Returns:
void
Definition at line 254 of file Bank_AMOS.hh.

References AMOS::IBankable_t::flags_m.

Referenced by AMOS::Universal_t::readMessage(), and AMOS::Overlap_t::readMessage().

void AMOS::IBankable_t::setFlagB bool  flag  )  [inline, inherited]
 

Set flag B.

Has no effect on the actual object in memory other than setting a flag. This is one of two user accessible flags to be used as needed, the other is flag A.

Parameters:
flag The new flag B value
Returns:
void
Definition at line 270 of file Bank_AMOS.hh.

References AMOS::IBankable_t::flags_m.

Referenced by AMOS::Universal_t::readMessage(), and AMOS::Overlap_t::readMessage().

void AMOS::IBankable_t::setIID ID_t  iid  )  [inline, inherited]
 

Set the internal ID.

Parameters:
iid The new internal ID
Returns:
void
Definition at line 282 of file Bank_AMOS.hh.

References AMOS::ID_t, and AMOS::IBankable_t::iid_m.

void AMOS::Kmer_t::setReads const std::vector< ID_t > &  reads  )  [inline]
 

Set the list of containing read IIDs.

Parameters:
reads The new vector of read IIDs that contain this Kmer
Returns:
void
Definition at line 300 of file Kmer_AMOS.hh.

void Kmer_t::setSeqString const std::string &  seq  ) 
 

Set the Kmer sequence string.

Compresses the string and updates the Kmer sequence. Does not alter Kmer count or read list, these must be reset manually. Only the characters A,C,G,T are allowed, all other characters will throw an exception (except for newlines, which will be discarded).

Parameters:
seq The new Kmer sequence string
Precondition:
seq can be longer than MAX_LENGTH (255) bases

seqchar is A,C,G,T (case insensitive)

Exceptions:
ArgumentException_t 
Returns:
void
Definition at line 122 of file Kmer_AMOS.cc.

References AMOS_THROW_ARGUMENT, compress(), AMOS::NL_CHAR, AMOS::Pos_t, AMOS::SafeRealloc(), and AMOS::Size_t.

Referenced by readMessage().

void AMOS::Universal_t::setStatus Status_t  status  )  [inline, inherited]
 

Set the status value.

Parameters:
status The new status value
Returns:
void
Definition at line 156 of file Universal_AMOS.hh.

References AMOS::Status_t.

Referenced by AMOS::Universal_t::readMessage().

char AMOS::Kmer_t::uncompress uint8_t  byte  )  [inline, static, protected]
 

Uncompresses two bits into a sequence char.

Note:
Must work with compress(char)
Parameters:
byte The compressed sequence bits (in highest two bit positions)
Exceptions:
Exception_t 
Returns:
The sequence char
Definition at line 82 of file Kmer_AMOS.hh.

References ADENINE_BITS, AMOS_THROW_ARGUMENT, CYTOSINE_BITS, GUANINE_BITS, SEQ_BITS, and THYMINE_BITS.

Referenced by getBase(), and getSeqString().

void Kmer_t::writeMessage Message_t msg  )  const [virtual]
 

Writes data to a Message object.

Writes the data contained in a Messagable object to a Message object. All previous data in the Message will be cleared or overwritten.

Parameters:
msg The Message to write to
Returns:
void

Reimplemented from AMOS::Universal_t.

Definition at line 160 of file Kmer_AMOS.cc.

References clear(), AMOS::F_COUNT, AMOS::F_READS, AMOS::F_SEQUENCE, getSeqString(), AMOS::NULL_STRING, and AMOS::Universal_t::writeMessage().

void Kmer_t::writeRecord std::ostream &  fix,
std::ostream &  var
const [protected, virtual]
 

Write selected class members to a biserial record.

Writes the fixed and variable length streams to a biserial record. Used in generating a biserial IBankable object, and needed to commit objects to a bank. Should not write the flags, EID, or IID of the object because the bank will handle the storage of these fields on its own.

Note:
This method must be able to produce a biserial record that can be read by its related funtion readRecord.
Parameters:
fix The fixed length stream (stores all fixed length members)
var The variable length stream (stores all var length members)
Returns:
void

Reimplemented from AMOS::Universal_t.

Definition at line 196 of file Kmer_AMOS.cc.

References AMOS::Pos_t, AMOS::Size_t, AMOS::writeLE(), and AMOS::Universal_t::writeRecord().


Member Data Documentation

const uint8_t AMOS::Kmer_t::ADENINE_BITS = 0x0 [static, protected]
 

'A' bit

Definition at line 42 of file Kmer_AMOS.hh.

Referenced by compress(), and uncompress().

const uint8_t AMOS::Kmer_t::CYTOSINE_BITS = 0x40 [static, protected]
 

'C' bit

Definition at line 43 of file Kmer_AMOS.hh.

Referenced by compress(), and uncompress().

std::string AMOS::IBankable_t::eid_m [protected, inherited]
 

external ID (anything you want sans newlines)

Definition at line 66 of file Bank_AMOS.hh.

Referenced by AMOS::IBankable_t::clear(), AMOS::IBankable_t::getEID(), and AMOS::IBankable_t::setEID().

BankFlags_t AMOS::IBankable_t::flags_m [protected, inherited]
 

bank flags, derived classes may use "nibble"

Definition at line 68 of file Bank_AMOS.hh.

Referenced by AMOS::IBankable_t::clear(), AMOS::IBankable_t::isFlagA(), AMOS::IBankable_t::isFlagB(), AMOS::IBankable_t::isModified(), AMOS::IBankable_t::isRemoved(), AMOS::IBankable_t::setFlagA(), and AMOS::IBankable_t::setFlagB().

const uint8_t AMOS::Kmer_t::GUANINE_BITS = 0x80 [static, protected]
 

'G' bit

Definition at line 44 of file Kmer_AMOS.hh.

Referenced by compress(), and uncompress().

ID_t AMOS::IBankable_t::iid_m [protected, inherited]
 

internal ID (integer AMOS identifier)

Definition at line 64 of file Bank_AMOS.hh.

Referenced by AMOS::IBankable_t::clear(), AMOS::IBankable_t::getIID(), AMOS::IBankable_t::IBankable_t(), and AMOS::IBankable_t::setIID().

const uint8_t Kmer_t::MAX_LENGTH = 255 [static]
 

Maximum Kmer length.

Definition at line 19 of file Kmer_AMOS.cc.

const NCode_t Kmer_t::NCODE = M_KMER [static]
 

The NCode type identifier for this object.

Reimplemented from AMOS::Universal_t.

Definition at line 18 of file Kmer_AMOS.cc.

const uint8_t AMOS::Kmer_t::SEQ_BITS = 0xC0 [static, protected]
 

sequence bit mask

Definition at line 46 of file Kmer_AMOS.hh.

Referenced by setBase(), and uncompress().

const uint8_t AMOS::Kmer_t::THYMINE_BITS = 0xC0 [static, protected]
 

'T' bit

Definition at line 45 of file Kmer_AMOS.hh.

Referenced by compress(), and uncompress().


The documentation for this class was generated from the following files:
Generated on Tue May 17 15:19:47 2005 for libAMOS by doxygen 1.3.8