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

Alignment.hh

Go to the documentation of this file.
00001 #ifndef ALIGNMENT_HEADER
00002 #define ALIGNMENT_HEADER
00003 
00004 // ==== HEADER Alignment.hh ====
00005 
00011 // 18-Aug-1999, Andras Aszodi
00012 
00013 // ---- COMPATIBILITY NOTES ----
00014 
00015 // ANSI C++ standard only.
00016 
00017 // ==== STANDARD HEADERS ====
00018 
00019 #include <stdlib.h>
00020 
00021 #ifdef _STANDARD_C_PLUS_PLUS
00022 #include <iostream>
00023 #include <vector>
00024 #else
00025 #include <iostream.h>
00026 #include <vector.h>
00027 #endif
00028 
00029 #include <string>
00030 using namespace std;
00031 #ifndef NPOS
00032 #define NPOS string::npos
00033 #endif
00034 
00035 // ==== MODULE HEADERS ====
00036 
00037 #include"Monomer.hh"
00038 #include"Gapseq.hh"
00039 #include "Rangedimexc.hh"
00040 #include"Bioseqio.hh"
00041 
00042 // ==== CLASSES ====
00043 
00044 namespace RazorBack {
00045 
00050 class Alignment_: protected Bioseqio_
00051 {
00052     // data
00053     private:
00054             
00055     Monomer_ Monomer;           
00056     vector<Gapseq_> Sequences;  
00057     mutable size_t Maxlen;      
00058     mutable bool Dirty;     
00059     
00060     // methods
00061     public:
00062             
00064     Alignment_(): Monomer(Monomer_::UNKNOWN), Sequences(), Maxlen(0) {}
00065     
00067     explicit Alignment_(size_t N): Sequences(N), Maxlen(0) {}
00068     
00070     const Monomer_& monomer() const { return Monomer; }
00071     
00073     size_t seq_no() const { return Sequences.size(); }
00074     
00076     size_t max_len() const { set_maxlen(); return Maxlen; }
00077     
00079     const Gapseq_& operator[](size_t Idx) const { return Sequences[Idx]; }
00080     
00085     const Gapseq_& at(size_t Idx) const;
00086     
00091     int find(const string& ID) const;
00092     
00108     string vertical_string(size_t Apos) const;
00109     
00111     
00123     bool mmer_compat(const Monomer_& Mseq, const Monomer_& Mali) const;
00124     bool mmer_compat(const Monomer_& Mseq) const
00125     { return mmer_compat(Mseq, monomer()); }
00126     
00139     void add_seq(const Gapseq_& Seq);
00140     void add_seq(const Gapseq_& Seq, size_t Idx);
00141     
00148     void remove_seq(size_t Idx);
00149     void remove_seq();
00150     
00152     
00159     void insert_gaps(size_t Seqidx, size_t Netpos, size_t Gaplen);
00160     
00170     void remove_gaps(size_t Seqidx, size_t Netpos);
00171     void remove_gaps(size_t Seqidx);
00172     void remove_gaps();
00173     
00174         // I/O
00175     
00177     enum Formatflags_ {UNKNOWN=0, FASTA=1, GCG=2, PIR=4, ANYFORMAT=7};
00178 
00195     Bioseqio_::Errtype_ read_align(istream& Inf, int Type=Monomer_::USER, int Format=ANYFORMAT);
00196 
00202     Bioseqio_::Errtype_ write_align(ostream& Outf, int Format) const;
00203     
00205     protected:
00206             
00207     void set_monomer_type(const Monomer_& Mseq, Monomer_& Mali);
00208     void set_monomer_type(const Monomer_& Mseq)
00209     { set_monomer_type(Mseq, Monomer); }
00210     
00211     size_t set_maxlen() const;
00212 
00213     Bioseqio_::Errtype_ read_concat(istream& Inf, int Type, int Format);
00214     Bioseqio_::Errtype_ read_msf(istream& Inf);
00215     Bioseqio_::Errtype_ write_concat(ostream& Outf, int Format) const;
00216     Bioseqio_::Errtype_ write_msf(ostream& Outf) const;
00217 };
00218 // END OF CLASS Alignment_
00219 
00220 }   // RazorBack
00221 
00222 // ==== END OF HEADER Alignment.hh ====
00223 
00224 #endif      // ALIGNMENT_HEADER

Generated at Wed Aug 21 09:33:42 2002 for The Razorback C++ Library: Bioinformatics by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001