93 #include <common/ncbi_revision.h>
95 #ifndef NCBI_SC_VERSION
96 # define THIS_IS_TRUNK_BUILD
97 #elif (NCBI_SC_VERSION == 0)
98 # define THIS_IS_TRUNK_BUILD
103 using namespace ncbi;
108 class CMissingInputException : exception
116 throw CMissingInputException();
143 string GetText()
const override {
return m_txt; }
160 const string& sMessage,
161 const Uint8 iNumDone = 0,
162 const Uint8 iNumTotal = 0)
override
170 auto edit =
dynamic_cast<const edit::CRemoteUpdaterMessage*
>(&message);
172 if (
edit->m_error != edit::EPubmedError::citation_not_found)
182 string str = ss.str();
203 "aln-file",
"InFile",
"Alignment input file",
212 "aln-gapchar",
"STRING",
"Alignment missing indicator",
217 "aln-missing",
"STRING",
"Alignment missing indicator",
222 "aln-alphabet",
"STRING",
"Alignment alphabet",
237 HideStdArgs(fHideDryRun);
244 arg_desc->AddOptionalKey(
245 "indir",
"Directory",
"Path to input files",
248 arg_desc->AddOptionalKey(
249 "outdir",
"Directory",
"Path to results",
252 arg_desc->AddFlag(
"E",
"Recurse");
254 arg_desc->AddDefaultKey(
257 arg_desc->AddOptionalKey(
258 "i",
"InFile",
"Single Input File",
261 x_SetAlnArgs(*arg_desc);
263 arg_desc->AddOptionalKey(
264 "o",
"OutFile",
"Single Output File",
267 arg_desc->AddDefaultKey(
270 arg_desc->AddFlag(
"binary",
"Output binary ASN.1");
272 arg_desc->AddOptionalKey(
"t",
"InFile",
"Template File",
275 arg_desc->AddDefaultKey(
276 "a",
"String",
"File Type\n"
278 " s FASTA Set (s Batch, s1 Pop, s2 Phy, s3 Mut, s4 Eco,\n"
279 " s9 Small-genome)\n"
280 " d FASTA Delta, di FASTA Delta with Implicit Gaps\n"
282 may be implemented
in the future; RW-1253
283 " l FASTA+Gap Alignment (l Batch, l1 Pop, l2 Phy, l3 Mut, l4 Eco,\n"
284 " l9 Small-genome)\n"
286 " z FASTA with Gap Lines"
288 may be implemented
in the future; RW-1253
294 arg_desc->AddFlag(
"J",
"Delayed Genomic Product Set ");
296 arg_desc->AddOptionalKey(
298 arg_desc->AddOptionalKey(
302 arg_desc->AddOptionalKey(
303 "j",
"String",
"Source Qualifiers.\nThese qualifier values override any conflicting values read from a file (See -src-file)",
305 arg_desc->AddOptionalKey(
"src-file",
"InFile",
"Single source qualifiers file. The qualifiers in this file override any conflicting qualifiers automically read from a .src file, which, in turn, take precedence over source qualifiers specified in a fasta defline",
CArgDescriptions::eInputFile);
306 arg_desc->AddFlag(
"accum-mods",
"Accumulate non-conflicting modifier values from different sources. For example, with this option, a 'note' modifier specified on the command line no longer overwrites a 'note' modifier read from a .src file. Both notes will appear in the output ASN.1. If modifier values conflict, the rules of precedence specified above apply");
307 arg_desc->AddOptionalKey(
309 arg_desc->AddOptionalKey(
311 arg_desc->AddOptionalKey(
313 arg_desc->AddOptionalKey(
316 arg_desc->AddOptionalKey(
317 "V",
"String",
"Verification (combine any of the following letters)\n\
318 v Validate with Normal Stringency\n\
319 b Generate GenBank Flatfile\n\
322 arg_desc->AddFlag(
"q",
"Seq ID from File Name");
324 arg_desc->AddFlag(
"U",
"Remove Unnecessary Gene Xref");
325 arg_desc->AddFlag(
"T",
"Remote Taxonomy Lookup");
326 arg_desc->AddFlag(
"P",
"Remote Publication Lookup");
327 arg_desc->AddFlag(
"W",
"Log Progress");
328 arg_desc->AddFlag(
"K",
"Save Bioseq-set");
330 arg_desc->AddOptionalKey(
"H",
"String",
"Hold Until Publish\n\
331 y Hold for One Year\n\
334 arg_desc->AddFlag(
"Z",
"Output discrepancy report");
335 arg_desc->AddFlag(
"split-dr",
"Create unique discrepancy report for each output file");
337 arg_desc->AddOptionalKey(
"c",
"String",
"Cleanup (combine any of the following letters)\n\
338 b Basic cleanup (default)\n\
339 e Extended cleanup\n\
340 f Fix product names\n\
341 s Add exception to short introns\n\
342 w WGS cleanup (only needed when using a GFF3 file)\n\
343 d Correct Collection Dates (assume month first)\n\
344 D Correct Collection Dates(assume day first)\n\
345 x Extend ends of features by one or two nucleotides to abut gaps or sequence ends\n\
353 arg_desc->AddOptionalKey(
"M",
"String",
"Master Genome Flags\n\
357 arg_desc->AddOptionalKey(
"l",
"String",
"Add type of evidence used to assert linkage across assembly gaps. May be used multiple times. Must be one of the following:\n\
370 arg_desc->AddOptionalKey(
"linkage-evidence-file",
"InFile",
"File listing linkage evidence for gaps of different lengths",
CArgDescriptions::eInputFile);
372 arg_desc->AddOptionalKey(
"gap-type",
"String",
"Set gap type for runs of Ns. Must be one of the following:\n\
381 unknown (obsolete)\n\
392 arg_desc->AddOptionalKey(
"ft-url-mod",
"String",
"FileTrack URL for the XML file base modifications",
CArgDescriptions::eString);
395 arg_desc->AddOptionalKey(
"gaps-unknown",
"Integer",
"exact number of Ns recognised as a gap with unknown length",
CArgDescriptions::eInteger);
401 arg_desc->AddFlag(
"postprocess-pubs",
"Postprocess pubs: convert authors to standard");
402 arg_desc->AddOptionalKey(
"locus-tag-prefix",
"String",
"Add prefix to locus tags in annotation files",
CArgDescriptions::eString);
403 arg_desc->AddFlag(
"no-locus-tags-needed",
"Submission data does not require locus tags");
404 arg_desc->AddFlag(
"euk",
"Assume eukaryote, and create missing mRNA features");
405 arg_desc->AddOptionalKey(
"suspect-rules",
"String",
"Path to a file containing suspect rules set. Overrides environment variable PRODUCT_RULES_LIST",
CArgDescriptions::eString);
406 arg_desc->AddFlag(
"allow-acc",
"Allow accession recognition in sequence IDs. Default is local");
407 arg_desc->AddFlag(
"augustus-fix",
"(Deprecated) Special handling of unusual problems in Augustus annotations",
409 arg_desc->AddFlag(
"intronless",
"Intronless alignments");
410 arg_desc->AddFlag(
"refine-prt-alignments",
"Refine ProSplign aligments when processing .prt input");
411 arg_desc->AddOptionalKey(
"prt-alignment-filter-query",
"String",
416 arg_desc->SetDependency(
"logxml",
419 arg_desc->AddFlag(
"split-logs",
"Create unique log file for each output file");
420 arg_desc->AddFlag(
"verbose",
"Be verbose on reporting");
421 arg_desc->AddFlag(
"huge",
"Execute in huge-file mode");
422 arg_desc->AddFlag(
"disable-huge",
"Explicitly disable huge-files mode");
423 arg_desc->SetDependency(
"disable-huge",
427 arg_desc->AddOptionalKey(
"usemt",
"String",
"Try to use as many threads as:\n\
433 arg_desc->AddFlag(
"fetchall",
"Search data in all available databases");
436 arg_desc->SetUsageContext(
"",
"Converts files of various formats to ASN.1");
439 SetupArgDescriptions(arg_desc.release());
453 string numThreadsConfig;
455 numThreadsConfig = args[
"usemt"].AsString();
457 numThreadsConfig = GetConfig().GetString(
"table2asn",
"UseThreads",
"one");
459 static constexpr array<string_view, 3> numThreadsValues{
"one",
"two",
"many" };
460 auto numThreads = distance(
begin(numThreadsValues),
461 find(
begin(numThreadsValues),
end(numThreadsValues), numThreadsConfig));
463 if (1 <= numThreads && numThreads <= 3) {
464 cerr <<
"Will be using " << numThreadsConfig <<
" threads" << endl;
477 CTime expires = GetFullVersion().GetBuildInfo().GetBuildTime();
481 NcbiCerr <<
"This copy of " << GetProgramDisplayName()
482 <<
" is more than 1 year old. Please download the current version if it is newer." << endl;
486 m_context.m_disable_huge_files = args[
"disable-huge"];
487 if (! m_context.m_disable_huge_files) {
488 m_context.m_can_use_huge_files = args[
"huge"] || GetConfig().GetBool(
"table2asn",
"UseHugeFiles",
false);
489 if (m_context.m_can_use_huge_files) {
490 std::cerr <<
"Will be using huge files scenario" << std::endl;
494 m_context.m_split_log_files = args[
"split-logs"].AsBoolean();
495 if (m_context.m_split_log_files && args[
"logfile"]) {
497 "-logfile cannot be used with -split-logs");
499 m_context.m_verbose = args[
"verbose"].AsBoolean();
503 app_logger->SetProgressOstream(error_log);
505 m_logger.Reset(app_logger);
506 m_context.m_logger = m_logger;
507 m_logger->m_enable_log = args[
"W"].AsBoolean();
508 m_context.m_remote_updater.reset(
new edit::CRemoteUpdater(m_logger));
509 m_context.m_remote_updater->SetPubmedInterceptor(
s_PubCleanup);
512 m_context.m_SetIDFromFile = args[
"q"].AsBoolean();
513 m_context.m_allow_accession = args[
"allow-acc"].AsBoolean();
514 m_context.m_delay_genprodset = args[
"J"].AsBoolean();
515 m_context.m_accumulate_mods = args[
"accum-mods"].AsBoolean();
516 m_context.m_binary_asn1_output = args[
"binary"].AsBoolean();
519 if (args[
"c"].AsString().find_first_not_of(
"-befwsdDx") != string::npos) {
521 "Unrecognized cleanup type " + args[
"c"].AsString());
524 m_context.m_cleanup = args[
"c"].AsString();
526 m_context.m_cleanup =
"b";
529 m_context.m_master_genome_flag = args[
"M"].AsString();
530 m_context.m_delay_genprodset =
true;
531 m_context.m_HandleAsSet =
true;
532 m_context.m_cleanup +=
"fU";
533 m_context.m_validate =
"v";
534 if (m_context.m_master_genome_flag.find(
'n') != string::npos) {
536 }
else if (m_context.m_master_genome_flag.find(
't') != string::npos) {
545 if (args[
"fcs-file"]) {
549 m_fcs_reader->LoadFile(*reader);
550 m_context.m_fcs_trim = args[
"fcs-trim"];
552 if (args[
"min-threshold"])
553 m_context.m_minimal_sequence_length = args[
"min-threshold"].AsInteger();
561 m_context.m_Comment = args[
"y"].AsString();
562 else if (args[
"Y"]) {
564 while (! reader->
AtEOF()) {
567 m_context.m_Comment +=
" ";
572 if (args[
"U"] && args[
"U"].AsBoolean())
573 m_context.m_cleanup +=
'U';
576 m_context.m_disc_lineage = args[
"m"].AsString();
579 m_context.m_asn1_suffix = args[
"out-suffix"].AsString();
581 m_context.m_save_bioseq_set = args[
"K"].AsBoolean();
582 m_context.prtAlnOptions.intronless = args[
"intronless"].AsBoolean();
583 m_context.prtAlnOptions.refineAlignment = args[
"refine-prt-alignments"].AsBoolean();
584 if (args[
"prt-alignment-filter-query"]) {
585 m_context.prtAlnOptions.filterQueryString = args[
"prt-alignment-filter-query"].AsString();
592 m_context.m_ft_url = args[
"ft-url"].AsString();
593 if (args[
"ft-url-mod"])
594 m_context.m_ft_url_mod = args[
"ft-url-mod"].AsString();
596 m_context.m_accession.
Reset(
new CSeq_id(args[
"A"].AsString()));
598 m_context.mCommandLineMods = args[
"j"].AsString();
601 m_context.m_single_structure_cmt = args[
"w"].AsString();
603 m_context.m_RemotePubLookup = args[
"P"].AsBoolean();
604 if (! m_context.m_RemotePubLookup)
605 m_context.m_postprocess_pubs = args[
"postprocess-pubs"].AsBoolean();
607 m_context.m_RemoteTaxonomyLookup = args[
"T"].AsBoolean();
608 if (m_context.m_RemoteTaxonomyLookup) {
609 m_context.m_cleanup +=
'T';
613 const string& a_arg = args[
"a"].AsString();
614 if (a_arg ==
"s" || a_arg ==
"z") {
615 m_context.m_HandleAsSet =
true;
616 }
else if (a_arg ==
"s1") {
617 m_context.m_HandleAsSet =
true;
619 }
else if (a_arg ==
"s2") {
620 m_context.m_HandleAsSet =
true;
622 }
else if (a_arg ==
"s3") {
623 m_context.m_HandleAsSet =
true;
625 }
else if (a_arg ==
"s4") {
626 m_context.m_HandleAsSet =
true;
628 }
else if (a_arg ==
"s9") {
629 m_context.m_HandleAsSet =
true;
631 }
else if (a_arg ==
"di") {
632 m_context.m_di_fasta =
true;
633 }
else if (a_arg ==
"d") {
634 m_context.m_d_fasta =
true;
637 if (args[
"gaps-min"]) {
638 int gaps_min = args[
"gaps-min"].AsInteger();
641 "Invalid value: gaps-min cannot be negative.");
643 m_context.m_gapNmin =
static_cast<TSeqPos>(gaps_min);
645 if (args[
"gaps-unknown"]) {
646 int gaps_unknown = args[
"gaps-unknown"].AsInteger();
647 if (gaps_unknown < 0) {
649 "Invalid value: gaps-unknown cannot be negative.");
651 m_context.m_gap_Unknown_length =
static_cast<TSeqPos>(gaps_unknown);
653 if (m_context.m_gap_Unknown_length > 0 && m_context.m_gapNmin == 0) {
654 m_context.m_gapNmin = m_context.m_gap_Unknown_length;
657 if (args[
"linkage-evidence-file"]) {
662 args[
"linkage-evidence-file"].AsString(),
663 m_context.m_GapsizeToEvidence,
670 for (
auto& arg_it : args[
"l"].GetStringList()) {
672 auto value = linkage_evidence_to_value->FindValue(arg_it);
673 m_context.m_DefaultEvidence.insert(
value);
677 "Unrecognized linkage evidence " + arg_it);
682 if (args[
"gap-type"]) {
685 auto value = gaptype_to_value->FindValue(args[
"gap-type"].AsString());
686 m_context.m_gap_type =
value;
689 "Unrecognized gap type " + args[
"gap-type"].AsString());
694 string sdate = args[
"H"].AsString();
695 if (sdate ==
"Y" || sdate ==
"y") {
696 m_context.m_HoldUntilPublish.SetCurrent();
697 m_context.m_HoldUntilPublish.SetYear(m_context.m_HoldUntilPublish.Year() + 1);
700 if (sdate[0] ==
'\'' && sdate.length() > 0 && sdate[sdate.length() - 1] ==
'\'') {
702 sdate.erase(sdate.length() - 1, 1);
704 m_context.m_HoldUntilPublish =
CTime(sdate,
"M/D/Y");
707 m_context.m_HoldUntilPublish.SetCurrent();
708 m_context.m_HoldUntilPublish.SetYear(m_context.m_HoldUntilPublish.Year() + years);
714 m_context.m_ProjectVersionNumber = args[
"N"].AsString();
717 m_context.m_genome_center_id = args[
"C"].AsString();
718 if (! m_context.m_ProjectVersionNumber.empty())
719 m_context.m_genome_center_id += m_context.m_ProjectVersionNumber;
723 m_context.m_validate += args[
"V"].AsString();
725 while ((p = m_context.m_validate.find(
"b")) != string::npos) {
726 m_context.m_validate.erase(p, 1);
727 m_context.m_make_flatfile =
true;
729 while ((p = m_context.m_validate.find(
"t")) != string::npos) {
731 m_context.m_validate.erase(p, 1);
736 m_context.m_run_discrepancy =
true;
737 if (args[
"split-dr"])
738 m_context.m_split_discrepancy =
true;
741 if (args[
"locus-tag-prefix"] || args[
"no-locus-tags-needed"]) {
742 if (args[
"locus-tag-prefix"] && args[
"no-locus-tags-needed"]) {
745 "-no-locus-tags-needed and -locus-tag-prefix are mutually exclusive");
747 if (args[
"no-locus-tags-needed"]) {
748 m_context.m_locus_tag_prefix =
"";
749 m_context.m_locus_tags_needed =
false;
751 m_context.m_locus_tag_prefix = args[
"locus-tag-prefix"].AsString();
752 m_context.m_locus_tags_needed =
true;
756 if (m_context.m_HandleAsSet) {
766 m_context.m_output_filename = args[
"o"].AsString();
767 m_context.m_output = &args[
"o"].AsOutputFile();
769 if (args[
"outdir"]) {
770 CDir outputdir(m_context.m_ResultsDirectory);
777 m_context.m_eukaryote = args[
"euk"].AsBoolean();
779 if (m_context.m_cleanup.find(
'f') != string::npos)
780 m_context.m_use_hypothetic_protein =
true;
782 if (args[
"suspect-rules"])
783 m_context.m_suspect_rules->SetRulesFilename(args[
"suspect-rules"].AsString());
787 m_context.m_t =
true;
788 m_reader->LoadTemplate(args[
"t"].AsString());
796 m_reader->LoadDescriptors(args[
"D"].AsString(), m_global_files.m_descriptors);
802 if (m_logger->Count() == 0)
805 string annot_file = args[
"f"].AsString();
806 if (!
CFile(annot_file).Exists()) {
808 "The specified annotation file \"" + annot_file +
"\" does not exist.",
811 m_context.m_single_annot_file = args[
"f"].AsString();
813 if (args[
"src-file"]) {
814 string src_file = args[
"src-file"].AsString();
815 if (!
CFile(src_file).Exists()) {
817 "The specified source qualifier file \"" + src_file +
"\" does not exist.",
820 m_context.m_single_source_qual_file = args[
"src-file"].AsString();
825 m_context.m_current_file = args[
"i"].AsString();
826 CFile argAsFile(m_context.m_current_file);
827 if (! argAsFile.
Exists()) {
829 "The specified input file \"" + m_context.m_current_file +
"\" does not exist.",
832 if (argAsFile.
GetLength() > TBL2ASN_MAX_ALLOWED_FASTA_SIZE && m_context.m_disable_huge_files) {
835 "The specified input file \"" +
836 m_context.m_current_file +
837 "\" is too long. The maximum permissible file size for a FASTA sequence is " +
839 " bytes. Consider allowing huge mode (remove \"-disable-huge\" from the command line).",
843 ProcessOneFile(
false);
844 }
else if (args[
"indir"]) {
846 string indir = args[
"indir"].AsString();
847 CDir directory(indir);
848 if (! directory.
Exists()) {
850 "The specified input directory \"" + indir +
"\" does not exist.",
853 string basename = m_context.m_output_filename.empty() ?
855 m_context.m_output_filename;
860 masks.
Add(
"*" + args[
"x"].AsString());
862 ProcessOneDirectory(directory, masks, args[
"E"].AsBoolean());
863 }
else if (args[
"aln-file"]) {
864 m_context.m_current_file = args[
"aln-file"].AsString();
867 "The specified alignment file \"" + m_context.m_current_file +
"\" does not exist.",
870 const bool isAlignment =
true;
871 ProcessOneFile(isAlignment);
875 if (m_context.m_verbose &&
876 m_global_files.mp_src_qual_map &&
877 ! m_global_files.mp_src_qual_map->Empty()) {
878 m_global_files.mp_src_qual_map->ReportUnusedIds();
881 if (m_validator->ValTotalErrors() > 0) {
883 ostr.exceptions(ios::failbit | ios::badbit);
884 ostr.open(m_context.GenerateOutputFilename(
eFiles::stats, m_context.m_base_name));
885 m_validator->ValReportErrorStats(ostr);
887 m_validator->ReportDiscrepancies(m_context.GenerateOutputFilename(
eFiles::dr, m_context.m_base_name));
888 }
catch (
const CMissingInputException&) {
896 auto msg = original->
GetMsg();
901 if (bad_res_exc->GetBadResiduePositions().m_BadIndexMap.size() == 1) {
904 lines.reserve(bad_res_exc->GetBadResiduePositions().m_BadIndexMap.size());
905 for(
auto rec: bad_res_exc->GetBadResiduePositions().m_BadIndexMap) {
906 lines.push_back(rec.first);
910 unique_ptr<CLineError>
le(
912 bad_res_exc->GetBadResiduePositions().m_SeqId->AsFastaString(),
913 line,
"",
"",
"", msg, lines));
914 m_logger->PutError(*
le);
918 if (!args[
"r"] && !(args.
Exist(
"vdb") && args[
"vdb"]) && msg.find(
"Cannot resolve") != string::npos) {
919 msg +=
" - try running with -r to enable remote retrieval of sequences";
927 if (m_logger->Count() == 0) {
928 #ifdef THIS_IS_TRUNK_BUILD
929 m_context.m_remote_updater->ReportStats(std::cerr);
933 if (args[
"logxml"]) {
935 log_xml <<
"<logmessages>" << endl;
936 m_logger->DumpAsXML(log_xml);
937 log_xml <<
"</logmessages>" << endl;
965 auto scope =
Ref(
new CScope(*m_context.m_ObjMgr));
966 scope->AddDefaults();
971 m_reader->GetSeqEntry(entry, submit, obj);
973 bool avoid_submit_block =
false;
977 if (m_context.m_SetIDFromFile) {
978 m_context.SetSeqId(*entry);
981 m_context.ApplyAccession(*entry);
984 std::function<std::ostream&()>
f = [
this]() -> std::ostream& {
return m_context.GetOstream(
eFiles::fixedproducts); };
985 m_context.m_suspect_rules->SetupOutput(
f);
987 m_context.ApplyFileTracks(*entry);
989 const bool readModsFromTitle =
992 xProcessSecretFiles1Phase(readModsFromTitle, *entry);
994 if (m_context.m_RemoteTaxonomyLookup) {
995 m_context.m_remote_updater->UpdateOrgFromTaxon(*entry);
1000 m_secret_files->m_feature_table_reader->m_replacement_protein = m_secret_files->m_replacement_proteins;
1002 m_secret_files->m_feature_table_reader->MergeCDSFeatures(*entry, token);
1005 m_secret_files->m_feature_table_reader->MoveProteinSpecificFeats(*entry);
1007 m_context.CorrectCollectionDates(*entry);
1009 if (m_secret_files->m_possible_proteins.NotEmpty())
1010 m_secret_files->m_feature_table_reader->AddProteins(*m_secret_files->m_possible_proteins, *entry);
1012 if (m_context.m_HandleAsSet) {
1013 m_secret_files->m_feature_table_reader->ConvertNucSetToSet(entry);
1019 m_context.ApplyCreateUpdateDates(*entry);
1022 m_context.ApplyComments(*entry);
1023 ProcessSecretFiles2Phase(*entry);
1027 if (avoid_submit_block)
1028 result = m_context.CreateSeqEntryFromTemplate(entry);
1030 result = m_context.CreateSubmitFromTemplate(entry, submit);
1032 m_secret_files->m_feature_table_reader->MakeGapsFromFeatures(*entry);
1034 if (m_context.m_delay_genprodset) {
1043 if (m_context.m_RemotePubLookup) {
1044 m_context.m_remote_updater->UpdatePubReferences(*obj);
1046 if (m_context.m_postprocess_pubs) {
1047 edit::CRemoteUpdater::PostProcessPubs(*entry);
1050 if (m_context.m_cleanup.find(
'-') == string::npos) {
1051 m_validator->Cleanup(submit, seh, m_context.m_cleanup);
1057 m_secret_files->m_feature_table_reader->ChangeDeltaProteinToRawProtein(*entry);
1060 m_validator->UpdateECNumbers(*entry);
1062 if (! m_context.m_validate.empty()) {
1063 m_validator->ValCollect(submit, entry, m_context.m_validate);
1066 m_validator->CollectDiscrepancies(submit, seh);
1068 if (m_context.m_make_flatfile) {
1069 MakeFlatFile(seh, submit, m_context.GetOstream(
eFiles::gbf));
1076 m_context.ApplyComments(*entry);
1078 if (m_global_files.m_descriptors)
1079 m_reader->ApplyDescriptors(*entry, *m_global_files.m_descriptors);
1081 if (m_secret_files->m_descriptors)
1082 m_reader->ApplyDescriptors(*entry, *m_secret_files->m_descriptors);
1084 if (need_update_date) {
1085 m_context.ApplyUpdateDate(*entry);
1089 if (m_context.m_RemotePubLookup) {
1090 m_context.m_remote_updater->UpdatePubReferences(*submit);
1101 "File " + m_context.m_current_file +
" contains multiple sequences",
1102 *(m_context.m_logger));
1108 auto& submit = token.
submit;
1110 auto& scope = token.
scope;
1111 auto& seh = token.
seh;
1113 scope =
Ref(
new CScope(*m_context.m_ObjMgr));
1114 scope->AddDefaults();
1131 if (m_context.m_SetIDFromFile) {
1132 m_context.SetSeqId(*entry);
1135 m_context.ApplyAccession(*entry);
1136 m_context.ApplyFileTracks(*entry);
1138 const bool readModsFromTitle =
1141 ProcessSecretFiles1Phase(readModsFromTitle, token);
1143 if (m_context.m_RemoteTaxonomyLookup) {
1144 m_context.m_remote_updater->UpdateOrgFromTaxon(*entry);
1149 m_secret_files->m_feature_table_reader->m_replacement_protein = m_secret_files->m_replacement_proteins;
1150 m_secret_files->m_feature_table_reader->MergeCDSFeatures(*entry, token);
1153 m_secret_files->m_feature_table_reader->MoveProteinSpecificFeats(*entry);
1155 if (m_secret_files->m_possible_proteins.NotEmpty())
1156 m_secret_files->m_feature_table_reader->AddProteins(*m_secret_files->m_possible_proteins, *entry);
1158 m_context.CorrectCollectionDates(*entry);
1160 if (m_context.m_HandleAsSet) {
1167 m_context.ApplyCreateUpdateDates(*entry);
1170 m_context.ApplyComments(*entry);
1172 ProcessSecretFiles2Phase(*entry);
1174 m_secret_files->m_feature_table_reader->MakeGapsFromFeatures(*entry);
1176 if (m_context.m_delay_genprodset) {
1182 seh = scope->AddTopLevelSeqEntry(*entry);
1187 if (m_context.m_RemotePubLookup) {
1188 m_context.m_remote_updater->UpdatePubReferences(*obj);
1191 if (m_context.m_postprocess_pubs) {
1192 m_context.m_remote_updater->PostProcessPubs(*entry);
1196 if (m_context.m_cleanup.find(
'-') == string::npos) {
1199 m_validator->Cleanup(submit, seh, m_context.m_cleanup);
1201 m_validator->Cleanup(submit, seh, m_context.m_cleanup);
1208 m_secret_files->m_feature_table_reader->ChangeDeltaProteinToRawProtein(*entry);
1210 m_validator->UpdateECNumbers(*entry);
1212 if (! m_context.m_validate.empty()) {
1213 m_validator->ValCollect(submit, entry, m_context.m_validate);
1216 m_validator->CollectDiscrepancies(submit, seh);
1228 ffgenerator.
Generate(seh, ostream);
1236 m_context.SetOutputFilename(e, m_context.GenerateOutputFilename(e));
1239 if (m_context.m_split_discrepancy) {
1242 m_context.OpenDiagnosticOutputs();
1247 if (m_context.m_output) {
1248 m_context.SetOutputFile(
eFiles::asn, *m_context.m_output);
1252 m_context.OpenDataOutputs();
1257 m_context.CloseDiagnosticOutputs();
1262 m_context.CloseDataOutputs();
1267 if (
context.m_disable_huge_files) {
1270 return (
context.m_can_use_huge_files ||
1278 if (m_context.m_split_log_files)
1279 m_context.m_logger->ClearAll();
1282 if (! IsDryRun() && m_context.m_split_log_files) {
1283 log_name = m_context.GenerateOutputFilename(
eFiles::log);
1285 m_logger->SetProgressOstream(error_log);
1290 if (manageDiagnosticStreams) {
1291 SetupAndOpenDiagnosticStreams();
1293 if (manageDataStreams) {
1294 SetupAndOpenDataStreams();
1298 std::function<std::ostream&()>
f = [
this]() -> std::ostream& {
return m_context.GetOstream(
eFiles::fixedproducts); };
1299 m_context.m_suspect_rules->SetupOutput(
f);
1301 m_context.m_huge_files_mode =
false;
1303 LoadAdditionalFiles();
1306 ProcessAlignmentFile(
output);
1308 m_validator->Clear();
1310 edit::CHugeFile hugeFile;
1314 auto message = e.GetMsg();
1315 if (message ==
"File format not supported") {
1324 if (! m_context.m_use_threads) {
1325 m_context.m_use_threads = xGetNumThreads();
1328 ProcessHugeFile(hugeFile,
output);
1330 const string objectType =
1331 hugeFile.m_content ?
1332 hugeFile.m_content->GetName() :
1342 if (! m_context.m_validate.empty())
1343 m_validator->ValReportErrors();
1345 if (m_context.m_split_discrepancy)
1346 m_validator->ReportDiscrepancies();
1348 ReportUnusedSourceQuals();
1352 if (! log_name.
GetPath().empty()) {
1353 m_logger->SetProgressOstream(&
NcbiCout);
1355 if (manageDiagnosticStreams) {
1356 CloseDiagnosticStreams();
1358 if (manageDataStreams) {
1362 if (! log_name.
GetPath().empty()) {
1363 m_logger->SetProgressOstream(&
NcbiCout);
1366 m_context.DeleteOutputs();
1367 if (m_context.m_output) {
1369 _ASSERT(! m_context.m_output_filename.empty());
1379 const string& contentType,
1380 unique_ptr<CNcbiIstream>& pIstr,
1385 m_reader->FetchEntry(
format,
1390 xProcessOneFile(
format, pInputObject, annotMap,
output);
1408 if (! annotMap.
empty()) {
1409 for (
auto entry : annotMap) {
1410 auto it = m_secret_files->m_AnnotMap.find(entry.first);
1411 if (it == m_secret_files->m_AnnotMap.end()) {
1412 m_secret_files->m_AnnotMap.emplace(entry.first, entry.second);
1414 it->second.splice(it->second.end(), entry.second);
1424 if (! IsDryRun() &&
result.NotEmpty()) {
1425 const CSerialObject* to_write =
result;
1426 if (m_context.m_save_bioseq_set) {
1427 if (
result->GetThisTypeInfo()->IsType(CSeq_entry::GetTypeInfo())) {
1430 to_write = &se->
GetSet();
1434 m_reader->WriteObject(*to_write, *
output);
1436 input_obj = m_reader->ReadNextEntry();
1442 const string& filename = m_context.m_current_file;
1443 unique_ptr<CNcbiIstream> pIstream(
new CNcbiIfstream(filename));
1447 m_context.MergeWithTemplate(*pEntry);
1452 ProcessOneEntry(inputFormat, pEntry, pResult);
1454 if (IsDryRun() || ! pResult) {
1458 if (m_context.m_save_bioseq_set &&
1463 if (pTempEntry->
IsSet()) {
1468 m_reader->WriteObject(*pResult, *
output);
1475 vector<unique_ptr<CDir::CDirEntry>> vec(
entries->size());
1476 auto vec_it = vec.begin();
1478 vec_it->reset(it.release());
1482 auto compareNames = [](
const auto& l,
const auto&
r) {
return l->GetPath() <
r->GetPath(); };
1483 sort(vec.begin(), vec.end(), compareNames);
1485 bool commonOutputStream =
GetArgs()[
"o"];
1486 if (commonOutputStream) {
1487 SetupAndOpenDataStreams();
1489 SetupAndOpenDiagnosticStreams();
1491 for (
const auto& it : vec) {
1493 if (! it->IsDir()) {
1494 auto pathName = it->GetPath();
1495 if (
mask.Match(pathName)) {
1496 m_context.m_current_file = pathName;
1497 ProcessOneFile(
false, ! commonOutputStream, ! commonOutputStream);
1499 }
else if (recurse) {
1500 ProcessOneDirectory(*it,
mask, recurse);
1503 if (commonOutputStream) {
1506 CloseDiagnosticStreams();
1534 auto modMergePolicy =
1535 m_context.m_accumulate_mods ?
1540 m_global_files.mp_src_qual_map.get(),
1541 m_secret_files->mp_src_qual_map.get(),
1542 m_context.mCommandLineMods,
1544 m_context.m_verbose,
1549 if (! m_context.m_huge_files_mode) {
1550 if (m_global_files.m_descriptors)
1551 m_reader->ApplyDescriptors(
result, *m_global_files.m_descriptors);
1552 if (m_secret_files->m_descriptors)
1553 m_reader->ApplyDescriptors(
result, *m_secret_files->m_descriptors);
1556 if (! m_global_files.m_AnnotMap.empty() || ! m_secret_files->m_AnnotMap.empty()) {
1563 auto modMergePolicy =
1564 m_context.m_accumulate_mods ?
1569 m_global_files.mp_src_qual_map.get(),
1570 m_secret_files->mp_src_qual_map.get(),
1571 m_context.mCommandLineMods,
1573 m_context.m_verbose,
1578 if (! m_context.m_huge_files_mode) {
1579 if (m_global_files.m_descriptors)
1580 m_reader->ApplyDescriptors(*token.
top_entry, *m_global_files.m_descriptors);
1581 if (m_secret_files->m_descriptors)
1582 m_reader->ApplyDescriptors(*token.
top_entry, *m_secret_files->m_descriptors);
1585 if (! m_global_files.m_AnnotMap.empty() || ! m_secret_files->m_AnnotMap.empty()) {
1599 if (!
file.Exists() ||
file.GetLength() == 0)
1601 m_reader->LoadDescriptors(pathname, m_secret_files->m_descriptors);
1606 if (m_global_files.m_struct_comments)
1607 m_global_files.m_struct_comments->ProcessComments(
result);
1608 if (m_secret_files && m_secret_files->m_struct_comments)
1609 m_secret_files->m_struct_comments->ProcessComments(
result);
1615 if (!
file.Exists() ||
file.GetLength() == 0)
1620 m_secret_files->m_replacement_proteins = m_secret_files->m_feature_table_reader->ReadProtein(*reader);
1626 if (!
file.Exists() ||
file.GetLength() == 0)
1633 if (!
file.Exists() ||
file.GetLength() == 0)
1638 m_secret_files->m_possible_proteins = m_secret_files->m_feature_table_reader->ReadProtein(*reader);
1646 if (!
file.Exists())
1649 if (
file.IsIdentical(m_context.m_current_file)) {
1652 "Ignorning annotation " + pathname +
" because it was already used as input source",
1657 if (
file.GetLength() == 0) {
1662 m_reader->LoadAnnotMap(pathname, annotMap);
1668 if (entry.
IsSeq()) {
1669 m_reader->AddAnnots(m_global_files.m_AnnotMap, m_global_files.m_MatchedAnnots, entry.
SetSeq());
1670 if (m_secret_files) {
1671 m_reader->AddAnnots(m_secret_files->m_AnnotMap, m_secret_files->m_MatchedAnnots, entry.
SetSeq());
1685 if (pSubEntry && pSubEntry->IsSeq() && pSubEntry->GetSeq().IsNa()) {
1686 AddAnnots(*pSubEntry);
1694 AddAnnots(*pSubEntry);
1703 if (
file.Exists() &&
file.GetLength()) {
1716 string name = dir + base;
1722 const auto& namedSrcFile = m_context.m_single_source_qual_file;
1723 if (!
NStr::IsBlank(namedSrcFile) && ! m_global_files.mp_src_qual_map) {
1725 m_global_files.mp_src_qual_map->MapFile(namedSrcFile, m_context.m_allow_accession);
1728 const string defaultSrcFile = name +
".src";
1729 if (
CFile(defaultSrcFile).Exists()) {
1731 m_secret_files->mp_src_qual_map->MapFile(defaultSrcFile, m_context.m_allow_accession);
1734 LoadPEPFile(name +
".pep");
1735 LoadRNAFile(name +
".rna");
1736 LoadPRTFile(name +
".prt");
1737 LoadDSCFile(name +
".dsc");
1739 LoadCMTFile(m_context.m_single_structure_cmt, m_global_files.m_struct_comments);
1740 LoadCMTFile(name +
".cmt", m_secret_files->m_struct_comments);
1744 if (! m_context.m_single_annot_file.empty() && m_global_files.m_AnnotMap.empty())
1746 LoadAnnotMap(m_context.m_single_annot_file, m_global_files.m_AnnotMap);
1748 for (
auto suffix : {
".tbl",
".gff",
".gff3",
".gff2",
".gtf" }) {
1749 LoadAnnotMap(name +
suffix, m_secret_files->m_AnnotMap);
1751 #ifdef THIS_IS_TRUNK_BUILD
1752 for (
auto suffix : {
".gbf" }) {
1753 LoadAnnotMap(name +
suffix, m_secret_files->m_AnnotMap);
1762 if (m_context.m_verbose && m_secret_files && m_secret_files->mp_src_qual_map)
1763 m_secret_files->mp_src_qual_map->ReportUnusedIds();
1771 int main(
int argc,
const char* argv[])
1775 list<string> split_args;
1776 vector<const char*> new_argv;
1778 if (argc==2 && argv && argv[1] && strchr(argv[1],
' ')) {
1781 auto it = split_args.begin();
1782 while (it != split_args.end()) {
1784 if (
next != split_args.end() &&
1785 ((it->front() ==
'"' && it->back() !=
'"') ||
1786 (it->front() ==
'\'' && it->back() !=
'\'')))
1788 it->append(
" "); it->append(*
next);
1792 for (
auto& rec : split_args) {
1793 if (rec.front() ==
'\'' && rec.back()==
'\'')
1794 rec = rec.substr(1, rec.length()-2);
1796 argc = 1 + split_args.size();
1797 new_argv.reserve(argc);
1798 new_argv.push_back(argv[0]);
1799 for (
const string& s : split_args) {
1800 new_argv.push_back(s.c_str());
1801 std::cerr << s.c_str() <<
" ";
1806 argv = new_argv.data();
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
static const CDataLoadersUtil::TLoaders default_loaders
void g_LogGeneralParsingError(EDiagSev sev, const string &idString, const string &msg, objects::ILineErrorListener &listener)
const SBadResiduePositions & GetBadResiduePositions(void) const THROWS_NONE
static bool CleanArticle(CCit_art &, bool fix_initials, bool strip_serial)
static bool ConvertPubFeatsToPubDescs(CSeq_entry_Handle seh)
Convert full-length publication features to publication descriptors.
@ eClean_NoNcbiUserObjects
static void SetupObjectManager(const CArgs &args, objects::CObjectManager &obj_mgr, TLoaders loaders=fDefault)
Set up the standard object manager data loaders according to the arguments provided above.
static void AddArgumentDescriptions(CArgDescriptions &arg_desc, TLoaders loaders=fDefault)
Add a standard set of arguments used to configure the object manager.
void Generate(const CSeq_entry_Handle &entry, CFlatItemOStream &item_os, const multiout &={})
static CLineError * Create(EProblem eProblem, EDiagSev eSeverity, const std::string &strSeqId, unsigned int uLine, const std::string &strFeatureName=string(""), const std::string &strQualifierName=string(""), const std::string &strQualifierValue=string(""), const std::string &strErrorMessage=string(""), const TVecOfLines &vecOfOtherLines=TVecOfLines())
Use this because the constructor is protected.
void PutProgress(const string &sMessage, const Uint8 iNumDone, const Uint8 iNumTotal) override
This is used for processing progress messages.
bool PutMessage(const IObjtoolsMessage &message) override
static const set< TTypeInfo > kSupportedTypes
SeqMap related exceptions.
namespace ncbi::objects::
static void UpdateTaxonFromTable(objects::CBioseq &bioseq)
bool PutMessage(const IObjtoolsMessage &message) override
void Post(const SDiagMessage &mess) override
Post message to handler.
void PutProgress(const string &sMessage, const Uint8 iNumDone=0, const Uint8 iNumTotal=0) override
void LoadCMTFile(const string &pathname, unique_ptr< CTable2AsnStructuredCommentsReader > &comments)
void LoadDSCFile(const string &pathname)
void ProcessAlignmentFile(CNcbiOstream *output)
void Init() override
Initialize the application.
void ProcessOneEntry(CFormatGuess::EFormat inputFormat, CRef< CSerialObject > obj, CRef< CSerialObject > &result)
void SetupAndOpenDataStreams()
void AddAnnots(CSeq_entry &entry)
void ProcessSecretFiles2Phase(CSeq_entry &result) const
void SetupAndOpenDiagnosticStreams()
int Run() override
Run the application.
void ProcessSecretFiles1Phase(bool readModsFromTitle, TAsyncToken &)
void MakeFlatFile(CSeq_entry_Handle seh, CRef< CSeq_submit > submit, std::ostream &ostream)
void xProcessSecretFiles1Phase(bool readModsFromTitle, CSeq_entry &result)
void Setup(const CArgs &args)
void ProcessOneFile(bool isAlignment, bool manageDiagnosticStreams=true, bool manageDataStream=true)
void x_SetAlnArgs(CArgDescriptions &arg_desc)
void ReportUnusedSourceQuals()
void ProcessCMTFiles(CSeq_entry &result) const
void LoadAnnotMap(const string &pathname, TAnnotMap &annotMap)
bool ProcessOneDirectory(const CDir &directory, const CMask &mask, bool recurse)
void LoadPEPFile(const string &pathname)
void LoadAdditionalFiles()
void CloseDiagnosticStreams()
void xProcessOneFile(CFormatGuess::EFormat format, CRef< CSerialObject > pInputObject, TAnnotMap &annotMap, CNcbiOstream *output)
void ProcessSingleEntry(CFormatGuess::EFormat inputFormat, TAsyncToken &token)
void LoadPRTFile(const string &pathname)
size_t xGetNumThreads() const
void LoadRNAFile(const string &pathname)
void ProcessTopEntry(CFormatGuess::EFormat inputFormat, bool need_update_date, CRef< CSeq_submit > &submit, CRef< CSeq_entry > &entry)
bool PutMessage(const IObjtoolsMessage &message) override
@ eProblem_GeneralParsingError
vector< unsigned int > TVecOfLines
const_iterator begin() const
Include a standard set of the NCBI C++ Toolkit most basic headers.
constexpr auto begin(const ct_const_array< T, N > &in) noexcept
constexpr auto end(const ct_const_array< T, N > &in) noexcept
std::ofstream out("events_result.xml")
main entry point for tests
static void cleanup(void)
static DLIST_TYPE *DLIST_NAME() next(DLIST_LIST_TYPE *list, DLIST_TYPE *item)
static SQLCHAR output[256]
static const char * str(char *buf, int n)
unsigned int TSeqPos
Type for sequence locations and lengths.
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.
void Reset(void)
Remove all arguments.
void SetConstraint(const string &name, const CArgAllow *constraint, EConstraintNegate negate=eConstraint)
Set additional user defined constraint on argument value.
void SetDependency(const string &arg1, EDependency dep, const string &arg2)
Define a dependency.
bool Exist(const string &name) const
Check existence of argument description.
void AddOptionalKey(const string &name, const string &synopsis, const string &comment, EType type, TFlags flags=0)
Add description for optional key without default value.
void AddDefaultKey(const string &name, const string &synopsis, const string &comment, EType type, const string &default_value, TFlags flags=0, const string &env_var=kEmptyStr, const char *display_value=nullptr)
Add description for optional key with default value.
@ fAllowMultiple
Repeated key arguments are legal (use with AddKey)
@ fHidden
Hide it in Usage.
@ fUsageIfNoArgs
Force printing USAGE (and then exit) if no command line args are present.
@ eExcludes
One argument excludes another.
@ eInputFile
Name of file (must exist and be readable)
@ eString
An arbitrary string.
@ eOutputFile
Name of file (must be writable)
@ eInteger
Convertible into an integer number (int or Int8)
void Write(string &str, TDiagWriteFlags flags=fNone) const
Binary OR of "EDiagWriteFlags".
EDiagSev m_Severity
Severity level.
TDiagPostFlags m_Flags
Bitwise OR of "EDiagPostFlag".
static const char * SeverityName(EDiagSev sev)
Get a common symbolic name for the severity levels.
void SetDiagHandler(CDiagHandler *handler, bool can_delete=true)
Set the diagnostic handler using the specified diagnostic handler class.
EDiagSev
Severity level for the posted diagnostics.
void SetDiagStream(CNcbiOstream *os, bool quick_flush=true, FDiagCleanup cleanup=0, void *cleanup_data=0, const string &stream_name="")
Set diagnostic stream.
@ eDPF_IsNote
Print "Note[X]" severity name.
@ eDS_Default
Try standard log file (app.name + ".log") in /log/, use stderr on failure.
@ eDiag_Info
Informational message.
@ eDiag_Error
Error message.
@ eDiag_Warning
Warning message.
@ eDiag_Fatal
Fatal error – guarantees exit(or abort)
@ eDiag_Critical
Critical error message.
#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 & GetMsg(void) const
Get message string.
const CException * GetPredecessor(void) const
Get "previous" exception from the backlog.
static string CreateAbsolutePath(const string &path, ERelativeToWhat rtw=eRelativeToCwd)
Get an absolute path from some, possibly relative, path.
string GetBase(void) const
Get the base entry name without extension.
Int8 GetLength(void) const
Get size of file.
virtual bool Remove(TRemoveFlags flags=eRecursive) const
Remove a directory entry.
static string AddTrailingPathSeparator(const string &path)
Add trailing path separator, if needed.
virtual bool Exists(void) const
Check if directory "dirname" exists.
bool Create(TCreateFlags flags=fCreate_Default) const
Create the directory using "dirname" passed in the constructor.
TEntries * GetEntriesPtr(const string &mask=kEmptyStr, TGetEntriesFlags flags=0) const
Get directory entries based on the specified "mask".
const string & GetPath(void) const
Get entry path.
virtual bool Exists(void) const
Check existence of file.
static void SplitPath(const string &path, string *dir=0, string *base=0, string *ext=0)
Split a path string into its basic components.
@ eRelativeToCwd
Relative to the current working directory.
@ fIgnoreRecursive
Suppress "self recursive" elements (the directories "." and "..").
@ fCreateObjects
Create appropriate subclasses of CDirEntry (CFile,CDir,...), not just CDirEntry objects.
@ fIgnoreMissing
Ignore missed entries.
#define ENUM_METHOD_NAME(EnumName)
virtual const CTypeInfo * GetThisTypeInfo(void) const =0
CTempString GetCurrentLine(void) const
static CRef< ILineReader > New(const string &filename)
Return a new ILineReader object corresponding to the given filename, taking "-" (but not "....
virtual bool AtEOF(void) const =0
Indicates (negatively) whether there is any more input.
static CRef< CObjectManager > GetInstance(void)
Return the existing object manager or create one.
CScope & GetScope(void) const
Get scope this handle belongs to.
CRef< C > Ref(C *object)
Helper functions to get CRef<> and CConstRef<> objects.
TObjectType * GetPointer(void) THROWS_NONE
Get pointer,.
bool NotEmpty(void) const THROWS_NONE
Check if CRef is not empty – pointing to an object and has a non-null value.
bool Empty(void) const THROWS_NONE
Check if CRef is empty – not pointing to any object, which means having a null value.
uint64_t Uint8
8-byte (64-bit) unsigned integer
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
IO_PREFIX::ofstream CNcbiOfstream
Portable alias for ofstream.
IO_PREFIX::ostream CNcbiOstream
Portable alias for ostream.
IO_PREFIX::ifstream CNcbiIfstream
Portable alias for ifstream.
static int StringToInt(const CTempString str, TStringToNumFlags flags=0, int base=10)
Convert string to int.
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 bool IsBlank(const CTempString str, SIZE_TYPE pos=0)
Check if a string is blank (has no text).
static void TruncateSpacesInPlace(string &str, ETrunc where=eTrunc_Both)
Truncate spaces in a string (in-place)
static string XmlEncode(const CTempString str, TXmlEncode flags=eXmlEnc_Contents)
Encode a string for XML.
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.
@ fWithCommas
Use commas as thousands separator.
@ eCurrent
Use current time. See also CCurrentTime.
virtual bool IsType(TTypeInfo type) const
void CONNECT_Init(const IRWRegistry *reg=0, CRWLock *lock=0, TConnectInitFlags flag=eConnectInit_OwnNothing, FSSLSetup ssl=0)
Init [X]CONNECT library with the specified "reg" and "lock" (ownership for either or both can be deta...
void Add(const string &mask)
Add an inclusion mask.
bool IsArticle(void) const
Check if variant Article is selected.
TArticle & SetArticle(void)
Select the variant.
bool IsSetClass(void) const
Check if a value has been assigned to Class data member.
TSet & SetSet(void)
Select the variant.
TClass GetClass(void) const
Get the Class member data.
const TSet & GetSet(void) const
Get the variant data.
bool IsSeq(void) const
Check if variant Seq is selected.
bool IsSetSeq_set(void) const
Check if a value has been assigned to Seq_set data member.
bool IsSet(void) const
Check if variant Set is selected.
TSeq & SetSeq(void)
Select the variant.
TSeq_set & SetSeq_set(void)
Assign a value to Seq_set data member.
@ eClass_pop_set
population study
@ eClass_phy_set
phylogenetic study
@ eClass_mut_set
set of mutations
@ eClass_eco_set
ecological sample study
@ eClass_nuc_prot
nuc acid and coded proteins
@ eClass_small_genome_set
viral segments or mitochondrial minicircles
if(yy_accept[yy_current_state])
Lightweight interface for getting lines of data with minimal memory copying.
constexpr auto sort(_Init &&init)
const struct ncbi::grid::netcache::search::fields::EXPIRES expires
Magic spell ;-) needed for some weird compilers... very empiric.
void VisitAllFeatures(objects::CSeq_entry_EditHandle &entry_h, _M m)
void VisitAllBioseqs(objects::CSeq_entry &entry, _M &&m)
const GenericPointer< typename T::ValueType > T2 value
#define NCBI_SC_VERSION_PROXY
#define NCBI_TEAMCITY_BUILD_NUMBER_PROXY
Classes to match a string against a set of masks.
Defines the CNcbiApplication and CAppException classes for creating NCBI applications.
#define GetArgs
Avoid preprocessor name clash with the NCBI C Toolkit.
Defines command line argument related classes.
Defines unified interface to application:
NCBI C++ stream class wrappers for triggering between "new" and "old" C++ stream libraries.
bool le(T x_, T y_, T round_)
std::istream & in(std::istream &in_, double &x_)
double r(size_t dimension_, const Int4 *score_, const double *prob_, double theta_)
double f(double x_, const double &y_)
static const char * suffix[]
void SortSeqDescr(CSeq_entry &entry)
void g_ApplyMods(CMemorySrcFileMap *pNamedSrcFileMap, CMemorySrcFileMap *pDefaultSrcFileMap, const string &commandLineStr, bool readModsFromTitle, bool isVerbose, CModHandler::EHandleExisting mergePolicy, ILineErrorListener *pEC, CSeq_entry &entry)
TBadIndexMap m_BadIndexMap
CRef< CSeq_submit > submit
atomic_bool * pPubLookupDone
CRef< CSeq_entry > top_entry
std::mutex * cleanup_mutex
static void s_PubCleanup(CRef< CPub > &pub)
static bool s_UseHugeFileMode(const CTable2AsnContext &context, CFormatGuess::EFormat format)
int main(int argc, const char *argv[])
void g_LogDiagMessage(ILineErrorListener *logger, EDiagSev sev, const string &msg)
static void s_FailOnBadInput(const string &specifics, IObjtoolsListener &listener)
void g_LoadLinkageEvidence(const string &linkageEvidenceFilename, CGapsEditor::TCountToEvidenceMap &gapsizeToEvidence, ILineErrorListener *pEC)
int g(Seg_Gsm *spe, Seq_Mtf *psm, Thd_Gsm *tdg)
static CS_CONTEXT * context
static wxAcceleratorEntry entries[3]