49 virtual void Init(
void);
50 virtual int Run (
void);
60 arg_desc->AddDefaultKey(
"gi",
"GI",
65 arg_desc->AddOptionalKey(
"file",
"InputFile",
66 "Input file to test, one gi or accession per line",
69 arg_desc->AddFlag(
"show_acc",
70 "Show the passed accession as well as the gi");
82 bool show = args[
"show_acc"];
84 vector<string> id_list;
85 if( args[
"gi"].AsInteger() ) {
86 id_list.push_back( args[
"gi"].AsString() );
93 id_list.push_back(acc);
101 static const char* sc_ValidChars =
102 "abcdefghijklmnopqrstuvwxyz"
103 "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
107 ITERATE (vector<string>, iter, id_list) {
108 string id_str = *iter;
110 string::size_type pos = id_str.find_first_not_of(sc_ValidChars);
111 if (pos != string::npos) {
114 if ( id_str.empty() ) {
122 gi = NStr::StringToNumeric<TGi>(id_str);
126 cout <<
"trying: " << *iter <<
" -> " << id_str << endl;
144 cout << id_str <<
" ";
146 cout << gi <<
" " << tax_id << endl;
153 int main(
int argc,
const char* argv[])
virtual int Run(void)
Run the application.
virtual void Init(void)
Initialize the application.
bool GetTaxId4GI(TGi gi, TTaxId &tax_id_out)
int main(int argc, const char *argv[])
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.
SStrictId_Tax::TId TTaxId
Taxon id type.
@ eInputFile
Name of file (must exist and be readable)
@ eInteger
Convertible into an integer number (int or Int8)
#define ERR_POST(message)
Error posting with file, line number information but without error codes.
#define LOG_POST(message)
This macro is deprecated and it's strongly recomended to move in all projects (except tests) to macro...
@ eDS_Default
Try standard log file (app.name + ".log") in /log/, use stderr on failure.
void Error(CExceptionArgs_Base &args)
void Info(CExceptionArgs_Base &args)
IO_PREFIX::istream CNcbiIstream
Portable alias for istream.
static string TruncateSpaces(const string &str, ETrunc where=eTrunc_Both)
Truncate spaces in a string.
virtual NCBI_NS_NCBI::TGi AskGetgi(const CSeq_id &req, TReply *reply=0)
Magic spell ;-) needed for some weird compilers... very empiric.
Defines the CNcbiApplication and CAppException classes for creating NCBI applications.
Defines command line argument related classes.
Defines unified interface to application:
Process information in the NCBI Registry, including working with configuration files.