NCBI C++ ToolKit
aln_printer.hpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 #ifndef OBJTOOLS_ALIGN_FORMAT___ALN_PRINTER_HPP
2 #define OBJTOOLS_ALIGN_FORMAT___ALN_PRINTER_HPP
3 
4 /* $Id:
5 * ===========================================================================
6 *
7 * PUBLIC DOMAIN NOTICE
8 * National Center for Biotechnology Information
9 *
10 * This software/database is a "United States Government Work" under the
11 * terms of the United States Copyright Act. It was written as part of
12 * the author's offical duties as a United States Government employee and
13 * thus cannot be copyrighted. This software/database is freely available
14 * to the public for use. The National Library of Medicine and the U.S.
15 * Government have not placed any restriction on its use or reproduction.
16 *
17 * Although all reasonable efforts have been taken to ensure the accuracy
18 * and reliability of the software and data, the NLM and the U.S.
19 * Government do not and cannot warrant the performance or results that
20 * may be obtained by using this software or data. The NLM and the U.S.
21 * Government disclaim all warranties, express or implied, including
22 * warranties of performance, merchantability or fitness for any particular
23 * purpose.
24 *
25 * Please cite the author in any work or product based on this material.
26 *
27 * ===========================================================================*/
28 
29 /*****************************************************************************
30 
31 File name: aln_printer.hpp
32 
33 Author: Greg Boratyn
34 
35 Contents: Printer for standard multiple sequence alignment formats
36 
37 ******************************************************************************/
38 
41 #include <objmgr/scope.hpp>
42 
43 
45 BEGIN_SCOPE(align_format)
47 
48 /// Printer for popular multiple alignmnet formats
49 ///
51 {
52 public:
53 
54  /// Alignment display type for showing nucleotice or protein-related
55  /// information
56  enum EAlignType {
57  eNotSet = 0,
59  eProtein
60  };
61 
62  /// Multiple alignmnet text formats
63  enum EFormat {
64  eFastaPlusGaps = 0,
69  ePhylip = ePhylipInterleaved
70  };
71 
72 public:
73 
74  /// Constructor
75  /// @param seqalign Alignment
76  /// @param scope Scope
77  ///
78  CMultiAlnPrinter(const CSeq_align& seqalign, CScope& scope,
80 
81  /// Set text width (number of columns) for alignment output
82  /// @param width Width
83  ///
84  void SetWidth(int width) {m_Width = width;}
85 
86  /// Set format for printing alignment
87  /// @param format Format
88  ///
89  void SetFormat(EFormat format) {m_Format = format;}
90 
91  /// Set gap character
92  /// @param gap Gap character
93  ///
94  void SetGapChar(unsigned char gap) {m_AlnVec->SetGapChar(gap);}
95 
96  /// Set end gap character
97  /// @param End gap character
98  ///
99  void SetEndGapChar(unsigned char gap) {m_AlnVec->SetEndChar(gap);}
100 
101  /// Print alignment
102  /// @param ostr Output stream
103  ///
104  void Print(CNcbiOstream& ostr);
105 
106 
107 protected:
108  /// Forbid copy constructor
110 
111  /// Forbid assignment operator
113 
114  /// Print alignment in fasta + gaps format
115  /// @param ostr Output stream
116  void x_PrintFastaPlusGaps(CNcbiOstream& ostr);
117 
118  /// Print alignment in ClustalW format
119  /// @param ostr Output stream
120  void x_PrintClustal(CNcbiOstream& ostr);
121 
122  /// Print alignment in Phylip format with sequetial sequences
123  /// @param ostr Output stream
124  void x_PrintPhylipSequential(CNcbiOstream& ostr);
125 
126  /// Print alignment in Phylip format with interleaved sequences
127  /// @param ostr Output stream
128  void x_PrintPhylipInterleaved(CNcbiOstream& ostr);
129 
130  /// Print alignment in Nexus format
131  /// @param ostr Output stream
132  void x_PrintNexus(CNcbiOstream& ostr);
133 
134 
135 protected:
136  /// Alignment manager
138 
139  /// Alignment type
141 
142  /// Selected alignment format
144 
145  /// Selected width of the text field
146  int m_Width;
147 };
148 
149 END_SCOPE(align_format)
150 
152 
153 #endif /* OBJTOOLS_ALIGN_FORMAT___ALN_PRINTER_HPP */
USING_SCOPE(objects)
Printer for popular multiple alignmnet formats.
Definition: aln_printer.hpp:51
EAlignType
Alignment display type for showing nucleotice or protein-related information.
Definition: aln_printer.hpp:56
int m_Width
Selected width of the text field.
CRef< CAlnVec > m_AlnVec
Alignment manager.
EFormat m_Format
Selected alignment format.
CMultiAlnPrinter & operator=(const CMultiAlnPrinter &p)
Forbid assignment operator.
void SetEndGapChar(unsigned char gap)
Set end gap character.
Definition: aln_printer.hpp:99
EFormat
Multiple alignmnet text formats.
Definition: aln_printer.hpp:63
void SetFormat(EFormat format)
Set format for printing alignment.
Definition: aln_printer.hpp:89
void SetGapChar(unsigned char gap)
Set gap character.
Definition: aln_printer.hpp:94
EAlignType m_AlignType
Alignment type.
CMultiAlnPrinter(const CMultiAlnPrinter &p)
Forbid copy constructor.
void SetWidth(int width)
Set text width (number of columns) for alignment output.
Definition: aln_printer.hpp:84
CScope –.
Definition: scope.hpp:92
void Print(const CCompactSAMApplication::AlignInfo &ai)
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define END_SCOPE(ns)
End the previously defined scope.
Definition: ncbistl.hpp:75
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
#define BEGIN_SCOPE(ns)
Define a new scope.
Definition: ncbistl.hpp:72
IO_PREFIX::ostream CNcbiOstream
Portable alias for ostream.
Definition: ncbistre.hpp:149
#define NCBI_ALIGN_FORMAT_EXPORT
Definition: ncbi_export.h:1081
EAlignType
Definition: na_utils.cpp:68
static Format format
Definition: njn_ioutil.cpp:53
@ eNotSet
Definition: splign_app.cpp:550
Definition: type.c:6
Modified on Fri Jan 05 07:22:50 2024 by modify_doxy.py rev. 669887