<
typenameT1,
typenameT2>
68ostream &
operator <<(ostream & ostr,
constpair<T1, T2> & a_pair )
70ostr <<
'('<< a_pair.first <<
", "<< a_pair.second <<
')';
74 template<
typenameTMap>
75 const typenameTMap::mapped_type &
77 constTMap & a_map,
const typenameTMap::key_type &
key)
79 typenameTMap::const_iterator find_it =
81 if( find_it == a_map.end() ) {
83 "Could not find map key: "<<
key);
85 returnfind_it->second;
89find_attrib_attr_or_die(
93 if( find_it == attribs.
end() ) {
95 "Could not find map key: "<<
key);
101find_node_attr_or_die(
114 static constTGapTypeNameElem sc_gaptypename_map[] = {
115{ GA::eGapType_All,
"Any Kind"},
116{ GA::eGapType_SeqGap,
"Seq Gaps"},
117{ GA::eGapType_UnknownBases,
"Runs of Ns"},
120GA::EGapType,
const char*> TGapTypeNameMap;
122TGapTypeNameMap, sc_gaptypename, sc_gaptypename_map);
127 #define ITERATE_GAP_TYPES(iter_name) \ 128 ITERATE(TGapTypeNameMap, iter_name, sc_gaptypename) 131 structSGapRelatedInfo {
132GA::EGapType gap_type;
133GA::TAddFlag gap_add_flag;
134FR::TFlags fasta_flag;
137 static constTAddGapTypeElem sc_addgaptypename_map[] = {
140( GA::fAddFlag_IncludeSeqGaps | GA::fAddFlag_IncludeUnknownBases),
141( FR::fParseGaps | FR::fLetterGaps) } },
143{ GA::eGapType_SeqGap,
144GA::fAddFlag_IncludeSeqGaps, FR::fParseGaps } },
146{ GA::eGapType_UnknownBases,
147GA::fAddFlag_IncludeUnknownBases, FR::fLetterGaps } },
150 const char*, SGapRelatedInfo,
PCase_CStr> TAddGapTypeMap;
152TAddGapTypeMap, sc_addgaptypename, sc_addgaptypename_map);
157 classCBeginEndStrToCoutRAII
160CBeginEndStrToCoutRAII(
161 const string& start_str,
const string& end_str)
164cout << start_str << endl;
167~CBeginEndStrToCoutRAII()
169cout << m_end_str << endl;
173 const stringm_end_str;
183 structSOutMessage :
publicstd::runtime_error {
185 const static stringkErrorStr;
186 const static stringkFatalStr;
189 const string& file_or_accn,
190 const string& level,
191 const string&
code,
192 const string&
text) :
194x_CalcWhat(file_or_accn, level,
code,
text)),
195m_file_or_accn_basename(
196x_CalcFileBaseNameOrAccn(file_or_accn)),
203~SOutMessage() throw() { }
205 const stringm_file_or_accn_basename;
206 const stringm_level;
214 static stringx_CalcFileBaseNameOrAccn(
215 const string& file_or_accn);
217 static stringx_CalcWhat(
218 const string& file_or_accn,
219 const string& level,
220 const string&
code,
221 const string&
text);
224 const stringSOutMessage::kErrorStr(
"ERROR");
225 const stringSOutMessage::kFatalStr(
"FATAL");
227 voidSOutMessage::WriteAsXML(
CNcbiOstream& out_strm)
const 230 xml::node& expn_root_node = expn_doc.get_root_node();
234 if( ! m_file_or_accn_basename.empty() ) {
235expn_root_attribs.
insert(
236 "file_or_accn", m_file_or_accn_basename.c_str());
238expn_root_attribs.
insert(
"severity", m_level.c_str());
239expn_root_attribs.
insert(
"code", m_code.c_str());
246 voidSOutMessage::WriteAsText(
CNcbiOstream& out_strm)
const 248out_strm << what() << endl;
251 stringSOutMessage::x_CalcFileBaseNameOrAccn(
252 const string& file_or_accn)
254 CFilemaybe_file(file_or_accn);
255 if( maybe_file.IsFile() ) {
257 returnmaybe_file.GetName();
264 stringSOutMessage::x_CalcWhat(
265 const string& file_or_accn,
266 const string& level,
267 const string&
code,
268 const string&
text)
273 const stringfile_or_accn_basename =
274x_CalcFileBaseNameOrAccn(file_or_accn);
276answer_str_strm << level <<
": ["<<
code<<
"] ";
277 if( ! file_or_accn_basename.empty() ) {
278answer_str_strm << file_or_accn_basename <<
": ";
280answer_str_strm <<
text;
297 virtual void Init(
void);
298 virtual int Run(
void);
340 constSOutMessage &out_message,
CNcbiOstream& out_strm)
const;
357m_eOutFormat(eOutFormat_ASCIITable)
373arg_desc->SetUsageContext(
GetArguments().GetProgramBasename(),
374 "Gap analysis program",
false);
378arg_desc->SetCurrentGroup(
"BASIC");
382 "The files or accessions to do gap analysis on. " 383 "ASN.1, XML, and FASTA are some of the supported file formats.",
386vector<string> gap_types;
387 ITERATE(TAddGapTypeMap, add_gap_type_it, sc_addgaptypename) {
388gap_types.push_back(add_gap_type_it->first);
391arg_desc->AddOptionalKey(
394 "A comma-separated list of types of gaps we look at. " 395 "If none are specified, all types will be shown. Possibilities: "+
396 NStr::Join(gap_types,
", ") +
" but note that 'all' means adding " 397 "one column that combines all types. Also, there is " 398 "the gap-type 'both' as a shortcut for showing a column " 399 "for every possible gap type " 400 "(except 'all', unless you also add that to -gap-types)",
403arg_desc->AddDefaultKey(
404 "out-format",
"Format",
405 "Specifies how the results should be printed.",
409 "ascii-table",
"xml"));
411arg_desc->AddDefaultKey(
"sort-on",
"HowToSortResults",
412 "Specify the order of the summary. length sorts on the gap length. " 413 "num_seqs sorts on the number of sequences " 414 "each gap length appears on. " 415 "num_gaps sorts on the total number of times a gap " 416 "of each gap length appears. ",
420 "length",
"num_seqs",
"num_gaps"));
422arg_desc->AddFlag(
"rev-sort",
423 "Set this to reverse the sorting order.");
425arg_desc->AddFlag(
"show-seqs-for-gap-lengths",
426 "This will show the sequences that each gap size has. It " 427 "is not affected by the sorting options.");
429arg_desc->AddDefaultKey(
"mol",
"MolTypesToLookAt",
430 "Specify whether you just want to look at sequences which are " 431 "nucleic acids (na), amino acids (aa), or any.",
435 "na",
"aa",
"any"));
437arg_desc->AddDefaultKey(
"assume-mol",
"AssumedMolType",
438 "If unable to determine mol of sequence from ASN.1, " 439 "FASTA mods, etc. this specifies what mol we assume it is.",
445arg_desc->SetCurrentGroup(
"RESOLVING SEQUENCES");
448 "no-gbload",
"If set, avoids using the GenBank data loader");
450arg_desc->AddDefaultKey(
451 "max-resolve-count",
"MAX_COUNT",
452 "How deep to resolve when following far references. Note that being " 453 "unable to resolve a far reference whether due to reaching max " 454 "resolve count or any other reason will result in an error since " 455 "unable to calculate 'gaps' if cannot get sequence. Zero disables " 456 "all far reference resolution.",
460arg_desc->SetConstraint(
463arg_desc->SetCurrentGroup(
"HISTOGRAM");
465arg_desc->AddFlag(
"show-hist",
466 "Set this flag to see a histogram of gap data");
468arg_desc->AddDefaultKey(
"hist-bins",
"NumBins",
469 "Set the number of histogram bins to aim for (not guaranteed " 470 "to be that exact number). Default is 0, which means to " 471 "automatically pick a reasonable number of bins",
474arg_desc->SetConstraint(
"hist-bins",
476arg_desc->SetDependency(
479arg_desc->AddDefaultKey(
"hist-algo",
"HistogramAlgorithm",
480 "Set this if you want the histogram binner to try to " 481 "use a different binning algorithm. The default should " 482 "be fine for most people.",
486 "cluster",
"even_bins"));
487arg_desc->SetDependency(
514 const string& sOutFormat = args[
"out-format"].AsString();
515 if(
"ascii-table"== sOutFormat ) {
517}
else if(
"xml"== sOutFormat ) {
521pResultBeginEndStr.
reset(
522 newCBeginEndStrToCoutRAII(
"<result>",
"</result>"));
533}
catch(
conststd::exception & ex ) {
534p_out_message.
reset(
537 "INTERNAL_ERROR", ex.what()));
539p_out_message.
reset(
542 "INTERNAL_ERROR",
"(---UNKNOWN INTERNAL ERROR TYPE---)"));
570 const string& sMol = args[
"mol"].AsString();
571 if( sMol ==
"na") {
573}
else if( sMol ==
"aa") {
575}
else if( sMol ==
"any") {
584 const string& sAssumeMol = args[
"assume-mol"].AsString();
585 if( sAssumeMol ==
"na") {
587}
else if( sAssumeMol ==
"aa") {
595 if( args[
"gap-types"].
HasValue() ) {
596 stringgap_type_arg = args[
"gap-types"].AsString();
602vector< string > raw_gap_types;
603 NStr::Split(args[
"gap-types"].AsString(),
",", raw_gap_types, 0);
604 if( raw_gap_types.empty() ) {
607 "NO_GAP_TYPES_GIVEN",
608 "-gap-types must be given at least one gap");
612 ITERATE(vector< string >, raw_gap_types_it, raw_gap_types)
614 const string& raw_gap_type_str = *raw_gap_types_it;
620vector<string> gap_types_from_this_arg;
621 if( raw_gap_type_str ==
"both") {
624 const size_told_num_gap_types =
625gap_types_from_this_arg.size();
626 ITERATE(TAddGapTypeMap, add_gap_type_it, sc_addgaptypename) {
627 const string& gap_type_str = add_gap_type_it->first;
628 if( gap_type_str !=
"all") {
629gap_types_from_this_arg.push_back(gap_type_str);
632 const size_tnew_num_gap_types =
633gap_types_from_this_arg.size();
635 if( (old_num_gap_types + 2) != new_num_gap_types ) {
643gap_types_from_this_arg.push_back(raw_gap_type_str);
646 ITERATE(vector<string>, gap_type_str_it, gap_types_from_this_arg)
648 const string& gap_type_str = *gap_type_str_it;
649TAddGapTypeMap::const_iterator find_it =
650sc_addgaptypename.find(gap_type_str.c_str());
651 if( find_it == sc_addgaptypename.end() ) {
654SOutMessage::kFatalStr,
656 "This gap type is not recognized: '"+
657gap_type_str +
"'");
660 constSGapRelatedInfo & gap_related_flags =
672 m_eSort= GA::eSortGapLength_Length;
673 const stringsSortOn = args[
"sort-on"].AsString();
674 if(
"length"== sSortOn ) {
675 m_eSort= GA::eSortGapLength_Length;
676}
else if(
"num_seqs"== sSortOn ) {
677 m_eSort= GA::eSortGapLength_NumSeqs;
678}
else if(
"num_gaps"== sSortOn ) {
679 m_eSort= GA::eSortGapLength_NumGaps;
687GA::eSortDir_Descending :
688GA::eSortDir_Ascending );
692 for(
size_tii = 1; ii <= args.
GetNExtra(); ++ii ) {
693 const stringsFileOrAccn = args[ii].AsString();
697 catch(
constncbi::objects::CObjMgrException& ex) {
698 if(ex.GetErrCode() == ncbi::objects::CObjMgrException::eAddDataError
699&& ex.GetMsg().find(
"duplicate Bioseq id") == 0) {
700SOutMessage out_message(
701sFileOrAccn, SOutMessage::kErrorStr,
702ex.GetErrCodeString(), ex.GetMsg());
707 catch(
constSOutMessage & out_message) {
714 catch(
constncbi::CException& ex) {
715SOutMessage out_message(
716sFileOrAccn, SOutMessage::kFatalStr,
717ex.GetErrCodeString(), ex.GetMsg());
728SOutMessage out_message(
729sFileOrAccn, SOutMessage::kFatalStr,
730 "INTERNAL_ERROR",
"Unexpected exception");
740 if( args[
"show-seqs-for-gap-lengths"] ) {
744 if( args[
"show-hist"] ) {
745 const Uint8num_bins = args[
"hist-bins"].AsInt8();
746 const string& sHistAlgo = args[
"hist-algo"].AsString();
749 if(
"cluster"== sHistAlgo ) {
751}
else if(
"even_bins"== sHistAlgo ) {
778 if( !
GetArgs()[
"no-gbload"] ) {
791 stringanswer = gap_name;
818 ITERATE( GA::TVectorGapLengthSummary,
819summary_unit_it, *pGapLenSummary )
821all_gap_lengths_list->push_back((*summary_unit_it)->gap_length);
827== all_gap_lengths_list->end());
830 returnall_gap_lengths_list;
841 if(
CDirEntry(sFileOrAccn).Exists() ) {
843 if( !
CDirEntry(sFileOrAccn).IsFile() ) {
846SOutMessage::kErrorStr,
848 FORMAT(
"This exists but is not a plain file: " 883pSeqEntry = fasta_reader.
ReadSet();
890SOutMessage::kErrorStr,
891 "UNSUPPORTED_FORMAT",
892 FORMAT(
"This format is not yet supported: " 906 if( ! pSeqSubmit->IsEntrys() ||
907pSeqSubmit->GetData().GetEntrys().size() != 1 )
911SOutMessage::kErrorStr,
912 "SEQ_SUBMIT_MULTIPLE_SEQ_ENTRIES",
914 "Only Seq-submits with exactly " 916 "inside are supported."));
918pSeqEntry = *pSeqSubmit->SetData().SetEntrys().begin();
931pSeqEntry = pNewSeqEntry;
945pSeqEntry->
SetSeq( *pBioseq );
953SOutMessage::kErrorStr,
954 "INVALID_FORMAT_OR_BAD_OBJ_TYPE",
955 FORMAT(
"Invalid ASN.1 or unsupported object type"));
969SOutMessage::kErrorStr,
978SOutMessage::kErrorStr,
979 "ACCESSION_NOT_FOUND",
980 FORMAT(
"Accession could not be found"));
1010 xml::nodegap_len_infos_node(
"gap_len_infos");
1014 typedefpair<GA::TGapLength, GA::EGapType>
1017TGapLenTypeToSummaryMap;
1018TGapLenTypeToSummaryMap gap_len_type_to_summary_map;
1022 constGA::EGapType eGapType = gap_type_name_it->first;
1030 ITERATE(GA::TVectorGapLengthSummary, gap_summary_it,
1031*p_gap_len_summary )
1035TGapLenTypeKey gap_len_type(p_one_summary->gap_length, eGapType);
1036pair<TGapLenTypeToSummaryMap::iterator, bool> insert_ret =
1037gap_len_type_to_summary_map.insert(
1042 if( ! insert_ret.second ) {
1052 TGapLengthVec& all_gap_lengths_list = *p_all_gap_lengths_list;
1058 constGA::TGapLength gap_len = *gap_length_it;
1060 xml::nodeone_gap_len_info(
"one_gap_len_info");
1064one_gap_len_attributes.
insert(
1070 constGA::EGapType eGapType = gap_type_name_it->first;
1071 const CTempStringpchGapName = gap_type_name_it->second;
1080TGapLenTypeToSummaryMap::const_iterator find_it =
1081gap_len_type_to_summary_map.find(
1082make_pair(gap_len, eGapType));
1083 if( find_it != gap_len_type_to_summary_map.end() ) {
1084p_one_summary = find_it->second;
1086p_one_summary.
Reset(
1087 newGA::SOneGapLengthSummary(
1098 "one_gap_len_type_info");
1102one_gap_len_type_info_attributes.
insert(
1105one_gap_len_type_info_attributes.
insert(
1108one_gap_len_type_info_attributes.
insert(
1112one_gap_len_info.
insert(one_gap_len_type_info);
1115gap_len_infos_node.
insert(one_gap_len_info);
1117gap_info_root_node.
insert(gap_len_infos_node);
1125cout <<
"SUMMARY:"<< endl;
1127 boolbAnyGapOfLenZero =
false;
1129 const size_tkDigitsInUint8 = numeric_limits<Uint8>::digits10;
1131vecColInfos.
AddCol(
"Gap Length", kDigitsInUint8,
1135 constGA::EGapType eGapType = gap_type_name_it->first;
1136 stringpchGapName = gap_type_name_it->second;
1143 "#Seqs with "+ pchGapName, kDigitsInUint8,
1146 "# of "+ pchGapName, kDigitsInUint8,
1153 const xml::node& one_gap_len_node = *one_gap_len_it;
1157 constGA::TGapLength gap_len =
1158to_uint8(find_attrib_attr_or_die(one_gap_len_info,
"len"));
1159table_printer << gap_len << CellEnd();
1160 if( 0 == gap_len ) {
1161bAnyGapOfLenZero =
true;
1167 const xml::node& gap_len_summary_node = *child_it;
1168 const Uint8num_seqs = to_uint8(
1169find_node_attr_or_die(
1170gap_len_summary_node,
"num_seqs"));
1171table_printer << num_seqs << CellEnd();
1173 const Uint8num_gaps = to_uint8(find_node_attr_or_die(
1174gap_len_summary_node,
"num_gaps"));
1175table_printer << num_gaps << CellEnd();
1182 if( bAnyGapOfLenZero ) {
1183cout <<
"* Note: Gap of length zero means " 1184<<
"'completely unknown length'."<< endl;
1205 constGA::TGapLength gap_len = *all_gap_lens_it;
1207 xml::nodegap_seqs_one_len_node(
"gap_length_info");
1212 constGA::EGapType eGapType = gap_type_name_it->first;
1213 const char* pchGapName = gap_type_name_it->second;
1219 xml::nodegap_seqs_one_len_and_gap_type(
"gap_type_seq_ids");
1221 "gap_type", pchGapName);
1223 constGA::TMapGapLengthToSeqIds & map_len_to_seq_ids =
1226GA::TMapGapLengthToSeqIds::const_iterator find_seq_ids_it =
1227map_len_to_seq_ids.find(gap_len);
1230 if( find_seq_ids_it != map_len_to_seq_ids.end() ) {
1231 constGA::TSetSeqIdConstRef & set_seq_id_const_ref =
1232find_seq_ids_it->second;
1234GA::TSetSeqIdConstRef, seq_id_ref_it, set_seq_id_const_ref)
1238 "seq_id", (*seq_id_ref_it)->AsFastaString().c_str());
1240gap_seqs_one_len_and_gap_type.
push_back(one_seq_node);
1244gap_seqs_one_len_node.
push_back(gap_seqs_one_len_and_gap_type);
1247gap_seqs_root_node.
push_back(gap_seqs_one_len_node);
1283cout <<
"SEQ-IDS FOR EACH GAP-LENGTH:"<< endl;
1286 constGA::TGapLength iGapLength =
1287to_uint8(find_node_attr_or_die(
1288*gap_len_node_it,
"len"));
1289cout <<
"\tSeq-ids with a gap of length " 1290<< iGapLength <<
':'<< endl;
1293 const CTempStringpchGapName = find_node_attr_or_die(
1294*gap_type_seq_ids_it,
"gap_type");
1295cout <<
"\t\t"<< pchGapName <<
":"<< endl;
1297 if( gap_type_seq_ids_it->size() ) {
1300<< find_node_attr_or_die(*seq_info_it,
"seq_id")
1304cout <<
"\t\t\t(NONE)"<< endl;
1328 constGA::EGapType eGapType = gap_type_it->first;
1329 const char* pchGapName = gap_type_it->second;
1335 xml::nodehistogram_node(
"histogram");
1338histogram_node_attrs.
insert(
"gap_type", pchGapName);
1341 m_gapAnalysis.GetGapHistogram(eGapType, num_bins, eHistAlgo));
1360histogram_node.
insert(bin_node);
1363hist_root_node.
insert(histogram_node);
1373 const size_tkDigitsInUint8 = numeric_limits<Uint8>::digits10;
1378 const xml::node& hist_node = *hist_node_it;
1381hist_node_it->get_attributes();
1383 const char* pchGapName = find_attrib_attr_or_die(
1384hist_node_attrs,
"gap_type").data();
1387vecColInfos.
AddCol(
"Range", 1 + 2*kDigitsInUint8);
1388vecColInfos.
AddCol(
"Number in Range", kDigitsInUint8,
1392cout <<
"HISTOGRAM FOR "<< pchGapName <<
":"<< endl;
1397bin_node_it->get_attributes();
1399 const Uint8start = to_uint8(find_attrib_attr_or_die(
1400bin_node_attrs,
"start_inclusive"));
1401 const Uint8end = to_uint8(find_attrib_attr_or_die(
1402bin_node_attrs,
"end_inclusive"));
1403 const Uint8num_appearances = to_uint8(find_attrib_attr_or_die(
1404bin_node_attrs,
"num_appearances"));
1406table_printer << start <<
'-'<< end << CellEnd();
1407table_printer << num_appearances << CellEnd();
1417 constSOutMessage &out_message,
CNcbiOstream& out_strm)
const 1421out_message.WriteAsXML(cout);
1424out_message.WriteAsText(out_strm);
1433 int main(
intargc,
const char* argv[])
1444cerr << as_str << endl;
User-defined methods of the data storage class.
Base class for reading FASTA sequences.
CFormatHints & AddPreferredFormat(TFormat fmt)
Mark the format as preferred.
Class implements different ad-hoc unreliable file format identifications.
CFormatHints & GetFormatHints(void)
Get format hints.
EFormat
The formats are checked in the same order as declared here.
@ eBinaryASN
Binary ASN.1.
@ eFasta
FASTA format sequence record, CFastaReader.
EFormat GuessFormat(EMode)
static const char * GetFormatName(EFormat format)
static TRegisterLoaderInfo RegisterInObjectManager(CObjectManager &om, CReader *reader=0, CObjectManager::EIsDefault is_default=CObjectManager::eDefault, CObjectManager::TPriority priority=CObjectManager::kPriority_NotSet)
Give this gaps, or handles containing gaps and then you can get statistics on those gaps.
void x_PrintSeqsForGapLengths(void)
GA::ESortGapLength m_eSort
vector< GA::TGapLength > TGapLengthVec
virtual int Run(void)
Run the application.
CRef< CScope > x_GetScope(void)
TGapTypeCont m_IncludedGapTypes
int RunNoCatch(void)
"Run" will catch all exceptions and try to do something reasonable, and calls RunNoCatch where the re...
void x_ReadFileOrAccn(const string &sFileOrAccn)
Reads and loads into m_gapAnalysis.
void x_PrintHistogram(Uint8 num_bins, CHistogramBinning::EHistAlgo eHistAlgo)
void x_PrintOutMessage(const SOutMessage &out_message, CNcbiOstream &out_strm) const
x_PrintOutMessage
virtual void Init(void)
Initialize the application.
CSeq_inst::EMol m_MolFilter
AutoPtr< TGapLengthVec > x_CalcAllGapLens(void) const
Returns a vector of all possible gap lengths we've seen.
GA::TAddFlag m_fGapAddFlags
static string x_GapNameToGapXMLNodeName(const CTempString &gap_name)
set< GA::EGapType > TGapTypeCont
void x_PrintSummaryView(void)
CGapStatsApplication(void)
bool x_IncludeGapType(GA::EGapType eGapType) const
vector< SBin > TListOfBins
A histogram is given as a vector of bins.
EHistAlgo
Pick which binning algorithm to use when generating the histogram.
@ eHistAlgo_TryForSameNumDataInEachBin
This algorithm tries to make each bin roughly even in size, except the last bin which may be much sma...
@ eHistAlgo_IdentifyClusters
This algorithm tries to make each bin represent values that are clustered together.
@ eHistAlgo_Default
The default algorithm.
CNcbiOstrstreamToString class helps convert CNcbiOstrstream to a string Sample usage:
class CStaticArrayMap<> provides access to a static array in much the same way as CStaticArraySet<>,...
This can be used to lay out neat ASCII data.
CTempString implements a light-weight string on top of a storage buffer whose lifetime management is ...
iterator_bool insert(const value_type &val)
const_iterator find(const key_type &key) const
const_iterator end() const
const char * get_value(void) const
Get the value of this attribute.
Const Iterator class for accessing attribute pairs.
The xml::attributes class is used to access all the attributes of one xml::node.
iterator find(const char *name, const ns *nspace=NULL)
Find the attribute with the given name and namespace.
iterator end(void)
Get an iterator that points one past the the last attribute.
void insert(const char *name, const char *value, const ns *nspace=NULL)
Add an attribute to the attributes list.
The xml::document class is used to hold the XML tree and various bits of information about it.
void save_to_stream(std::ostream &stream, save_option_flags flags=save_op_default) const
Convert the XML document tree into XML text data and then insert it into the given stream.
const node & get_root_node(void) const
Get a reference to the root node of this document.
The xml::node class is used to hold information about one XML node.
const char * get_name(void) const
Get the name of this xml::node.
void push_back(const node &child)
Add a child xml::node to this node.
void save_to_string(std::string &xml, save_option_flags flags=save_op_default) const
Convert the node and all its children into XML text and set the given string to that text.
void set_content(const char *content)
Set the content of a node.
iterator insert(const node &n)
Insert a new child node.
xml::attributes & get_attributes(void)
Get the list of attributes.
CNcbiOstream & operator<<(CNcbiOstream &out, const CEquivRange &range)
Operators to edit gaps in sequences.
Analyzes gaps and produces various statistics.
#define ITERATE_GAP_TYPES(iter_name)
void print_xml_node(xml::node *a_node)
int main(int argc, const char *argv[])
void reset(element_type *p=0, EOwnership ownership=eTakeOwnership)
Reset will delete the old pointer (if owned), set content to the new value, and assume the ownership ...
virtual const CArgs & GetArgs(void) const
Get parsed command line arguments.
int AppMain(int argc, const char *const *argv, const char *const *envp=0, EAppDiagStream diag=eDS_Default, const char *conf=NcbiEmptyCStr, const string &name=NcbiEmptyString)
Main function (entry point) for the NCBI application.
virtual void SetupArgDescriptions(CArgDescriptions *arg_desc)
Setup the command line argument descriptions.
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
const CNcbiArguments & GetArguments(void) const
Get the application's cached unprocessed command-line arguments.
size_t GetNExtra(void) const
Get the number of unnamed positional (a.k.a. extra) args.
@ eRequires
One argument requires another.
@ eInt8
Convertible into an integer number (Int8 only)
@ eString
An arbitrary string.
@ eInteger
Convertible into an integer number (int or Int8)
#define NCBI_USER_THROW_FMT(message)
Throw a "user exception" with message processed as output to ostream.
virtual const char * what(void) const noexcept
Standard report (includes full backlog).
#define FORMAT(message)
Format message using iostreams library.
ESerialDataFormat
Data file format.
@ eSerial_AsnText
ASN.1 text.
@ eSerial_AsnBinary
ASN.1 binary.
CRef< CSeq_entry > ReadSet(int max_seqs=kMax_Int, ILineErrorListener *pMessageListener=nullptr)
Read multiple sequences (by default, as many as are available.)
static CRef< CObjectManager > GetInstance(void)
Return the existing object manager or create one.
CSeq_entry_Handle AddTopLevelSeqEntry(CSeq_entry &top_entry, TPriority pri=kPriority_Default, EExist action=eExist_Default)
Add seq_entry, default priority is higher than for defaults or loaders Add object to the score with p...
CBioseq_Handle GetBioseqHandle(const CSeq_id &id)
Get bioseq handle by seq-id.
void AddDefaults(TPriority pri=kPriority_Default)
Add default data loaders from object manager.
void ResetDataAndHistory(void)
Clear all information in the scope except added data loaders.
CSeq_entry_Handle GetParentEntry(void) const
Get parent Seq-entry handle.
void Reset(void)
Reset reference object.
void Reset(void)
Reset reference object.
uint64_t Uint8
8-byte (64-bit) unsigned integer
IO_PREFIX::ostream CNcbiOstream
Portable alias for ostream.
IO_PREFIX::ifstream CNcbiIfstream
Portable alias for ifstream.
static list< string > & Split(const CTempString str, const CTempString delim, list< string > &arr, TSplitFlags flags=0, vector< SIZE_TYPE > *token_pos=NULL)
Split a string using specified delimiters.
static string Join(const TContainer &arr, const CTempString &delim)
Join strings using the specified delimiter.
static Uint8 StringToUInt8(const CTempString str, TStringToNumFlags flags=0, int base=10)
Convert string to Uint8.
static enable_if< is_arithmetic< TNumeric >::value||is_convertible< TNumeric, Int8 >::value, string >::type NumericToString(TNumeric value, TNumToStringFlags flags=0, int base=10)
Convert numeric value to string.
static string & ReplaceInPlace(string &src, const string &search, const string &replace, SIZE_TYPE start_pos=0, SIZE_TYPE max_replace=0, SIZE_TYPE *num_replace=0)
Replace occurrences of a substring within a string.
static string & ToLower(string &str)
Convert string to lower case â string& version.
#define DEFINE_STATIC_FAST_MUTEX(id)
Define static fast mutex and initialize it.
TSeq & SetSeq(void)
Select the variant.
EMol
molecule class in living organism
@ eMol_not_set
> cdna = rna
@ eMol_na
just a nucleic acid
static void text(MDB_val *v)
constexpr auto sort(_Init &&init)
const struct ncbi::grid::netcache::search::fields::KEY key
@ save_op_no_decl
Drop the xml declaration.
Defines the CNcbiApplication and CAppException classes for creating NCBI applications.
#define NCBI_APP_SET_VERSION_AUTO(major, minor)
Defines command line argument related classes.
Defines unified interface to application:
Defines classes: CDirEntry, CFile, CDir, CSymLink, CMemoryFile, CFileUtil, CFileLock,...
std::istream & in(std::istream &in_, double &x_)
Generic utility macros and templates for exploring NCBI objects.
#define BEGIN_COMMA_END(container)
#define DEFINE_STATIC_ARRAY_MAP(Type, Var, Array)
Holds the information about a bin.
Uint8 total_appearances
The total number of data points in this bin for all values from first_number to last_number.
TValue first_number
The start range of the bin (inclusive)
TValue last_number
The end range of the bin (inclusive)
This holds the info about all columns for the table.
void AddCol(const string &sColName, Uint4 iColWidth=0, EJustify eJustify=eJustify_Left, EDataTooLong eDataTooLong=eDataTooLong_Default)
Stream an instance of this object into the CTablePrinter to have it write out the current table cell ...
Define Case-sensitive string comparison methods.
Template structure SStaticPair is simlified replacement of STL pair<> Main reason of introducing this...
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4