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

RazorBack::Alignment_ Class Reference

Alignment_: the multiple alignment class. More...

#include <Alignment.hh>

Inheritance diagram for RazorBack::Alignment_:

Inheritance graph
[legend]
Collaboration diagram for RazorBack::Alignment_:

Collaboration graph
[legend]
List of all members.

Public Types

enum  Formatflags_ {
  UNKNOWN = 0, FASTA = 1, GCG = 2, PIR = 4,
  ANYFORMAT = 7
}
 available I/O formats. More...


Public Methods

 Alignment_ ()
 Creates an empty alignment.

 Alignment_ (size_t N)
 Creates an alignment to hold N sequences.

const Monomer_monomer () const
 monomer(): provides const access to the monomer type.

size_t seq_no () const
 seq_no(): returns the number of sequences in the alignment.

size_t max_len () const
 max_len(): returns the maximal gapped length in the alignment.

const Gapseq_operator[] (size_t Idx) const
 [Idx]: unchecked const access to the Idx:th sequence.

const Gapseq_at (size_t Idx) const
 at(Idx): checked const access to the Idx:th sequence. More...

int find (const string &ID) const
 find(ID): finds the sequence with ID string ID in the alignment. More...

string vertical_string (size_t Apos) const
 vertical_string(Apos): creates and returns a string that contains the Apos:th vertical position. More...

bool mmer_compat (const Monomer_ &Mseq, const Monomer_ &Mali) const
 mmer_compat(Mseq, [Mali]): returns true if the monomer type in Mseq for a sequence is compatible with the monomer type in Mali for an alignment (if omitted, the calling object's current monomer() object is used). More...

bool mmer_compat (const Monomer_ &Mseq) const
void add_seq (const Gapseq_ &Seq)
 add_seq(Seq, [Idx]): adds the sequence Seq before position Idx. More...

void add_seq (const Gapseq_ &Seq, size_t Idx)
void remove_seq (size_t Idx)
 remove_seq([Idx]): removes the Idx:th sequence from the alignment. More...

void remove_seq ()
void insert_gaps (size_t Seqidx, size_t Netpos, size_t Gaplen)
 insert_gaps(Seqidx, Netpos, Gaplen): invokes Gapseq_::insert_gaps(Netpos, Gaplen) for the Seqidx:th sequence in the alignment. More...

void remove_gaps (size_t Seqidx, size_t Netpos)
 remove_gaps([Seqidx],[Netpos]): When both parameters are specified, then Gapseq_::remove_gaps(Netpos) is invoked for the Seqidx:th sequence in the alignment. More...

void remove_gaps (size_t Seqidx)
void remove_gaps ()
Bioseqio_::Errtype_ read_align (istream &Inf, int Type=Monomer_::USER, int Format=ANYFORMAT)
 read_align(Inf, Type, Format): tries to read a multiple alignment from the input stream Inf. More...

Bioseqio_::Errtype_ write_align (ostream &Outf, int Format) const
 write_align(Outf, Format): writes the contents of the calling object to Outf according to the format specification in Format. More...


Protected Methods

void set_monomer_type (const Monomer_ &Mseq, Monomer_ &Mali)
 hidden methods.

void set_monomer_type (const Monomer_ &Mseq)
size_t set_maxlen () const
Bioseqio_::Errtype_ read_concat (istream &Inf, int Type, int Format)
Bioseqio_::Errtype_ read_msf (istream &Inf)
Bioseqio_::Errtype_ write_concat (ostream &Outf, int Format) const
Bioseqio_::Errtype_ write_msf (ostream &Outf) const

Private Attributes

Monomer_ Monomer
 contains the monomer alphabet.

vector<Gapseq_Sequences
 the aligned sequences.

size_t Maxlen
 the maximal (gapped) alignment length.

bool Dirty
 set to true after non-const access.


Detailed Description

Alignment_: the multiple alignment class.

Implements some simple manipulations and I/O.

Definition at line 50 of file Alignment.hh.


Member Enumeration Documentation

enum RazorBack::Alignment_::Formatflags_
 

available I/O formats.

Enumeration values:
UNKNOWN  
FASTA  
GCG  
PIR  
ANYFORMAT  

Reimplemented from RazorBack::Bioseqio_.

Definition at line 177 of file Alignment.hh.


Constructor & Destructor Documentation

RazorBack::Alignment_::Alignment_ ( ) [inline]
 

Creates an empty alignment.

Definition at line 64 of file Alignment.hh.

RazorBack::Alignment_::Alignment_ ( size_t N ) [inline, explicit]
 

Creates an alignment to hold N sequences.

Definition at line 67 of file Alignment.hh.


Member Function Documentation

const Monomer_ & RazorBack::Alignment_::monomer ( ) const [inline]
 

monomer(): provides const access to the monomer type.

Definition at line 70 of file Alignment.hh.

Referenced by mmer_compat().

size_t RazorBack::Alignment_::seq_no ( ) const [inline]
 

seq_no(): returns the number of sequences in the alignment.

Definition at line 73 of file Alignment.hh.

size_t RazorBack::Alignment_::max_len ( ) const [inline]
 

max_len(): returns the maximal gapped length in the alignment.

Definition at line 76 of file Alignment.hh.

const Gapseq_ & RazorBack::Alignment_::operator[] ( size_t Idx ) const [inline]
 

[Idx]: unchecked const access to the Idx:th sequence.

Definition at line 79 of file Alignment.hh.

const Gapseq_ & RazorBack::Alignment_::at ( size_t Idx ) const
 

at(Idx): checked const access to the Idx:th sequence.

Throws Indexrangexc_ if Idx is illegal.

int RazorBack::Alignment_::find ( const string & ID ) const
 

find(ID): finds the sequence with ID string ID in the alignment.

Returns a number in [ 0..seq_no() ) if found, -1 if not found.

string RazorBack::Alignment_::vertical_string ( size_t Apos ) const
 

vertical_string(Apos): creates and returns a string that contains the Apos:th vertical position.

E.g. for this alignment:

    * -ALI-GN-
    * --MIGGN-
    * SAVL-GNP
    * 
the vertical string at position 2 is "LMV". Apos must be in the range [0..max_len()). If the sequences are unaligned, then the right margin of the alignment is "ragged", in this case space characters will be used as padding. Throws Indexrangexc_ if Apos>=max_len().

bool RazorBack::Alignment_::mmer_compat ( const Monomer_ & Mseq,
const Monomer_ & Mali ) const
 

mmer_compat(Mseq, [Mali]): returns true if the monomer type in Mseq for a sequence is compatible with the monomer type in Mali for an alignment (if omitted, the calling object's current monomer() object is used).

DNA, RNA and NUCL monomer types are compatible with each other (basically we allow any nucleotide sequence to be aligned to any other nucleotide sequence). All other monomer types are compatible only with themselves, UNKNOWN is incompatible with all definite types.

Referenced by mmer_compat().

bool RazorBack::Alignment_::mmer_compat ( const Monomer_ & Mseq ) const [inline]
 

Definition at line 124 of file Alignment.hh.

void RazorBack::Alignment_::add_seq ( const Gapseq_ & Seq )
 

add_seq(Seq, [Idx]): adds the sequence Seq before position Idx.

If the position is omitted then Seq will be added to the end. If Idx is illegal, Indexrangexc_ will be thrown. However, if the calling object was empty, then Idx is ignored and the sequence will be added anyway. The type of this first sequence will set the type of the whole alignment. Seq must have compatible monomers as the alignment itself as defined by the mmer_compat() method otherwise it will not be added and a warning is issued.

void RazorBack::Alignment_::add_seq ( const Gapseq_ & Seq,
size_t Idx )
 

void RazorBack::Alignment_::remove_seq ( size_t Idx )
 

remove_seq([Idx]): removes the Idx:th sequence from the alignment.

If Idx is omitted then all sequences are deleted (complete reset). Nothing is done if the calling object was already empty. Throws Indexrangexc_ otherwise if Idx is illegal.

void RazorBack::Alignment_::remove_seq ( )
 

void RazorBack::Alignment_::insert_gaps ( size_t Seqidx,
size_t Netpos,
size_t Gaplen )
 

insert_gaps(Seqidx, Netpos, Gaplen): invokes Gapseq_::insert_gaps(Netpos, Gaplen) for the Seqidx:th sequence in the alignment.

Throws Indexrangexc_ if Seqidx is illegal.

void RazorBack::Alignment_::remove_gaps ( size_t Seqidx,
size_t Netpos )
 

remove_gaps([Seqidx],[Netpos]): When both parameters are specified, then Gapseq_::remove_gaps(Netpos) is invoked for the Seqidx:th sequence in the alignment.

If Netpos is omitted, then all gaps are removed from the Seqidx:th sequence. Throws Indexrangexc_ if Seqidx is illegal. Without any parameters, all gaps are deleted from all sequences.

void RazorBack::Alignment_::remove_gaps ( size_t Seqidx )
 

void RazorBack::Alignment_::remove_gaps ( )
 

Bioseqio_::Errtype_ RazorBack::Alignment_::read_align ( istream & Inf,
int Type = Monomer_::USER,
int Format = ANYFORMAT )
 

read_align(Inf, Type, Format): tries to read a multiple alignment from the input stream Inf.

If Type is set to Monomer_::PROT, then only protein sequences will be read, if it is set to Monomer_::[DEOXY[RIBO]]NUCL, then only the corresponding nucleic acid sequences will be read, if Type is Monomer_::USER (default) or an OR-ed combination of PROT and *NUCL, then all types are considered and a polymer type autodetection is attempted. This is not foolproof. Format can be set to ANYFORMAT (default), in this case automatic file format detection is performed, or to PIR (proteins only), FASTA, GCG (protein or nucleic acid). No read is performed and FORMATERR is returned when incompatible type and format are specified. Return value: OK or an error enum if something went wrong.

Bioseqio_::Errtype_ RazorBack::Alignment_::write_align ( ostream & Outf,
int Format ) const
 

write_align(Outf, Format): writes the contents of the calling object to Outf according to the format specification in Format.

Returns OK or an error enum if something went wrong.

void RazorBack::Alignment_::set_monomer_type ( const Monomer_ & Mseq,
Monomer_ & Mali ) [protected]
 

hidden methods.

Referenced by set_monomer_type().

void RazorBack::Alignment_::set_monomer_type ( const Monomer_ & Mseq ) [inline, protected]
 

Definition at line 208 of file Alignment.hh.

size_t RazorBack::Alignment_::set_maxlen ( ) const [protected]
 

Referenced by max_len().

Bioseqio_::Errtype_ RazorBack::Alignment_::read_concat ( istream & Inf,
int Type,
int Format ) [protected]
 

Bioseqio_::Errtype_ RazorBack::Alignment_::read_msf ( istream & Inf ) [protected]
 

Bioseqio_::Errtype_ RazorBack::Alignment_::write_concat ( ostream & Outf,
int Format ) const [protected]
 

Bioseqio_::Errtype_ RazorBack::Alignment_::write_msf ( ostream & Outf ) const [protected]
 


Member Data Documentation

Monomer_ RazorBack::Alignment_::Monomer [private]
 

contains the monomer alphabet.

Definition at line 55 of file Alignment.hh.

vector< Gapseq_ > RazorBack::Alignment_::Sequences<Gapseq_> [private]
 

the aligned sequences.

Definition at line 56 of file Alignment.hh.

size_t RazorBack::Alignment_::Maxlen [mutable, private]
 

the maximal (gapped) alignment length.

Definition at line 57 of file Alignment.hh.

bool RazorBack::Alignment_::Dirty [mutable, private]
 

set to true after non-const access.

Definition at line 58 of file Alignment.hh.


The documentation for this class was generated from the following file:
Generated at Wed Aug 21 09:33:44 2002 for The Razorback C++ Library: Bioinformatics by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001