(
void);
75 virtual int Run(
void);
76 virtual void Exit(
void);
119arg_desc->AddFlag(
"einfo",
"Call einfo utility",
true);
120arg_desc->AddFlag(
"efetch",
"Call efetch utility",
true);
122arg_desc->AddFlag(
"esearch",
"Call esearch utility",
true);
123arg_desc->AddFlag(
"epost",
"Call epost utility",
true);
124arg_desc->AddFlag(
"elink",
"Call elink utility",
true);
125arg_desc->AddFlag(
"egquery",
"Call egquery utility",
true);
126arg_desc->AddFlag(
"esummary",
"Call esummary utility",
true);
127arg_desc->AddFlag(
"espell",
"Call espell utility",
true);
128arg_desc->AddFlag(
"ehistory",
"Call ehistory utility",
true);
131arg_desc->AddDefaultKey(
"http",
"Method",
132 "HTTP method used to send requests",
139arg_desc->AddFlag(
"dump",
"Print raw incoming data",
true);
142arg_desc->AddOptionalKey(
"webenv",
"WebEnv",
"Web environment",
144arg_desc->AddOptionalKey(
"query_key",
"query_key",
"Query key",
147arg_desc->AddFlag(
"skip_query_key",
"Do not send query_key",
true);
148arg_desc->AddOptionalKey(
"tool",
"tool",
"Client tool",
150arg_desc->AddOptionalKey(
"email",
"email",
"Client e-mail",
154arg_desc->AddOptionalKey(
"db",
"db",
"Database name",
156arg_desc->AddOptionalKey(
"id",
"id",
"ID to fetch",
158arg_desc->AddOptionalKey(
"term",
"term",
"Term to search for",
160arg_desc->AddOptionalKey(
"retstart",
"RetStart",
"First item to fetch",
163arg_desc->AddOptionalKey(
"retmax",
"RetMax",
"Number of items to fetch",
166arg_desc->AddDefaultKey(
"retmode",
"RetMode",
"Data format",
169 "text",
"xml",
"asn",
"html"));
170arg_desc->AddOptionalKey(
"rettype",
"RetType",
"Fetched data type",
174 "uilist",
"abstract",
"citation",
"medline",
"full",
176 "native",
"fasta",
"gb",
"gbc",
"gbwithparts",
"est",
"gss",
177 "gp",
"gpc",
"seqid",
"acc",
"chr",
"flt",
"rsr",
"brief",
"docset",
180 "count",
"uilist"));
181arg_desc->AddOptionalKey(
"reldate",
"RelDate",
"Age of date in days",
184arg_desc->AddOptionalKey(
"report",
"Report",
"Taxonomy data format",
187 "uilist",
"brief",
"docsum",
"xml"));
189arg_desc->AddOptionalKey(
"usehistory",
"UseHistory",
"Use history",
191arg_desc->AddOptionalKey(
"sort",
"Sort",
"Sort order or 'none'",
216arg_desc->AddOptionalKey(
"dbfrom",
"dbfrom",
"origination db for elink",
219arg_desc->AddOptionalKey(
"cmd",
"Command",
"elink command",
222 "prlinks",
"llinks",
"llinkslib",
"lcheck",
"ncheck",
223 "neighbor",
"neighbor_history",
"acheck"));
225arg_desc->AddOptionalKey(
"linkname",
"Linkname",
"elink linkname",
228arg_desc->AddOptionalKey(
"holding",
"holding",
"elink holding",
231arg_desc->AddOptionalKey(
"version",
"Version",
"elink DTD version",
235 stringprog_description =
236 "Test loading data from EUtils";
237arg_desc->SetUsageContext(
GetArguments().GetProgramBasename(),
238prog_description,
false);
247 if( args[
"http"].AsString() ==
"get") {
257cout <<
data<< endl;
263 stringdb = args[
"db"] ? args[
"db"].AsString() :
kEmptyStr;
277 if(
result->IsDbList() ) {
278 for(
const auto& name :
result->GetDbList().GetDbName()) {
295req.
SetTerm(args[
"term"].AsString());
296 if( args[
"usehistory"] ) {
299 if( args[
"sort"] ) {
302 if( args[
"reldate"] ) {
303req.
SetRelDate(args[
"reldate"].AsInteger());
306 if( args[
"retmax"] ) {
307req.
SetRetMax(args[
"retmax"].AsInteger());
310 stringrettype = args[
"rettype"] ? args[
"rettype"].AsString() :
kEmptyStr;
311 if(rettype ==
"count") {
314 else if(rettype ==
"uilist") {
317 else if( !rettype.empty() ) {
319 " is incompatible with e-search request.");
346req.
SetTerm(args[
"term"].AsString());
394 if( args[
"dbfrom"] ) {
395req.
SetDbFrom(args[
"dbfrom"].AsString());
402 if( args[
"cmd"] ) {
403 string cmd= args[
"cmd"].AsString();
404 if(
cmd==
"prlinks") {
407 else if(
cmd==
"llinks") {
410 else if(
cmd==
"llinkslib") {
413 else if(
cmd==
"lcheck") {
416 else if(
cmd==
"ncheck") {
419 else if(
cmd==
"neighbor") {
422 else if(
cmd==
"neighbor_history") {
425 else if(
cmd==
"acheck") {
432 if( args[
"linkname"] ) {
435 if( args[
"holding"] ) {
436req.
SetHolding(args[
"holding"].AsString());
438 if( args[
"version"] ) {
439req.
SetHolding(args[
"version"].AsString());
441 if( args[
"reldate"] ) {
442req.
SetRelDate(args[
"reldate"].AsInteger());
463 stringdb = args[
"db"] ? args[
"db"].AsString() :
kEmptyStr;
472 if( args[
"retstart"] ) {
475 if( args[
"retmax"] ) {
476req.
SetRetMax(args[
"retmax"].AsInteger());
497cout <<
"Deserialization error: "<< ex.
what() << endl;
505 stringdb = args[
"db"] ? args[
"db"].AsString() :
kEmptyStr;
509req.
SetTerm(args[
"term"].AsString());
530 if( args[
"db"] ) {
531db = args[
"db"].AsString();
554 stringdb = args[
"db"].AsString();
556 if(db ==
"pubmed") {
559 else if(db ==
"pmc") {
562 else if(db ==
"journals") {
565 else if(db ==
"omim") {
571unique_ptr<CEFetch_Literature_Request> lit_req(
574 stringrettype = args[
"rettype"] ? args[
"rettype"].AsString() :
kEmptyStr;
575 if(rettype ==
"uilist") {
578 else if(rettype ==
"abstract") {
581 else if(rettype ==
"citation") {
584 else if(rettype ==
"medline") {
587 else if(rettype ==
"full") {
590 else if( !rettype.empty() ) {
592 " is incompatible with the selected database "<< db);
596 returnlit_req.release();
603 stringdb = args[
"db"].AsString();
608 else if(db ==
"genome") {
611 else if(db ==
"nucleotide") {
614 else if(db ==
"nuccore") {
617 else if(db ==
"nucest") {
620 else if(db ==
"nucgss") {
623 else if(db ==
"protein") {
626 else if(db ==
"popset") {
629 else if(db ==
"snp") {
632 else if(db ==
"sequences") {
638unique_ptr<CEFetch_Sequence_Request> seq_req(
641 stringrettype = args[
"rettype"] ? args[
"rettype"].AsString() :
kEmptyStr;
642 if(rettype ==
"native") {
645 else if(rettype ==
"fasta") {
648 else if(rettype ==
"gb") {
651 else if(rettype ==
"gbc") {
654 else if(rettype ==
"gbwithparts") {
657 else if(rettype ==
"est") {
660 else if(rettype ==
"gss") {
663 else if(rettype ==
"gp") {
666 else if(rettype ==
"gpc") {
669 else if(rettype ==
"seqid") {
672 else if(rettype ==
"acc") {
675 else if(rettype ==
"chr") {
678 else if(rettype ==
"flt") {
681 else if(rettype ==
"rsr") {
684 else if(rettype ==
"brief") {
687 else if(rettype ==
"docset") {
690 else if(rettype ==
"gi2acc") {
693 else if( !rettype.empty() ) {
695 " is incompatible with the selected database "<< db);
699 returnseq_req.release();
706 stringdb = args[
"db"].AsString();
707 if(db !=
"taxonomy") {
710unique_ptr<CEFetch_Taxonomy_Request> tax_req(
713 if( args[
"report"] ) {
714 stringreport = args[
"report"].AsString();
715 if(report ==
"uilist") {
718 else if(report ==
"brief") {
721 else if(report ==
"docsum") {
724 else if(report ==
"xml") {
728 ERR_POST(
Error<<
"Unsupported taxonomy report: "<< report);
732 returntax_req.release();
751<< args[
"db"].AsString() <<
" using the specified arguments.");
758 if( req->GetConnContext()->GetWebEnv().empty() && args[
"id"] ) {
759req->GetId().SetIds(args[
"id"].AsString());
762 stringretmode_str = args[
"retmode"].AsString();
764 if(retmode_str ==
"text") {
767 else if(retmode_str ==
"xml") {
770 else if(retmode_str ==
"html") {
773 else if(retmode_str ==
"asn") {
779req->SetRetMode(retmode);
781 if( args[
"retmax"] ) {
782req->SetRetMax(args[
"retmax"].AsInteger());
785cout << req->GetScriptName() <<
"?"<< req->GetQueryString() << endl;
795cout << content << endl;
807 if(args[
"webenv"]) {
810 if(args[
"query_key"]) {
813 if(args[
"skip_query_key"]) {
816 if(args[
"tool"]) {
819 if(args[
"email"]) {
822 if(args[
"base_url"]) {
827 if( args[
"einfo"] ) {
830 if( args[
"egquery"] ) {
833 if( args[
"espell"] ) {
836 if( args[
"esearch"] ) {
839 if( args[
"epost"] ) {
842 if( args[
"elink"] ) {
845 if( args[
"esummary"] ) {
848 if( args[
"efetch"] ) {
852 if( args[
"ehistory"] ) {
CEFetch_Literature_Request.
CEFetch_Sequence_Request.
CEFetch_Taxonomy_Request.
void x_SetHttpMethod(CEUtils_Request &req, const CArgs &args)
void CallEInfo(const CArgs &args)
void CallESpell(const CArgs &args)
virtual void Init(void)
Initialize the application.
void CallEGQuery(const CArgs &args)
virtual void Exit(void)
Cleanup on application exit.
void x_DumpRequest(CEUtils_Request &req)
void CallEPost(const CArgs &args)
CRef< CEUtils_ConnContext > & x_GetCtx(void)
CEFetch_Request * x_CreateSeqRequest(const CArgs &args)
void CallESearch(const CArgs &args)
void CallELink(const CArgs &args)
void CallEHistory(const CArgs &args)
void CallESummary(const CArgs &args)
virtual int Run(void)
Run the application.
CEFetch_Request * x_CreateLitRequest(const CArgs &args)
CEFetch_Request * x_CreateTaxRequest(const CArgs &args)
void CallEFetch(const CArgs &args)
CRef< CEUtils_ConnContext > m_Ctx
Root class for all serialization exceptions.
int NcbiSys_main(int argc, ncbi::TXChar *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.
const CNcbiArguments & GetArguments(void) const
Get the application's cached unprocessed command-line arguments.
@ eRequires
One argument requires another.
@ eBoolean
{'true', 't', 'false', 'f'}, case-insensitive
@ eString
An arbitrary string.
@ eInteger
Convertible into an integer number (int or Int8)
#define ERR_POST(message)
Error posting with file, line number information but without error codes.
virtual string GetQueryString(void) const
Get CGI script query string.
ERetMode
Output format for efetch requests.
void SetDatabase(const string &database)
Setting new database disconnects the request.
const CEUtils_IdGroupSet & GetIdGroups(void) const
Multiple ID groups.
void SetSortOrderName(CTempString name)
Set sort order. Empty string indicates no sorting (or the default one).
void SetRetStart(int retstart)
const CEUtils_IdGroup & GetId(void) const
Group of ids required if history is not used.
ESequenceDB
Sequence databases.
CRef< elink::CELinkResult > GetELinkResult(void)
Get search result.
void SetRequestMethod(ERequestMethod method)
Set HTTP method.
void SetRetMax(int retmax)
virtual string GetQueryString(void) const
Get CGI script query string.
virtual string GetQueryString(void) const
Get CGI script query string.
ELiteratureDB
Literature databases.
CRef< espell::CESpellResult > GetESpellResult(void)
Get search results.
void SetTool(const string &tool)
CRef< CEUtils_ConnContext > & GetConnContext(void) const
Get current request context.
void SetGroups(const string &groups)
Parse a set of id groups from a single string ('id=12,34&id=56,78').
CRef< einfo::CEInfoResult > GetEInfoResult(void)
Get result.
const string & GetScriptName(void) const
Get CGI script name (e.g. efetch.fcgi).
void SetTerm(const string &term)
virtual string GetQueryString(void) const
Get CGI script query string.
CRef< ehistory::CEHistoryResult > GetEHistoryResult(void)
Get request history.
CRef< epost::CEPostResult > GetEPostResult(void)
Get search results.
const CEUtils_IdGroup & GetId(void) const
Group of ids to be added to the search history.
void SetLinkName(const string &linkname)
void SetTerm(const string &term)
void SetRelDate(int days)
void SetEmail(const string &email)
CRef< esearch::CESearchResult > GetESearchResult(void)
Get search results.
CRef< esummary::CESummaryResult > GetESummaryResult(void)
Get search result.
virtual string GetQueryString(void) const
Get CGI script query string.
void Read(string *content)
Read the whole stream into the string.
void SetRetType(ERetType rettype)
CRef< egquery::CResult > GetResult(void)
Get search results.
const string & GetWebEnv(void) const
Get WebEnv.
const string & GetQueryKey(void) const
Get query_key.
void SetUseHistory(bool value)
void SetRetMax(int retmax)
void SetDbFrom(const string &dbfrom)
static void SetBaseURL(const string &url)
Set new base url for all e-utils requests.
void SetQueryKey(const string &query_key)
Set query_key.
void SetHolding(const string &holding)
void SetWebEnv(const string &webenv)
Set WebEnv.
void SetTerm(const string &term)
void SetIds(const string &ids)
Parse all ids from a string (e.g. 'id=123,456,78').
void SetRelDate(int days)
void SetCommand(ECommand cmd)
virtual string GetQueryString(void) const
Get CGI script query string.
void SetSendQueryKey(bool value)
Set SendQueryKey flag.
virtual string GetQueryString(void) const
Get CGI script query string.
@ eRetMode_text
Return data as plain text.
@ eRetMode_xml
Return data as XML.
@ eRetMode_html
Return data as HTML.
@ eRetMode_asn
Return data as text ASN.1.
@ eCmd_llinks
LinkOut URLs, except PubMed libraries.
@ eCmd_ncheck
Check for the existence of neighbor links.
@ eCmd_lcheck
Check for the existence of external links.
@ eCmd_prlinks
Links to the primary provider.
@ eCmd_acheck
Entrez databases links.
@ eCmd_neighbor
Display neighbors within a database (default)
@ eCmd_llinkslib
LinkOut URLs and Attributes.
@ eCmd_neighbor_history
Create history for use in other EUtils.
void Error(CExceptionArgs_Base &args)
virtual const char * what(void) const noexcept
Standard report (includes full backlog).
void Reset(void)
Reset reference object.
Defines the CNcbiApplication and CAppException classes for creating NCBI applications.
Defines command line argument related classes.
Defines unified interface to application:
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