49 for (
size_t i=0;
i <
str.length();
i++) {
61 if ((*it)->IsTitle()) {
62 if (!retval.empty()) {
65 retval += (*it)->GetTitle();
87 retval =
id->AsFastaString();
98 : m_AlnVec(new
CAlnVec(seqalign.GetSegs().GetDenseg(), scope)),
139 for (
int i=0;
i < num_seqs;
i++) {
161 const vector<CSeq_id_Handle>& ids = bhandle.
GetId();
162 ITERATE (vector<CSeq_id_Handle>, it, ids) {
163 ostr << it->GetSeqId()->AsFastaString();
164 if (it + 1 != ids.end()) {
170 if (!title.empty()) {
171 ostr <<
" " << title;
177 for (
int j=0;j < (
int)seq.length();j++) {
178 if (j %
m_Width == 0 && j != 0) {
199 const unsigned int kSeqTitleWidth = 10;
204 ostr <<
" " << num_sequences <<
" " << sequence.length() <<
NcbiEndl;
207 for (
int i=0;
i < num_sequences;
i++) {
215 if (seq_title.length() > kSeqTitleWidth) {
216 seq_title.erase(kSeqTitleWidth - 1, seq_title.size() - 1);
219 while (seq_title.length() < kSeqTitleWidth) {
230 for (j=0;j < sequence.length() && j <
m_Width - kSeqTitleWidth;j++) {
233 for (;j < sequence.length();j++) {
234 if ((j + kSeqTitleWidth) %
m_Width == 0 && j != 0) {
248 const unsigned int kSeqTitleWidth = 10;
252 ostr <<
" " << num_sequences <<
" " << aln_width <<
NcbiEndl;
255 for (
int i=0;
i < num_sequences;
i++) {
263 if (seq_title.length() > kSeqTitleWidth) {
264 seq_title.erase(kSeqTitleWidth - 1, seq_title.size() - 1);
267 while (seq_title.length() < kSeqTitleWidth) {
274 min(
m_Width - (
int)kSeqTitleWidth, aln_width)));
280 int from =
m_Width - kSeqTitleWidth;
281 while (from < (
int)aln_width) {
283 for (
int i=0;
i < num_sequences;
i++) {
302 vector<string> seqids(num_sequences);
303 int max_id_length = 0;
304 for (
int i=0;
i < num_sequences;
i++) {
307 if ((
int)seqids[
i].length() > max_id_length) {
308 max_id_length = seqids[
i].length();
314 <<
"DIMENSIONS ntax=" << num_sequences <<
" nchar="
315 << last_pos + 1 <<
";"
317 <<
"FORMAT datatype="
326 int seqid_width = max_id_length + 2;
327 while (from < last_pos) {
329 for (
int i=0;
i < num_sequences;
i++) {
332 int margin = seqid_width - seqids[
i].length();
static void s_ReplaceNonAlphaNum(string &str)
static string s_GetLabel(const CBioseq_Handle &bhandle)
static string s_GetTitle(const CBioseq_Handle &bhandle)
USING_SCOPE(align_format)
const CSeq_id & GetSeqId(TNumrow row) const
TDim GetNumRows(void) const
TSeqPos GetAlnStop(TNumseg seg) const
void ClustalStyle(int scrn_width=50, EAlgorithm algorithm=eUseAlnSeqString)
TResidue GetGapChar(TNumrow row) const
void SetEndChar(TResidue gap_char)
void SetGapChar(TResidue gap_char)
string & GetWholeAlnSeqString(TNumrow row, string &buffer, TSeqPosList *insert_aln_starts=0, TSeqPosList *insert_starts=0, TSeqPosList *insert_lens=0, unsigned int scrn_width=0, TSeqPosList *scrn_lefts=0, TSeqPosList *scrn_rights=0) const
CScope & GetScope(void) const
void SetAaCoding(TCoding coding)
string & GetAlnSeqString(string &buffer, TNumrow row, const CAlnMap::TSignedRange &aln_rng) const
Printer for popular multiple alignmnet formats.
CMultiAlnPrinter(const CSeq_align &seqalign, CScope &scope, EAlignType type=eNotSet)
Constructor.
void x_PrintPhylipSequential(CNcbiOstream &ostr)
Print alignment in Phylip format with sequetial sequences.
void x_PrintNexus(CNcbiOstream &ostr)
Print alignment in Nexus format.
EAlignType
Alignment display type for showing nucleotice or protein-related information.
int m_Width
Selected width of the text field.
void Print(CNcbiOstream &ostr)
Print alignment.
CRef< CAlnVec > m_AlnVec
Alignment manager.
EFormat m_Format
Selected alignment format.
void x_PrintClustal(CNcbiOstream &ostr)
Print alignment in ClustalW format.
void x_PrintPhylipInterleaved(CNcbiOstream &ostr)
Print alignment in Phylip format with interleaved sequences.
EAlignType m_AlignType
Alignment type.
void x_PrintFastaPlusGaps(CNcbiOstream &ostr)
Print alignment in fasta + gaps format.
static const char * str(char *buf, int n)
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
const string AsFastaString(void) const
string GetSeqIdString(bool with_version=false) const
Return seqid string with optional version for text seqid type.
@ eContent
Untagged human-readable accession or the like.
CBioseq_Handle GetBioseqHandle(const CSeq_id &id)
Get bioseq handle by seq-id.
@ eGetBioseq_All
Search bioseq, load if not loaded yet.
CConstRef< CSeq_id > GetSeqId(void) const
Get id which can be used to access this bioseq handle Throws an exception if none is available.
const TDescr & GetDescr(void) const
const TId & GetId(void) const
IO_PREFIX::ostream CNcbiOstream
Portable alias for ostream.
static const char label[]
bool IsStr(void) const
Check if variant Str is selected.
bool IsId(void) const
Check if variant Id is selected.
const TLocal & GetLocal(void) const
Get the variant data.
bool IsLocal(void) const
Check if variant Local is selected.
list< CRef< CSeqdesc > > Tdata
const Tdata & Get(void) const
Get the member data.
@ e_Ncbieaa
extended ASCII 1 letter aa codes
unsigned int
A callback function used to compare two keys in a database.